From 2b3e9d9b244e279ef5693a7cf5dacc7903164af5 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Mon, 22 Jul 2002 09:46:48 +0000 Subject: Remove, moved to cpukit. --- c/src/exec/.cvsignore | 15 - c/src/exec/ChangeLog | 295 -- c/src/exec/Makefile.am | 23 - c/src/exec/configure.ac | 121 - c/src/exec/include/.cvsignore | 2 - c/src/exec/include/Makefile.am | 26 - c/src/exec/include/rtems/bspIo.h | 37 - c/src/exec/include/rtems/fs.h | 59 - c/src/exec/include/rtems/libio_.h | 310 -- c/src/exec/include/rtems/userenv.h | 79 - c/src/exec/itron/.cvsignore | 14 - c/src/exec/itron/ChangeLog | 167 - c/src/exec/itron/Makefile.am | 10 - c/src/exec/itron/configure.ac | 55 - c/src/exec/itron/include/.cvsignore | 2 - c/src/exec/itron/include/Makefile.am | 55 - c/src/exec/itron/include/itron.h | 52 - c/src/exec/itron/include/itronsys/.cvsignore | 2 - c/src/exec/itron/include/itronsys/README | 9 - c/src/exec/itron/include/itronsys/eventflags.h | 146 - c/src/exec/itron/include/itronsys/fmempool.h | 125 - c/src/exec/itron/include/itronsys/intr.h | 106 - c/src/exec/itron/include/itronsys/mbox.h | 138 - c/src/exec/itron/include/itronsys/msgbuffer.h | 160 - c/src/exec/itron/include/itronsys/network.h | 78 - c/src/exec/itron/include/itronsys/port.h | 190 - c/src/exec/itron/include/itronsys/semaphore.h | 121 - c/src/exec/itron/include/itronsys/status.h | 70 - c/src/exec/itron/include/itronsys/sysmgmt.h | 319 -- c/src/exec/itron/include/itronsys/task.h | 298 -- c/src/exec/itron/include/itronsys/time.h | 185 - c/src/exec/itron/include/itronsys/types.h | 121 - c/src/exec/itron/include/itronsys/vmempool.h | 132 - c/src/exec/itron/include/rtems/.cvsignore | 2 - c/src/exec/itron/include/rtems/itron/.cvsignore | 2 - c/src/exec/itron/include/rtems/itron/README | 10 - c/src/exec/itron/include/rtems/itron/config.h | 62 - c/src/exec/itron/include/rtems/itron/eventflags.h | 61 - c/src/exec/itron/include/rtems/itron/fmempool.h | 62 - c/src/exec/itron/include/rtems/itron/intr.h | 31 - c/src/exec/itron/include/rtems/itron/itronapi.h | 30 - c/src/exec/itron/include/rtems/itron/mbox.h | 73 - c/src/exec/itron/include/rtems/itron/msgbuffer.h | 72 - c/src/exec/itron/include/rtems/itron/network.h | 31 - c/src/exec/itron/include/rtems/itron/object.h | 120 - c/src/exec/itron/include/rtems/itron/port.h | 61 - c/src/exec/itron/include/rtems/itron/semaphore.h | 59 - c/src/exec/itron/include/rtems/itron/sysmgmt.h | 31 - c/src/exec/itron/include/rtems/itron/task.h | 102 - c/src/exec/itron/include/rtems/itron/time.h | 31 - c/src/exec/itron/include/rtems/itron/vmempool.h | 62 - c/src/exec/itron/inline/.cvsignore | 2 - c/src/exec/itron/inline/Makefile.am | 26 - c/src/exec/itron/inline/rtems/.cvsignore | 2 - c/src/exec/itron/inline/rtems/itron/.cvsignore | 2 - c/src/exec/itron/inline/rtems/itron/eventflags.inl | 151 - c/src/exec/itron/inline/rtems/itron/fmempool.inl | 158 - c/src/exec/itron/inline/rtems/itron/intr.inl | 30 - c/src/exec/itron/inline/rtems/itron/mbox.inl | 151 - c/src/exec/itron/inline/rtems/itron/msgbuffer.inl | 156 - c/src/exec/itron/inline/rtems/itron/network.inl | 30 - c/src/exec/itron/inline/rtems/itron/port.inl | 151 - c/src/exec/itron/inline/rtems/itron/semaphore.inl | 183 - c/src/exec/itron/inline/rtems/itron/sysmgmt.inl | 30 - c/src/exec/itron/inline/rtems/itron/task.inl | 181 - c/src/exec/itron/inline/rtems/itron/time.inl | 30 - c/src/exec/itron/inline/rtems/itron/vmempool.inl | 161 - c/src/exec/itron/macros/.cvsignore | 2 - c/src/exec/itron/macros/Makefile.am | 26 - c/src/exec/itron/macros/rtems/.cvsignore | 2 - c/src/exec/itron/macros/rtems/itron/.cvsignore | 2 - c/src/exec/itron/macros/rtems/itron/eventflags.inl | 76 - c/src/exec/itron/macros/rtems/itron/fmempool.inl | 78 - c/src/exec/itron/macros/rtems/itron/intr.inl | 30 - c/src/exec/itron/macros/rtems/itron/mbox.inl | 75 - c/src/exec/itron/macros/rtems/itron/msgbuffer.inl | 78 - c/src/exec/itron/macros/rtems/itron/network.inl | 30 - c/src/exec/itron/macros/rtems/itron/port.inl | 75 - c/src/exec/itron/macros/rtems/itron/semaphore.inl | 102 - c/src/exec/itron/macros/rtems/itron/sysmgmt.inl | 30 - c/src/exec/itron/macros/rtems/itron/task.inl | 102 - c/src/exec/itron/macros/rtems/itron/time.inl | 30 - c/src/exec/itron/macros/rtems/itron/vmempool.inl | 81 - c/src/exec/itron/src/.cvsignore | 6 - c/src/exec/itron/src/Makefile.am | 66 - c/src/exec/itron/src/TODO | 13 - c/src/exec/itron/src/can_wup.c | 53 - c/src/exec/itron/src/chg_pri.c | 70 - c/src/exec/itron/src/cre_mbf.c | 89 - c/src/exec/itron/src/cre_mbx.c | 107 - c/src/exec/itron/src/cre_sem.c | 98 - c/src/exec/itron/src/cre_tsk.c | 124 - c/src/exec/itron/src/del_mbf.c | 58 - c/src/exec/itron/src/del_mbx.c | 68 - c/src/exec/itron/src/del_sem.c | 68 - c/src/exec/itron/src/del_tsk.c | 59 - c/src/exec/itron/src/dis_dsp.c | 42 - c/src/exec/itron/src/ena_dsp.c | 37 - c/src/exec/itron/src/eventflags.c | 160 - c/src/exec/itron/src/exd_tsk.c | 47 - c/src/exec/itron/src/ext_tsk.c | 46 - c/src/exec/itron/src/fmempool.c | 143 - c/src/exec/itron/src/frsm_tsk.c | 62 - c/src/exec/itron/src/get_tid.c | 42 - c/src/exec/itron/src/itronintr.c | 111 - c/src/exec/itron/src/itronsem.c | 61 - c/src/exec/itron/src/itrontime.c | 248 - c/src/exec/itron/src/mbox.c | 59 - c/src/exec/itron/src/mboxtranslatereturncode.c | 48 - c/src/exec/itron/src/msgbuffer.c | 61 - .../exec/itron/src/msgbuffertranslatereturncode.c | 48 - c/src/exec/itron/src/network.c | 72 - c/src/exec/itron/src/port.c | 212 - c/src/exec/itron/src/prcv_mbf.c | 34 - c/src/exec/itron/src/prcv_mbx.c | 33 - c/src/exec/itron/src/preq_sem.c | 33 - c/src/exec/itron/src/psnd_mbf.c | 34 - c/src/exec/itron/src/rcv_mbf.c | 34 - c/src/exec/itron/src/rcv_mbx.c | 33 - c/src/exec/itron/src/ref_mbf.c | 83 - c/src/exec/itron/src/ref_mbx.c | 66 - c/src/exec/itron/src/ref_sem.c | 66 - c/src/exec/itron/src/ref_tsk.c | 103 - c/src/exec/itron/src/rel_wai.c | 55 - c/src/exec/itron/src/rot_rdq.c | 57 - c/src/exec/itron/src/rsm_tsk.c | 61 - c/src/exec/itron/src/sig_sem.c | 56 - c/src/exec/itron/src/slp_tsk.c | 35 - c/src/exec/itron/src/snd_mbf.c | 34 - c/src/exec/itron/src/snd_mbx.c | 70 - c/src/exec/itron/src/sta_tsk.c | 73 - c/src/exec/itron/src/sus_tsk.c | 69 - c/src/exec/itron/src/sysmgmt.c | 76 - c/src/exec/itron/src/task.c | 227 - c/src/exec/itron/src/ter_tsk.c | 65 - c/src/exec/itron/src/trcv_mbf.c | 84 - c/src/exec/itron/src/trcv_mbx.c | 76 - c/src/exec/itron/src/tslp_tsk.c | 38 - c/src/exec/itron/src/tsnd_mbf.c | 90 - c/src/exec/itron/src/twai_sem.c | 69 - c/src/exec/itron/src/vmempool.c | 146 - c/src/exec/itron/src/wai_sem.c | 33 - c/src/exec/itron/src/wup_tsk.c | 37 - c/src/exec/libblock/.cvsignore | 14 - c/src/exec/libblock/ChangeLog | 115 - c/src/exec/libblock/Makefile.am | 30 - c/src/exec/libblock/README | 14 - c/src/exec/libblock/configure.ac | 28 - c/src/exec/libblock/include/.cvsignore | 2 - c/src/exec/libblock/include/rtems/.cvsignore | 2 - c/src/exec/libblock/include/rtems/bdbuf.h | 275 - c/src/exec/libblock/include/rtems/blkdev.h | 147 - c/src/exec/libblock/include/rtems/diskdevs.h | 206 - c/src/exec/libblock/include/rtems/ramdisk.h | 52 - c/src/exec/libblock/src/.cvsignore | 2 - c/src/exec/libblock/src/Makefile.am | 27 - c/src/exec/libblock/src/bdbuf.c | 1648 ------ c/src/exec/libblock/src/blkdev.c | 245 - c/src/exec/libblock/src/diskdevs.c | 631 --- c/src/exec/libblock/src/ramdisk.c | 225 - c/src/exec/libcsupport/.cvsignore | 14 - c/src/exec/libcsupport/ChangeLog | 39 - c/src/exec/libcsupport/Makefile.am | 165 - c/src/exec/libcsupport/configure.ac | 34 - c/src/exec/libcsupport/include/.cvsignore | 2 - c/src/exec/libcsupport/include/chain.h | 361 -- c/src/exec/libcsupport/include/clockdrv.h | 50 - c/src/exec/libcsupport/include/console.h | 68 - c/src/exec/libcsupport/include/inttypes.h | 22 - c/src/exec/libcsupport/include/iosupp.h | 43 - c/src/exec/libcsupport/include/motorola/.cvsignore | 2 - c/src/exec/libcsupport/include/motorola/mc68230.h | 70 - c/src/exec/libcsupport/include/motorola/mc68681.h | 306 -- c/src/exec/libcsupport/include/ringbuf.h | 53 - c/src/exec/libcsupport/include/rtc.h | 38 - c/src/exec/libcsupport/include/rtems/.cvsignore | 2 - c/src/exec/libcsupport/include/rtems/assoc.h | 42 - c/src/exec/libcsupport/include/rtems/error.h | 47 - c/src/exec/libcsupport/include/rtems/libcsupport.h | 43 - c/src/exec/libcsupport/include/rtems/libio.h | 575 --- c/src/exec/libcsupport/include/rtems/libio_.h | 239 - .../exec/libcsupport/include/rtems/termiostypes.h | 177 - c/src/exec/libcsupport/include/spurious.h | 38 - c/src/exec/libcsupport/include/stdint.h | 30 - c/src/exec/libcsupport/include/sys/.cvsignore | 2 - c/src/exec/libcsupport/include/sys/cdefs.h | 177 - c/src/exec/libcsupport/include/sys/filio.h | 59 - c/src/exec/libcsupport/include/sys/ioccom.h | 95 - c/src/exec/libcsupport/include/sys/ioctl.h | 77 - c/src/exec/libcsupport/include/sys/sockio.h | 92 - c/src/exec/libcsupport/include/sys/termios.h | 198 - c/src/exec/libcsupport/include/sys/ttycom.h | 141 - c/src/exec/libcsupport/include/sys/utime.h | 25 - c/src/exec/libcsupport/include/sys/utsname.h | 56 - c/src/exec/libcsupport/include/timerdrv.h | 39 - c/src/exec/libcsupport/include/vmeintr.h | 57 - c/src/exec/libcsupport/include/zilog/.cvsignore | 2 - c/src/exec/libcsupport/include/zilog/z8036.h | 108 - c/src/exec/libcsupport/include/zilog/z8530.h | 98 - c/src/exec/libcsupport/include/zilog/z8536.h | 111 - c/src/exec/libcsupport/src/.cvsignore | 6 - c/src/exec/libcsupport/src/CASES | 23 - c/src/exec/libcsupport/src/README | 37 - c/src/exec/libcsupport/src/TODO | 14 - c/src/exec/libcsupport/src/__brk.c | 32 - c/src/exec/libcsupport/src/__getpid.c | 18 - c/src/exec/libcsupport/src/__gettod.c | 120 - c/src/exec/libcsupport/src/__sbrk.c | 32 - c/src/exec/libcsupport/src/__times.c | 89 - c/src/exec/libcsupport/src/access.c | 49 - c/src/exec/libcsupport/src/assoc.c | 254 - c/src/exec/libcsupport/src/assocnamebad.c | 41 - c/src/exec/libcsupport/src/base_fs.c | 119 - c/src/exec/libcsupport/src/cfgetispeed.c | 32 - c/src/exec/libcsupport/src/cfgetospeed.c | 32 - c/src/exec/libcsupport/src/cfsetispeed.c | 40 - c/src/exec/libcsupport/src/cfsetospeed.c | 40 - c/src/exec/libcsupport/src/chdir.c | 61 - c/src/exec/libcsupport/src/chmod.c | 56 - c/src/exec/libcsupport/src/chown.c | 49 - c/src/exec/libcsupport/src/chroot.c | 51 - c/src/exec/libcsupport/src/close.c | 58 - c/src/exec/libcsupport/src/closedir.c | 74 - c/src/exec/libcsupport/src/creat.c | 19 - c/src/exec/libcsupport/src/ctermid.c | 37 - c/src/exec/libcsupport/src/dup.c | 26 - c/src/exec/libcsupport/src/dup2.c | 52 - c/src/exec/libcsupport/src/envlock.c | 108 - c/src/exec/libcsupport/src/error.c | 213 - c/src/exec/libcsupport/src/eval.c | 81 - c/src/exec/libcsupport/src/fchdir.c | 74 - c/src/exec/libcsupport/src/fchmod.c | 49 - c/src/exec/libcsupport/src/fcntl.c | 155 - c/src/exec/libcsupport/src/fdatasync.c | 42 - c/src/exec/libcsupport/src/fpathconf.c | 87 - c/src/exec/libcsupport/src/fs_null_handlers.c | 41 - c/src/exec/libcsupport/src/fstat.c | 80 - c/src/exec/libcsupport/src/fsync.c | 45 - c/src/exec/libcsupport/src/ftruncate.c | 58 - c/src/exec/libcsupport/src/getcwd.c | 287 -- c/src/exec/libcsupport/src/getdents.c | 63 - c/src/exec/libcsupport/src/getgrent.c | 193 - c/src/exec/libcsupport/src/getpwent.c | 248 - c/src/exec/libcsupport/src/gxx_wrappers.c | 218 - c/src/exec/libcsupport/src/hosterr.c | 51 - c/src/exec/libcsupport/src/ioctl.c | 60 - c/src/exec/libcsupport/src/isatty.c | 31 - c/src/exec/libcsupport/src/libio.c | 335 -- c/src/exec/libcsupport/src/libio_sockets.c | 75 - c/src/exec/libcsupport/src/link.c | 105 - c/src/exec/libcsupport/src/lseek.c | 102 - c/src/exec/libcsupport/src/lstat.c | 18 - c/src/exec/libcsupport/src/malloc.c | 426 -- c/src/exec/libcsupport/src/mallocfreespace.c | 44 - c/src/exec/libcsupport/src/mkdir.c | 31 - c/src/exec/libcsupport/src/mkfifo.c | 28 - c/src/exec/libcsupport/src/mknod.c | 74 - c/src/exec/libcsupport/src/mount.c | 274 - c/src/exec/libcsupport/src/newlibc.c | 334 -- c/src/exec/libcsupport/src/no_libc.c | 59 - c/src/exec/libcsupport/src/no_posix.c | 105 - c/src/exec/libcsupport/src/open.c | 215 - c/src/exec/libcsupport/src/opendir.c | 89 - c/src/exec/libcsupport/src/pathconf.c | 41 - c/src/exec/libcsupport/src/pipe.c | 26 - c/src/exec/libcsupport/src/printk.c | 150 - c/src/exec/libcsupport/src/privateenv.c | 81 - c/src/exec/libcsupport/src/read.c | 71 - c/src/exec/libcsupport/src/readdir.c | 90 - c/src/exec/libcsupport/src/readlink.c | 57 - c/src/exec/libcsupport/src/rewinddir.c | 39 - c/src/exec/libcsupport/src/rmdir.c | 70 - c/src/exec/libcsupport/src/scandir.c | 168 - c/src/exec/libcsupport/src/seekdir.c | 44 - c/src/exec/libcsupport/src/stat.c | 104 - c/src/exec/libcsupport/src/symlink.c | 47 - c/src/exec/libcsupport/src/tcdrain.c | 36 - c/src/exec/libcsupport/src/tcflow.c | 34 - c/src/exec/libcsupport/src/tcflush.c | 34 - c/src/exec/libcsupport/src/tcgetattr.c | 36 - c/src/exec/libcsupport/src/tcgetprgrp.c | 34 - c/src/exec/libcsupport/src/tcsendbreak.c | 34 - c/src/exec/libcsupport/src/tcsetattr.c | 51 - c/src/exec/libcsupport/src/tcsetpgrp.c | 34 - c/src/exec/libcsupport/src/telldir.c | 47 - c/src/exec/libcsupport/src/termios.c | 1502 ------ c/src/exec/libcsupport/src/termiosinitialize.c | 54 - .../exec/libcsupport/src/termiosreserveresources.c | 37 - c/src/exec/libcsupport/src/truncate.c | 44 - c/src/exec/libcsupport/src/ttyname.c | 78 - c/src/exec/libcsupport/src/ttyname_r.c | 119 - c/src/exec/libcsupport/src/umask.c | 33 - c/src/exec/libcsupport/src/unixlibc.c | 53 - c/src/exec/libcsupport/src/unlink.c | 78 - c/src/exec/libcsupport/src/unmount.c | 221 - c/src/exec/libcsupport/src/utime.c | 46 - c/src/exec/libcsupport/src/utsname.c | 53 - c/src/exec/libcsupport/src/write.c | 78 - c/src/exec/libfs/.cvsignore | 16 - c/src/exec/libfs/ChangeLog | 359 -- c/src/exec/libfs/Makefile.am | 12 - c/src/exec/libfs/README | 13 - c/src/exec/libfs/configure.ac | 36 - c/src/exec/libfs/src/.cvsignore | 2 - c/src/exec/libfs/src/Makefile.am | 9 - c/src/exec/libfs/src/dosfs/.cvsignore | 6 - c/src/exec/libfs/src/dosfs/Makefile.am | 55 - c/src/exec/libfs/src/dosfs/dosfs.h | 31 - c/src/exec/libfs/src/dosfs/fat.c | 695 --- c/src/exec/libfs/src/dosfs/fat.h | 488 -- c/src/exec/libfs/src/dosfs/fat_fat_operations.c | 445 -- c/src/exec/libfs/src/dosfs/fat_fat_operations.h | 58 - c/src/exec/libfs/src/dosfs/fat_file.c | 978 ---- c/src/exec/libfs/src/dosfs/fat_file.h | 195 - c/src/exec/libfs/src/dosfs/msdos.h | 408 -- c/src/exec/libfs/src/dosfs/msdos_create.c | 208 - c/src/exec/libfs/src/dosfs/msdos_dir.c | 483 -- c/src/exec/libfs/src/dosfs/msdos_eval.c | 435 -- c/src/exec/libfs/src/dosfs/msdos_file.c | 485 -- c/src/exec/libfs/src/dosfs/msdos_free.c | 56 - c/src/exec/libfs/src/dosfs/msdos_fsunmount.c | 71 - c/src/exec/libfs/src/dosfs/msdos_handlers_dir.c | 36 - c/src/exec/libfs/src/dosfs/msdos_handlers_file.c | 36 - c/src/exec/libfs/src/dosfs/msdos_init.c | 60 - c/src/exec/libfs/src/dosfs/msdos_initsupp.c | 149 - c/src/exec/libfs/src/dosfs/msdos_misc.c | 1087 ---- c/src/exec/libfs/src/dosfs/msdos_mknod.c | 90 - c/src/exec/libfs/src/dosfs/msdos_node_type.c | 58 - c/src/exec/libfs/src/imfs/.cvsignore | 7 - c/src/exec/libfs/src/imfs/Makefile.am | 66 - c/src/exec/libfs/src/imfs/deviceio.c | 260 - c/src/exec/libfs/src/imfs/imfs.h | 546 -- c/src/exec/libfs/src/imfs/imfs_chown.c | 56 - c/src/exec/libfs/src/imfs/imfs_config.c | 37 - c/src/exec/libfs/src/imfs/imfs_creat.c | 137 - c/src/exec/libfs/src/imfs/imfs_debug.c | 176 - c/src/exec/libfs/src/imfs/imfs_directory.c | 353 -- c/src/exec/libfs/src/imfs/imfs_eval.c | 660 --- c/src/exec/libfs/src/imfs/imfs_fchmod.c | 78 - c/src/exec/libfs/src/imfs/imfs_fcntl.c | 28 - c/src/exec/libfs/src/imfs/imfs_fdatasync.c | 29 - c/src/exec/libfs/src/imfs/imfs_free.c | 40 - c/src/exec/libfs/src/imfs/imfs_fsunmount.c | 100 - c/src/exec/libfs/src/imfs/imfs_getchild.c | 73 - c/src/exec/libfs/src/imfs/imfs_gtkn.c | 90 - c/src/exec/libfs/src/imfs/imfs_handlers_device.c | 41 - .../exec/libfs/src/imfs/imfs_handlers_directory.c | 42 - c/src/exec/libfs/src/imfs/imfs_handlers_link.c | 41 - c/src/exec/libfs/src/imfs/imfs_handlers_memfile.c | 58 - c/src/exec/libfs/src/imfs/imfs_init.c | 71 - c/src/exec/libfs/src/imfs/imfs_initsupp.c | 88 - c/src/exec/libfs/src/imfs/imfs_link.c | 76 - c/src/exec/libfs/src/imfs/imfs_load_tar.c | 260 - c/src/exec/libfs/src/imfs/imfs_mknod.c | 78 - c/src/exec/libfs/src/imfs/imfs_mount.c | 53 - c/src/exec/libfs/src/imfs/imfs_ntype.c | 32 - c/src/exec/libfs/src/imfs/imfs_readlink.c | 44 - c/src/exec/libfs/src/imfs/imfs_rmnod.c | 82 - c/src/exec/libfs/src/imfs/imfs_stat.c | 68 - c/src/exec/libfs/src/imfs/imfs_symlink.c | 64 - c/src/exec/libfs/src/imfs/imfs_unixstub.c | 74 - c/src/exec/libfs/src/imfs/imfs_unlink.c | 78 - c/src/exec/libfs/src/imfs/imfs_unmount.c | 62 - c/src/exec/libfs/src/imfs/imfs_utime.c | 41 - c/src/exec/libfs/src/imfs/ioman.c | 110 - c/src/exec/libfs/src/imfs/linearfile.c | 116 - c/src/exec/libfs/src/imfs/memfile.c | 1137 ----- c/src/exec/libfs/src/imfs/miniimfs_init.c | 74 - c/src/exec/libfs/wrapup/.cvsignore | 13 - c/src/exec/libfs/wrapup/Makefile.am | 36 - c/src/exec/libnetworking/.cvsignore | 14 - c/src/exec/libnetworking/ChangeLog | 663 --- c/src/exec/libnetworking/Makefile.am | 27 - c/src/exec/libnetworking/README | 72 - c/src/exec/libnetworking/arpa/.cvsignore | 2 - c/src/exec/libnetworking/arpa/Makefile.am | 21 - c/src/exec/libnetworking/arpa/ftp.h | 111 - c/src/exec/libnetworking/arpa/inet.h | 105 - c/src/exec/libnetworking/arpa/nameser.h | 448 -- c/src/exec/libnetworking/arpa/nameser_compat.h | 194 - c/src/exec/libnetworking/arpa/telnet.h | 342 -- c/src/exec/libnetworking/bpfilter.h | 6 - c/src/exec/libnetworking/configure.ac | 44 - c/src/exec/libnetworking/kern/.cvsignore | 2 - c/src/exec/libnetworking/kern/Makefile.am | 35 - c/src/exec/libnetworking/kern/kern_subr.c | 206 - c/src/exec/libnetworking/kern/uipc_domain.c | 228 - c/src/exec/libnetworking/kern/uipc_mbuf.c | 748 --- c/src/exec/libnetworking/kern/uipc_socket.c | 1143 ----- c/src/exec/libnetworking/kern/uipc_socket2.c | 965 ---- c/src/exec/libnetworking/lib/.cvsignore | 2 - c/src/exec/libnetworking/lib/Makefile.am | 33 - c/src/exec/libnetworking/lib/README | 5 - c/src/exec/libnetworking/lib/ftpfs.c | 1159 ----- c/src/exec/libnetworking/lib/getprotoby.c | 46 - c/src/exec/libnetworking/lib/rtems_bsdnet_ntp.c | 187 - c/src/exec/libnetworking/lib/syslog.c | 189 - c/src/exec/libnetworking/lib/tftpDriver.c | 1049 ---- c/src/exec/libnetworking/libc/.cvsignore | 2 - c/src/exec/libnetworking/libc/Makefile.am | 57 - c/src/exec/libnetworking/libc/addr2ascii.3 | 217 - c/src/exec/libnetworking/libc/addr2ascii.c | 94 - c/src/exec/libnetworking/libc/ascii2addr.c | 74 - c/src/exec/libnetworking/libc/base64.c | 318 -- c/src/exec/libnetworking/libc/byteorder.3 | 77 - c/src/exec/libnetworking/libc/ether_addr.c | 226 - c/src/exec/libnetworking/libc/ethers.3 | 193 - c/src/exec/libnetworking/libc/gethostbydns.c | 773 --- c/src/exec/libnetworking/libc/gethostbyht.c | 202 - c/src/exec/libnetworking/libc/gethostbyname.3 | 305 -- c/src/exec/libnetworking/libc/gethostbynis.c | 142 - c/src/exec/libnetworking/libc/gethostnamadr.c | 224 - c/src/exec/libnetworking/libc/gethostname.c | 26 - c/src/exec/libnetworking/libc/getnetbydns.c | 313 -- c/src/exec/libnetworking/libc/getnetbyht.c | 173 - c/src/exec/libnetworking/libc/getnetbynis.c | 177 - c/src/exec/libnetworking/libc/getnetent.3 | 159 - c/src/exec/libnetworking/libc/getnetnamadr.c | 190 - c/src/exec/libnetworking/libc/getproto.c | 57 - c/src/exec/libnetworking/libc/getprotoent.3 | 147 - c/src/exec/libnetworking/libc/getprotoent.c | 121 - c/src/exec/libnetworking/libc/getprotoname.c | 64 - c/src/exec/libnetworking/libc/getservbyname.c | 81 - c/src/exec/libnetworking/libc/getservbyport.c | 76 - c/src/exec/libnetworking/libc/getservent.3 | 156 - c/src/exec/libnetworking/libc/getservent.c | 280 - c/src/exec/libnetworking/libc/herror.c | 122 - c/src/exec/libnetworking/libc/inet.3 | 210 - c/src/exec/libnetworking/libc/inet_addr.c | 180 - c/src/exec/libnetworking/libc/inet_lnaof.c | 61 - c/src/exec/libnetworking/libc/inet_makeaddr.c | 64 - c/src/exec/libnetworking/libc/inet_net_ntop.c | 140 - c/src/exec/libnetworking/libc/inet_net_pton.c | 207 - c/src/exec/libnetworking/libc/inet_neta.c | 84 - c/src/exec/libnetworking/libc/inet_netof.c | 60 - c/src/exec/libnetworking/libc/inet_network.c | 92 - c/src/exec/libnetworking/libc/inet_ntoa.c | 59 - c/src/exec/libnetworking/libc/inet_ntop.c | 191 - c/src/exec/libnetworking/libc/inet_pton.c | 214 - c/src/exec/libnetworking/libc/iso_addr.3 | 111 - c/src/exec/libnetworking/libc/iso_addr.c | 119 - c/src/exec/libnetworking/libc/linkaddr.3 | 138 - c/src/exec/libnetworking/libc/linkaddr.c | 161 - c/src/exec/libnetworking/libc/map_v4v6.c | 128 - c/src/exec/libnetworking/libc/ns.3 | 131 - c/src/exec/libnetworking/libc/ns_addr.c | 229 - c/src/exec/libnetworking/libc/ns_name.c | 595 --- c/src/exec/libnetworking/libc/ns_netint.c | 56 - c/src/exec/libnetworking/libc/ns_ntoa.c | 102 - c/src/exec/libnetworking/libc/ns_parse.c | 192 - c/src/exec/libnetworking/libc/ns_print.c | 745 --- c/src/exec/libnetworking/libc/ns_ttl.c | 153 - c/src/exec/libnetworking/libc/nsap_addr.c | 105 - c/src/exec/libnetworking/libc/rcmd.3 | 204 - c/src/exec/libnetworking/libc/rcmd.c | 544 -- c/src/exec/libnetworking/libc/recv.c | 52 - c/src/exec/libnetworking/libc/res_comp.c | 258 - c/src/exec/libnetworking/libc/res_config.h | 20 - c/src/exec/libnetworking/libc/res_data.c | 83 - c/src/exec/libnetworking/libc/res_debug.c | 966 ---- c/src/exec/libnetworking/libc/res_init.c | 501 -- c/src/exec/libnetworking/libc/res_mkquery.c | 199 - c/src/exec/libnetworking/libc/res_mkupdate.c | 415 -- c/src/exec/libnetworking/libc/res_query.c | 410 -- c/src/exec/libnetworking/libc/res_send.c | 929 ---- c/src/exec/libnetworking/libc/res_stubs.c | 75 - c/src/exec/libnetworking/libc/res_update.c | 518 -- c/src/exec/libnetworking/libc/resolver.3 | 352 -- c/src/exec/libnetworking/libc/send.c | 52 - c/src/exec/libnetworking/libc/strsep.c | 85 - c/src/exec/libnetworking/loop.h | 5 - c/src/exec/libnetworking/machine/.cvsignore | 2 - c/src/exec/libnetworking/machine/Makefile.am | 22 - c/src/exec/libnetworking/machine/conf.h | 6 - c/src/exec/libnetworking/machine/cpu.h | 6 - c/src/exec/libnetworking/machine/cpufunc.h | 5 - c/src/exec/libnetworking/machine/endian.h | 64 - c/src/exec/libnetworking/machine/in_cksum.h | 218 - c/src/exec/libnetworking/machine/limits.h | 6 - c/src/exec/libnetworking/machine/param.h | 92 - c/src/exec/libnetworking/machine/types.h | 37 - c/src/exec/libnetworking/machine/vmparam.h | 6 - c/src/exec/libnetworking/memory.h | 5 - c/src/exec/libnetworking/net/.cvsignore | 2 - c/src/exec/libnetworking/net/Makefile.am | 51 - c/src/exec/libnetworking/net/bpf.h | 236 - c/src/exec/libnetworking/net/bsd-comp.c | 1117 ---- c/src/exec/libnetworking/net/ethernet.h | 63 - c/src/exec/libnetworking/net/if.c | 794 --- c/src/exec/libnetworking/net/if.h | 474 -- c/src/exec/libnetworking/net/if_arp.h | 91 - c/src/exec/libnetworking/net/if_dl.h | 86 - c/src/exec/libnetworking/net/if_ethersubr.c | 997 ---- c/src/exec/libnetworking/net/if_llc.h | 145 - c/src/exec/libnetworking/net/if_loop.c | 302 -- c/src/exec/libnetworking/net/if_ppp.c | 1744 ------- c/src/exec/libnetworking/net/if_ppp.h | 134 - c/src/exec/libnetworking/net/if_pppvar.h | 140 - c/src/exec/libnetworking/net/if_types.h | 101 - c/src/exec/libnetworking/net/netisr.h | 90 - c/src/exec/libnetworking/net/ppp-comp.h | 165 - c/src/exec/libnetworking/net/ppp-deflate.c | 683 --- c/src/exec/libnetworking/net/ppp.h | 12 - c/src/exec/libnetworking/net/ppp_defs.h | 184 - c/src/exec/libnetworking/net/ppp_tty.c | 945 ---- c/src/exec/libnetworking/net/pppcompress.c | 593 --- c/src/exec/libnetworking/net/pppcompress.h | 164 - c/src/exec/libnetworking/net/radix.c | 1031 ---- c/src/exec/libnetworking/net/radix.h | 165 - c/src/exec/libnetworking/net/raw_cb.c | 148 - c/src/exec/libnetworking/net/raw_cb.h | 75 - c/src/exec/libnetworking/net/raw_usrreq.c | 315 -- c/src/exec/libnetworking/net/route.c | 959 ---- c/src/exec/libnetworking/net/route.h | 286 -- c/src/exec/libnetworking/net/rtsock.c | 829 --- c/src/exec/libnetworking/net/zlib.c | 5376 -------------------- c/src/exec/libnetworking/net/zlib.h | 1010 ---- c/src/exec/libnetworking/netdb.h | 182 - c/src/exec/libnetworking/netinet/.cvsignore | 2 - c/src/exec/libnetworking/netinet/Makefile.am | 56 - c/src/exec/libnetworking/netinet/icmp_var.h | 78 - c/src/exec/libnetworking/netinet/if_ether.c | 638 --- c/src/exec/libnetworking/netinet/if_ether.h | 209 - c/src/exec/libnetworking/netinet/igmp.c | 479 -- c/src/exec/libnetworking/netinet/igmp.h | 96 - c/src/exec/libnetworking/netinet/igmp_var.h | 111 - c/src/exec/libnetworking/netinet/in.c | 728 --- c/src/exec/libnetworking/netinet/in.h | 436 -- c/src/exec/libnetworking/netinet/in_cksum.c | 170 - c/src/exec/libnetworking/netinet/in_cksum_i386.c | 204 - c/src/exec/libnetworking/netinet/in_cksum_m68k.c | 223 - .../exec/libnetworking/netinet/in_cksum_powerpc.c | 173 - c/src/exec/libnetworking/netinet/in_pcb.c | 757 --- c/src/exec/libnetworking/netinet/in_pcb.h | 124 - c/src/exec/libnetworking/netinet/in_proto.c | 203 - c/src/exec/libnetworking/netinet/in_rmx.c | 384 -- c/src/exec/libnetworking/netinet/in_systm.h | 62 - c/src/exec/libnetworking/netinet/in_var.h | 235 - c/src/exec/libnetworking/netinet/ip.h | 191 - c/src/exec/libnetworking/netinet/ip_divert.c | 382 -- c/src/exec/libnetworking/netinet/ip_fw.c | 1069 ---- c/src/exec/libnetworking/netinet/ip_fw.h | 183 - c/src/exec/libnetworking/netinet/ip_icmp.c | 711 --- c/src/exec/libnetworking/netinet/ip_icmp.h | 190 - c/src/exec/libnetworking/netinet/ip_input.c | 1488 ------ c/src/exec/libnetworking/netinet/ip_mroute.c | 2302 --------- c/src/exec/libnetworking/netinet/ip_mroute.h | 262 - c/src/exec/libnetworking/netinet/ip_output.c | 1307 ----- c/src/exec/libnetworking/netinet/ip_var.h | 212 - c/src/exec/libnetworking/netinet/raw_ip.c | 486 -- c/src/exec/libnetworking/netinet/tcp.h | 122 - c/src/exec/libnetworking/netinet/tcp_debug.c | 172 - c/src/exec/libnetworking/netinet/tcp_debug.h | 69 - c/src/exec/libnetworking/netinet/tcp_fsm.h | 92 - c/src/exec/libnetworking/netinet/tcp_input.c | 2150 -------- c/src/exec/libnetworking/netinet/tcp_output.c | 755 --- c/src/exec/libnetworking/netinet/tcp_seq.h | 102 - c/src/exec/libnetworking/netinet/tcp_subr.c | 634 --- c/src/exec/libnetworking/netinet/tcp_timer.c | 387 -- c/src/exec/libnetworking/netinet/tcp_timer.h | 138 - c/src/exec/libnetworking/netinet/tcp_usrreq.c | 840 --- c/src/exec/libnetworking/netinet/tcp_var.h | 374 -- c/src/exec/libnetworking/netinet/tcpip.h | 75 - c/src/exec/libnetworking/netinet/udp.h | 51 - c/src/exec/libnetworking/netinet/udp_usrreq.c | 613 --- c/src/exec/libnetworking/netinet/udp_var.h | 103 - c/src/exec/libnetworking/nfs/.cvsignore | 2 - c/src/exec/libnetworking/nfs/Makefile.am | 47 - c/src/exec/libnetworking/nfs/bootp_subr.c | 1144 ----- c/src/exec/libnetworking/nfs/krpc.h | 26 - c/src/exec/libnetworking/nfs/nfs.h | 620 --- c/src/exec/libnetworking/nfs/nfsdiskless.h | 100 - c/src/exec/libnetworking/nfs/nfsproto.h | 441 -- c/src/exec/libnetworking/nfs/rpcv2.h | 142 - c/src/exec/libnetworking/nfs/xdr_subs.h | 90 - c/src/exec/libnetworking/opt_ipfw.h | 6 - c/src/exec/libnetworking/opt_mrouting.h | 6 - c/src/exec/libnetworking/opt_tcpdebug.h | 16 - c/src/exec/libnetworking/poll.h | 108 - c/src/exec/libnetworking/resolv.h | 306 -- c/src/exec/libnetworking/rtems/.cvsignore | 2 - c/src/exec/libnetworking/rtems/Makefile.am | 53 - c/src/exec/libnetworking/rtems/ftpfs.h | 34 - c/src/exec/libnetworking/rtems/issetugid.c | 11 - c/src/exec/libnetworking/rtems/mkrootfs.c | 347 -- c/src/exec/libnetworking/rtems/mkrootfs.h | 66 - c/src/exec/libnetworking/rtems/rtems_bootp.c | 31 - c/src/exec/libnetworking/rtems/rtems_bsdnet.h | 184 - .../libnetworking/rtems/rtems_bsdnet_internal.h | 197 - c/src/exec/libnetworking/rtems/rtems_glue.c | 1202 ----- c/src/exec/libnetworking/rtems/rtems_select.c | 174 - .../exec/libnetworking/rtems/rtems_showicmpstat.c | 60 - c/src/exec/libnetworking/rtems/rtems_showifstat.c | 112 - c/src/exec/libnetworking/rtems/rtems_showipstat.c | 59 - c/src/exec/libnetworking/rtems/rtems_showmbuf.c | 65 - c/src/exec/libnetworking/rtems/rtems_showroute.c | 236 - c/src/exec/libnetworking/rtems/rtems_showtcpstat.c | 102 - c/src/exec/libnetworking/rtems/rtems_showudpstat.c | 48 - c/src/exec/libnetworking/rtems/rtems_syscall.c | 763 --- c/src/exec/libnetworking/rtems/sghostname.c | 49 - c/src/exec/libnetworking/rtems/tftp.h | 43 - c/src/exec/libnetworking/sys/.cvsignore | 2 - c/src/exec/libnetworking/sys/Makefile.am | 24 - c/src/exec/libnetworking/sys/buf.h | 248 - c/src/exec/libnetworking/sys/callout.h | 57 - c/src/exec/libnetworking/sys/conf.h | 228 - c/src/exec/libnetworking/sys/domain.h | 75 - c/src/exec/libnetworking/sys/kernel.h | 251 - c/src/exec/libnetworking/sys/libkern.h | 89 - c/src/exec/libnetworking/sys/malloc.h | 355 -- c/src/exec/libnetworking/sys/mbuf.h | 440 -- c/src/exec/libnetworking/sys/mount.h | 531 -- c/src/exec/libnetworking/sys/param.h | 231 - c/src/exec/libnetworking/sys/proc.h | 8 - c/src/exec/libnetworking/sys/protosw.h | 300 -- c/src/exec/libnetworking/sys/queue.h | 446 -- c/src/exec/libnetworking/sys/reboot.h | 106 - c/src/exec/libnetworking/sys/resourcevar.h | 5 - c/src/exec/libnetworking/sys/rtprio.h | 70 - c/src/exec/libnetworking/sys/select.h | 57 - c/src/exec/libnetworking/sys/signalvar.h | 171 - c/src/exec/libnetworking/sys/socket.h | 371 -- c/src/exec/libnetworking/sys/socketvar.h | 281 - c/src/exec/libnetworking/sys/sysctl.h | 379 -- c/src/exec/libnetworking/sys/syslimits.h | 85 - c/src/exec/libnetworking/sys/syslog.h | 195 - c/src/exec/libnetworking/sys/systm.h | 198 - c/src/exec/libnetworking/sys/ttydefaults.h | 97 - c/src/exec/libnetworking/sys/ucred.h | 64 - c/src/exec/libnetworking/sys/uio.h | 92 - c/src/exec/libnetworking/sys/un.h | 68 - c/src/exec/libnetworking/syslog.h | 5 - c/src/exec/libnetworking/vm/.cvsignore | 2 - c/src/exec/libnetworking/vm/Makefile.am | 23 - c/src/exec/libnetworking/vm/vm.h | 73 - c/src/exec/libnetworking/vm/vm_extern.h | 103 - c/src/exec/libnetworking/vm/vm_kern.h | 84 - c/src/exec/libnetworking/vm/vm_param.h | 165 - c/src/exec/libnetworking/wrapup/.cvsignore | 2 - c/src/exec/libnetworking/wrapup/Makefile.am | 26 - c/src/exec/librpc/.cvsignore | 14 - c/src/exec/librpc/ChangeLog | 97 - c/src/exec/librpc/Makefile.am | 16 - c/src/exec/librpc/README_RTEMS | 64 - c/src/exec/librpc/configure.ac | 41 - c/src/exec/librpc/include/.cvsignore | 2 - c/src/exec/librpc/include/Makefile.am | 9 - c/src/exec/librpc/include/rpc/.cvsignore | 2 - c/src/exec/librpc/include/rpc/Makefile.am | 27 - c/src/exec/librpc/include/rpc/auth.h | 260 - c/src/exec/librpc/include/rpc/auth_des.h | 109 - c/src/exec/librpc/include/rpc/auth_unix.h | 84 - c/src/exec/librpc/include/rpc/clnt.h | 419 -- c/src/exec/librpc/include/rpc/des.h | 82 - c/src/exec/librpc/include/rpc/des_crypt.h | 120 - c/src/exec/librpc/include/rpc/pmap_clnt.h | 85 - c/src/exec/librpc/include/rpc/pmap_prot.h | 104 - c/src/exec/librpc/include/rpc/pmap_rmt.h | 63 - c/src/exec/librpc/include/rpc/rpc.h | 137 - c/src/exec/librpc/include/rpc/rpc_com.h | 78 - c/src/exec/librpc/include/rpc/rpc_msg.h | 196 - c/src/exec/librpc/include/rpc/svc.h | 324 -- c/src/exec/librpc/include/rpc/svc_auth.h | 56 - c/src/exec/librpc/include/rpc/types.h | 62 - c/src/exec/librpc/include/rpc/xdr.h | 314 -- c/src/exec/librpc/include/rpcsvc/.cvsignore | 2 - c/src/exec/librpc/include/rpcsvc/Makefile.am | 12 - c/src/exec/librpc/include/rpcsvc/bootparam_prot.x | 103 - c/src/exec/librpc/include/rpcsvc/crypt.x | 91 - c/src/exec/librpc/include/rpcsvc/key_prot.x | 284 -- c/src/exec/librpc/include/rpcsvc/klm_prot.x | 139 - c/src/exec/librpc/include/rpcsvc/mount.x | 257 - c/src/exec/librpc/include/rpcsvc/nfs_prot.x | 1266 ----- c/src/exec/librpc/include/rpcsvc/nis.x | 466 -- c/src/exec/librpc/include/rpcsvc/nis_cache.x | 87 - c/src/exec/librpc/include/rpcsvc/nis_callback.x | 76 - c/src/exec/librpc/include/rpcsvc/nis_db.h | 162 - c/src/exec/librpc/include/rpcsvc/nis_object.x | 317 -- c/src/exec/librpc/include/rpcsvc/nis_tags.h | 137 - c/src/exec/librpc/include/rpcsvc/nislib.h | 317 -- c/src/exec/librpc/include/rpcsvc/nlm_prot.x | 184 - c/src/exec/librpc/include/rpcsvc/pmap_prot.x | 285 -- c/src/exec/librpc/include/rpcsvc/rex.x | 235 - c/src/exec/librpc/include/rpcsvc/rnusers.x | 123 - c/src/exec/librpc/include/rpcsvc/rquota.x | 67 - c/src/exec/librpc/include/rpcsvc/rstat.x | 151 - c/src/exec/librpc/include/rpcsvc/rwall.x | 57 - c/src/exec/librpc/include/rpcsvc/sm_inter.x | 122 - c/src/exec/librpc/include/rpcsvc/spray.x | 90 - c/src/exec/librpc/include/rpcsvc/yp.x | 379 -- c/src/exec/librpc/include/rpcsvc/yp_prot.h | 329 -- c/src/exec/librpc/include/rpcsvc/ypclnt.h | 94 - c/src/exec/librpc/include/rpcsvc/yppasswd.x | 75 - c/src/exec/librpc/include/rpcsvc/ypupdate_prot.x | 88 - c/src/exec/librpc/include/rpcsvc/ypxfrd.x | 173 - c/src/exec/librpc/src/.cvsignore | 2 - c/src/exec/librpc/src/Makefile.am | 9 - c/src/exec/librpc/src/rpc/.cvsignore | 2 - c/src/exec/librpc/src/rpc/DISCLAIMER | 28 - c/src/exec/librpc/src/rpc/Makefile.am | 49 - c/src/exec/librpc/src/rpc/PSD.doc/.cvsignore | 2 - c/src/exec/librpc/src/rpc/PSD.doc/Makefile.am | 7 - c/src/exec/librpc/src/rpc/PSD.doc/nfs.rfc.ms | 1372 ----- c/src/exec/librpc/src/rpc/PSD.doc/rpc.prog.ms | 2684 ---------- c/src/exec/librpc/src/rpc/PSD.doc/rpc.rfc.ms | 1302 ----- c/src/exec/librpc/src/rpc/PSD.doc/rpcgen.ms | 1299 ----- c/src/exec/librpc/src/rpc/PSD.doc/xdr.nts.ms | 1966 ------- c/src/exec/librpc/src/rpc/PSD.doc/xdr.rfc.ms | 1058 ---- c/src/exec/librpc/src/rpc/README | 233 - c/src/exec/librpc/src/rpc/auth_des.c | 554 -- c/src/exec/librpc/src/rpc/auth_none.c | 136 - c/src/exec/librpc/src/rpc/auth_time.c | 503 -- c/src/exec/librpc/src/rpc/auth_unix.c | 349 -- c/src/exec/librpc/src/rpc/authdes_prot.c | 82 - c/src/exec/librpc/src/rpc/authunix_prot.c | 68 - c/src/exec/librpc/src/rpc/bindresvport.3 | 106 - c/src/exec/librpc/src/rpc/bindresvport.c | 147 - c/src/exec/librpc/src/rpc/clnt_generic.c | 141 - c/src/exec/librpc/src/rpc/clnt_perror.c | 254 - c/src/exec/librpc/src/rpc/clnt_raw.c | 243 - c/src/exec/librpc/src/rpc/clnt_simple.c | 123 - c/src/exec/librpc/src/rpc/clnt_tcp.c | 580 --- c/src/exec/librpc/src/rpc/clnt_udp.c | 567 --- c/src/exec/librpc/src/rpc/clnt_unix.c | 635 --- c/src/exec/librpc/src/rpc/crypt_client.c | 90 - c/src/exec/librpc/src/rpc/des_crypt.3 | 130 - c/src/exec/librpc/src/rpc/des_crypt.c | 153 - c/src/exec/librpc/src/rpc/des_soft.c | 67 - c/src/exec/librpc/src/rpc/get_myaddress.c | 112 - c/src/exec/librpc/src/rpc/getpublickey.c | 172 - c/src/exec/librpc/src/rpc/getrpcent.3 | 98 - c/src/exec/librpc/src/rpc/getrpcent.c | 303 -- c/src/exec/librpc/src/rpc/getrpcport.3 | 31 - c/src/exec/librpc/src/rpc/getrpcport.c | 63 - c/src/exec/librpc/src/rpc/key_call.c | 427 -- c/src/exec/librpc/src/rpc/key_prot_xdr.c | 166 - c/src/exec/librpc/src/rpc/netname.c | 136 - c/src/exec/librpc/src/rpc/netnamer.c | 326 -- c/src/exec/librpc/src/rpc/pmap_clnt.c | 149 - c/src/exec/librpc/src/rpc/pmap_getmaps.c | 86 - c/src/exec/librpc/src/rpc/pmap_getport.c | 91 - c/src/exec/librpc/src/rpc/pmap_prot.c | 59 - c/src/exec/librpc/src/rpc/pmap_prot2.c | 118 - c/src/exec/librpc/src/rpc/pmap_rmt.c | 415 -- c/src/exec/librpc/src/rpc/publickey.3 | 47 - c/src/exec/librpc/src/rpc/publickey.5 | 38 - c/src/exec/librpc/src/rpc/rpc.3 | 1767 ------- c/src/exec/librpc/src/rpc/rpc.5 | 35 - c/src/exec/librpc/src/rpc/rpc_callmsg.c | 193 - c/src/exec/librpc/src/rpc/rpc_commondata.c | 41 - c/src/exec/librpc/src/rpc/rpc_dtablesize.c | 61 - c/src/exec/librpc/src/rpc/rpc_prot.c | 297 -- c/src/exec/librpc/src/rpc/rpc_secure.3 | 254 - c/src/exec/librpc/src/rpc/rpcdname.c | 78 - c/src/exec/librpc/src/rpc/rstat.1 | 58 - c/src/exec/librpc/src/rpc/rstat_svc.8 | 22 - c/src/exec/librpc/src/rpc/rtems_portmapper.c | 488 -- c/src/exec/librpc/src/rpc/rtems_rpc.c | 56 - c/src/exec/librpc/src/rpc/rtime.3 | 47 - c/src/exec/librpc/src/rpc/rtime.c | 157 - c/src/exec/librpc/src/rpc/svc.c | 491 -- c/src/exec/librpc/src/rpc/svc_auth.c | 216 - c/src/exec/librpc/src/rpc/svc_auth_des.c | 531 -- c/src/exec/librpc/src/rpc/svc_auth_unix.c | 148 - c/src/exec/librpc/src/rpc/svc_raw.c | 169 - c/src/exec/librpc/src/rpc/svc_run.c | 83 - c/src/exec/librpc/src/rpc/svc_simple.c | 151 - c/src/exec/librpc/src/rpc/svc_tcp.c | 481 -- c/src/exec/librpc/src/rpc/svc_udp.c | 480 -- c/src/exec/librpc/src/rpc/svc_unix.c | 527 -- c/src/exec/librpc/src/xdr/.cvsignore | 2 - c/src/exec/librpc/src/xdr/Makefile.am | 37 - c/src/exec/librpc/src/xdr/xdr.3 | 837 --- c/src/exec/librpc/src/xdr/xdr.c | 777 --- c/src/exec/librpc/src/xdr/xdr_array.c | 157 - c/src/exec/librpc/src/xdr/xdr_float.c | 333 -- c/src/exec/librpc/src/xdr/xdr_mem.c | 242 - c/src/exec/librpc/src/xdr/xdr_rec.c | 601 --- c/src/exec/librpc/src/xdr/xdr_reference.c | 138 - c/src/exec/librpc/src/xdr/xdr_sizeof.c | 163 - c/src/exec/librpc/src/xdr/xdr_stdio.c | 189 - c/src/exec/posix/.cvsignore | 14 - c/src/exec/posix/ChangeLog | 379 -- c/src/exec/posix/Makefile.am | 10 - c/src/exec/posix/configure.ac | 58 - c/src/exec/posix/include/.cvsignore | 2 - c/src/exec/posix/include/Makefile.am | 55 - c/src/exec/posix/include/aio.h | 145 - c/src/exec/posix/include/devctl.h | 38 - c/src/exec/posix/include/intr.h | 80 - c/src/exec/posix/include/mqueue.h | 153 - c/src/exec/posix/include/rtems/.cvsignore | 2 - c/src/exec/posix/include/rtems/posix/.cvsignore | 2 - c/src/exec/posix/include/rtems/posix/cancel.h | 29 - c/src/exec/posix/include/rtems/posix/cond.h | 169 - c/src/exec/posix/include/rtems/posix/condmp.h | 161 - c/src/exec/posix/include/rtems/posix/config.h | 62 - c/src/exec/posix/include/rtems/posix/intr.h | 153 - c/src/exec/posix/include/rtems/posix/key.h | 135 - c/src/exec/posix/include/rtems/posix/mqueue.h | 249 - c/src/exec/posix/include/rtems/posix/mqueuemp.h | 160 - c/src/exec/posix/include/rtems/posix/mutex.h | 158 - c/src/exec/posix/include/rtems/posix/mutexmp.h | 173 - c/src/exec/posix/include/rtems/posix/posixapi.h | 33 - c/src/exec/posix/include/rtems/posix/priority.h | 44 - c/src/exec/posix/include/rtems/posix/psignal.h | 121 - c/src/exec/posix/include/rtems/posix/pthread.h | 150 - c/src/exec/posix/include/rtems/posix/pthreadmp.h | 160 - c/src/exec/posix/include/rtems/posix/ptimer.h | 91 - c/src/exec/posix/include/rtems/posix/semaphore.h | 181 - c/src/exec/posix/include/rtems/posix/semaphoremp.h | 160 - c/src/exec/posix/include/rtems/posix/threadsup.h | 45 - c/src/exec/posix/include/rtems/posix/time.h | 50 - c/src/exec/posix/include/rtems/posix/timer.h | 71 - c/src/exec/posix/include/sched.h | 96 - c/src/exec/posix/include/semaphore.h | 116 - c/src/exec/posix/inline/.cvsignore | 2 - c/src/exec/posix/inline/Makefile.am | 26 - c/src/exec/posix/inline/rtems/.cvsignore | 2 - c/src/exec/posix/inline/rtems/posix/.cvsignore | 2 - c/src/exec/posix/inline/rtems/posix/cond.inl | 79 - c/src/exec/posix/inline/rtems/posix/intr.inl | 71 - c/src/exec/posix/inline/rtems/posix/key.inl | 69 - c/src/exec/posix/inline/rtems/posix/mqueue.inl | 150 - c/src/exec/posix/inline/rtems/posix/mutex.inl | 110 - c/src/exec/posix/inline/rtems/posix/priority.inl | 37 - c/src/exec/posix/inline/rtems/posix/pthread.inl | 69 - c/src/exec/posix/inline/rtems/posix/semaphore.inl | 85 - c/src/exec/posix/inline/rtems/posix/timer.inl | 90 - c/src/exec/posix/macros/.cvsignore | 2 - c/src/exec/posix/macros/Makefile.am | 26 - c/src/exec/posix/macros/rtems/.cvsignore | 2 - c/src/exec/posix/macros/rtems/posix/.cvsignore | 2 - c/src/exec/posix/macros/rtems/posix/cond.inl | 66 - c/src/exec/posix/macros/rtems/posix/intr.inl | 55 - c/src/exec/posix/macros/rtems/posix/key.inl | 54 - c/src/exec/posix/macros/rtems/posix/mqueue.inl | 101 - c/src/exec/posix/macros/rtems/posix/mutex.inl | 100 - c/src/exec/posix/macros/rtems/posix/priority.inl | 25 - c/src/exec/posix/macros/rtems/posix/pthread.inl | 54 - c/src/exec/posix/macros/rtems/posix/semaphore.inl | 64 - c/src/exec/posix/macros/rtems/posix/timer.inl | 53 - c/src/exec/posix/src/.cvsignore | 6 - c/src/exec/posix/src/Makefile.am | 116 - c/src/exec/posix/src/README.mqueue | 38 - c/src/exec/posix/src/adasupp.c | 32 - c/src/exec/posix/src/aio.c | 118 - c/src/exec/posix/src/alarm.c | 56 - c/src/exec/posix/src/cancel.c | 62 - c/src/exec/posix/src/cancelrun.c | 67 - c/src/exec/posix/src/cleanuppop.c | 51 - c/src/exec/posix/src/cleanuppush.c | 51 - c/src/exec/posix/src/clockgetcpuclockid.c | 32 - c/src/exec/posix/src/clockgetenableattr.c | 32 - c/src/exec/posix/src/clockgetres.c | 55 - c/src/exec/posix/src/clockgettime.c | 69 - c/src/exec/posix/src/clocksetenableattr.c | 32 - c/src/exec/posix/src/clocksettime.c | 88 - c/src/exec/posix/src/cond.c | 52 - c/src/exec/posix/src/condattrdestroy.c | 35 - c/src/exec/posix/src/condattrgetpshared.c | 36 - c/src/exec/posix/src/condattrinit.c | 35 - c/src/exec/posix/src/condattrsetpshared.c | 43 - c/src/exec/posix/src/condbroadcast.c | 30 - c/src/exec/posix/src/conddefaultattributes.c | 28 - c/src/exec/posix/src/conddestroy.c | 80 - c/src/exec/posix/src/condinit.c | 99 - c/src/exec/posix/src/condmp.c | 46 - c/src/exec/posix/src/condsignal.c | 30 - c/src/exec/posix/src/condsignalsupp.c | 61 - c/src/exec/posix/src/condtimedwait.c | 61 - c/src/exec/posix/src/condwait.c | 36 - c/src/exec/posix/src/condwaitsupp.c | 108 - c/src/exec/posix/src/devctl.c | 26 - c/src/exec/posix/src/execl.c | 21 - c/src/exec/posix/src/execle.c | 21 - c/src/exec/posix/src/execlp.c | 21 - c/src/exec/posix/src/execv.c | 20 - c/src/exec/posix/src/execve.c | 21 - c/src/exec/posix/src/execvp.c | 20 - c/src/exec/posix/src/fork.c | 18 - c/src/exec/posix/src/getegid.c | 33 - c/src/exec/posix/src/geteuid.c | 33 - c/src/exec/posix/src/getgid.c | 47 - c/src/exec/posix/src/getgroups.c | 30 - c/src/exec/posix/src/getlogin.c | 64 - c/src/exec/posix/src/getpagesize.c | 23 - c/src/exec/posix/src/getpgrp.c | 31 - c/src/exec/posix/src/getpid.c | 45 - c/src/exec/posix/src/getppid.c | 29 - c/src/exec/posix/src/getuid.c | 47 - c/src/exec/posix/src/intr.c | 349 -- c/src/exec/posix/src/key.c | 46 - c/src/exec/posix/src/keycreate.c | 90 - c/src/exec/posix/src/keydelete.c | 58 - c/src/exec/posix/src/keygetspecific.c | 47 - c/src/exec/posix/src/keyrundestructors.c | 80 - c/src/exec/posix/src/keysetspecific.c | 47 - c/src/exec/posix/src/kill.c | 52 - c/src/exec/posix/src/killinfo.c | 336 -- c/src/exec/posix/src/mprotect.c | 23 - c/src/exec/posix/src/mqueue.c | 81 - c/src/exec/posix/src/mqueueclose.c | 79 - c/src/exec/posix/src/mqueuecreatesupp.c | 156 - c/src/exec/posix/src/mqueuedeletesupp.c | 74 - c/src/exec/posix/src/mqueuegetattr.c | 80 - c/src/exec/posix/src/mqueuenametoid.c | 66 - c/src/exec/posix/src/mqueuenotify.c | 108 - c/src/exec/posix/src/mqueueopen.c | 158 - c/src/exec/posix/src/mqueuereceive.c | 57 - c/src/exec/posix/src/mqueuerecvsupp.c | 108 - c/src/exec/posix/src/mqueuesend.c | 57 - c/src/exec/posix/src/mqueuesendsupp.c | 117 - c/src/exec/posix/src/mqueuesetattr.c | 82 - c/src/exec/posix/src/mqueuetimedreceive.c | 58 - c/src/exec/posix/src/mqueuetimedsend.c | 58 - c/src/exec/posix/src/mqueuetranslatereturncode.c | 101 - c/src/exec/posix/src/mqueueunlink.c | 84 - c/src/exec/posix/src/mutex.c | 54 - c/src/exec/posix/src/mutexattrdestroy.c | 38 - c/src/exec/posix/src/mutexattrgetprioceiling.c | 38 - c/src/exec/posix/src/mutexattrgetprotocol.c | 38 - c/src/exec/posix/src/mutexattrgetpshared.c | 38 - c/src/exec/posix/src/mutexattrinit.c | 37 - c/src/exec/posix/src/mutexattrsetprioceiling.c | 41 - c/src/exec/posix/src/mutexattrsetprotocol.c | 46 - c/src/exec/posix/src/mutexattrsetpshared.c | 46 - c/src/exec/posix/src/mutexdefaultattributes.c | 34 - c/src/exec/posix/src/mutexdestroy.c | 87 - c/src/exec/posix/src/mutexfromcorestatus.c | 52 - c/src/exec/posix/src/mutexgetprioceiling.c | 55 - c/src/exec/posix/src/mutexinit.c | 186 - c/src/exec/posix/src/mutexlock.c | 35 - c/src/exec/posix/src/mutexlocksupp.c | 67 - c/src/exec/posix/src/mutexmp.c | 66 - c/src/exec/posix/src/mutexsetprioceiling.c | 82 - c/src/exec/posix/src/mutextimedlock.c | 40 - c/src/exec/posix/src/mutextrylock.c | 35 - c/src/exec/posix/src/mutexunlock.c | 66 - c/src/exec/posix/src/nanosleep.c | 104 - c/src/exec/posix/src/pause.c | 41 - c/src/exec/posix/src/posixintervaltotimespec.c | 38 - c/src/exec/posix/src/posixtimespecsubtract.c | 50 - c/src/exec/posix/src/posixtimespectointerval.c | 42 - c/src/exec/posix/src/psignal.c | 250 - c/src/exec/posix/src/psignalchecksignal.c | 94 - c/src/exec/posix/src/psignalclearprocesssignals.c | 42 - c/src/exec/posix/src/psignalclearsignals.c | 89 - c/src/exec/posix/src/psignalsetprocesssignals.c | 42 - c/src/exec/posix/src/psignalunblockthread.c | 93 - c/src/exec/posix/src/pthread.c | 387 -- c/src/exec/posix/src/pthreadatfork.c | 31 - c/src/exec/posix/src/pthreadattrdestroy.c | 32 - c/src/exec/posix/src/pthreadattrgetdetachstate.c | 32 - c/src/exec/posix/src/pthreadattrgetinheritsched.c | 32 - c/src/exec/posix/src/pthreadattrgetschedparam.c | 31 - c/src/exec/posix/src/pthreadattrgetschedpolicy.c | 32 - c/src/exec/posix/src/pthreadattrgetscope.c | 31 - c/src/exec/posix/src/pthreadattrgetstackaddr.c | 31 - c/src/exec/posix/src/pthreadattrgetstacksize.c | 31 - c/src/exec/posix/src/pthreadattrinit.c | 33 - c/src/exec/posix/src/pthreadattrsetdetachstate.c | 38 - c/src/exec/posix/src/pthreadattrsetinheritsched.c | 41 - c/src/exec/posix/src/pthreadattrsetschedparam.c | 31 - c/src/exec/posix/src/pthreadattrsetschedpolicy.c | 43 - c/src/exec/posix/src/pthreadattrsetscope.c | 43 - c/src/exec/posix/src/pthreadattrsetstackaddr.c | 31 - c/src/exec/posix/src/pthreadattrsetstacksize.c | 37 - c/src/exec/posix/src/pthreadcreate.c | 257 - c/src/exec/posix/src/pthreaddetach.c | 48 - c/src/exec/posix/src/pthreadequal.c | 83 - c/src/exec/posix/src/pthreadexit.c | 49 - c/src/exec/posix/src/pthreadgetcpuclockid.c | 30 - c/src/exec/posix/src/pthreadgetcputime.c | 32 - c/src/exec/posix/src/pthreadgetschedparam.c | 59 - c/src/exec/posix/src/pthreadjoin.c | 72 - c/src/exec/posix/src/pthreadkill.c | 80 - c/src/exec/posix/src/pthreadonce.c | 45 - c/src/exec/posix/src/pthreadself.c | 27 - c/src/exec/posix/src/pthreadsetcputime.c | 39 - c/src/exec/posix/src/pthreadsetschedparam.c | 129 - c/src/exec/posix/src/pthreadsigmask.c | 73 - c/src/exec/posix/src/ptimer.c | 102 - c/src/exec/posix/src/ptimer1.c | 790 --- c/src/exec/posix/src/sched.c | 157 - c/src/exec/posix/src/semaphore.c | 54 - c/src/exec/posix/src/semaphorecreatesupp.c | 129 - c/src/exec/posix/src/semaphoredeletesupp.c | 65 - c/src/exec/posix/src/semaphoremp.c | 146 - c/src/exec/posix/src/semaphorenametoid.c | 52 - c/src/exec/posix/src/semaphorewaitsupp.c | 71 - c/src/exec/posix/src/semclose.c | 55 - c/src/exec/posix/src/semdestroy.c | 58 - c/src/exec/posix/src/semgetvalue.c | 50 - c/src/exec/posix/src/seminit.c | 51 - c/src/exec/posix/src/semopen.c | 124 - c/src/exec/posix/src/sempost.c | 57 - c/src/exec/posix/src/semtimedwait.c | 40 - c/src/exec/posix/src/semtrywait.c | 35 - c/src/exec/posix/src/semunlink.c | 75 - c/src/exec/posix/src/semwait.c | 35 - c/src/exec/posix/src/setcancelstate.c | 61 - c/src/exec/posix/src/setcanceltype.c | 61 - c/src/exec/posix/src/setpgid.c | 29 - c/src/exec/posix/src/setsid.c | 28 - c/src/exec/posix/src/sigaction.c | 94 - c/src/exec/posix/src/sigaddset.c | 42 - c/src/exec/posix/src/sigdelset.c | 47 - c/src/exec/posix/src/sigemptyset.c | 36 - c/src/exec/posix/src/sigfillset.c | 36 - c/src/exec/posix/src/sigismember.c | 45 - c/src/exec/posix/src/signal_2.c | 52 - c/src/exec/posix/src/sigpending.c | 40 - c/src/exec/posix/src/sigprocmask.c | 39 - c/src/exec/posix/src/sigqueue.c | 33 - c/src/exec/posix/src/sigsuspend.c | 45 - c/src/exec/posix/src/sigtimedwait.c | 140 - c/src/exec/posix/src/sigwait.c | 45 - c/src/exec/posix/src/sigwaitinfo.c | 34 - c/src/exec/posix/src/sleep.c | 31 - c/src/exec/posix/src/sysconf.c | 44 - c/src/exec/posix/src/testcancel.c | 46 - c/src/exec/posix/src/time.c | 52 - c/src/exec/posix/src/types.c | 47 - c/src/exec/posix/src/wait.c | 21 - c/src/exec/posix/src/waitpid.c | 23 - c/src/exec/rtems/.cvsignore | 2 - c/src/exec/rtems/ChangeLog | 253 - c/src/exec/rtems/Makefile.am | 9 - c/src/exec/rtems/include/.cvsignore | 2 - c/src/exec/rtems/include/Makefile.am | 47 - c/src/exec/rtems/include/rtems.h | 123 - c/src/exec/rtems/include/rtems/.cvsignore | 2 - c/src/exec/rtems/include/rtems/rtems/.cvsignore | 2 - c/src/exec/rtems/include/rtems/rtems/asr.h | 111 - c/src/exec/rtems/include/rtems/rtems/attr.h | 89 - c/src/exec/rtems/include/rtems/rtems/cache.h | 137 - c/src/exec/rtems/include/rtems/rtems/clock.h | 102 - c/src/exec/rtems/include/rtems/rtems/config.h | 53 - c/src/exec/rtems/include/rtems/rtems/dpmem.h | 156 - c/src/exec/rtems/include/rtems/rtems/event.h | 175 - c/src/exec/rtems/include/rtems/rtems/eventmp.h | 146 - c/src/exec/rtems/include/rtems/rtems/eventset.h | 88 - c/src/exec/rtems/include/rtems/rtems/intr.h | 159 - c/src/exec/rtems/include/rtems/rtems/message.h | 328 -- c/src/exec/rtems/include/rtems/rtems/modes.h | 88 - c/src/exec/rtems/include/rtems/rtems/mp.h | 52 - c/src/exec/rtems/include/rtems/rtems/msgmp.h | 176 - c/src/exec/rtems/include/rtems/rtems/options.h | 52 - c/src/exec/rtems/include/rtems/rtems/part.h | 169 - c/src/exec/rtems/include/rtems/rtems/partmp.h | 160 - c/src/exec/rtems/include/rtems/rtems/ratemon.h | 213 - c/src/exec/rtems/include/rtems/rtems/region.h | 250 - c/src/exec/rtems/include/rtems/rtems/regionmp.h | 165 - c/src/exec/rtems/include/rtems/rtems/rtemsapi.h | 35 - c/src/exec/rtems/include/rtems/rtems/sem.h | 276 - c/src/exec/rtems/include/rtems/rtems/semmp.h | 162 - c/src/exec/rtems/include/rtems/rtems/signal.h | 84 - c/src/exec/rtems/include/rtems/rtems/signalmp.h | 146 - c/src/exec/rtems/include/rtems/rtems/status.h | 83 - c/src/exec/rtems/include/rtems/rtems/support.h | 98 - c/src/exec/rtems/include/rtems/rtems/taskmp.h | 166 - c/src/exec/rtems/include/rtems/rtems/tasks.h | 467 -- c/src/exec/rtems/include/rtems/rtems/timer.h | 366 -- c/src/exec/rtems/include/rtems/rtems/types.h | 108 - c/src/exec/rtems/inline/.cvsignore | 2 - c/src/exec/rtems/inline/Makefile.am | 27 - c/src/exec/rtems/inline/rtems/.cvsignore | 2 - c/src/exec/rtems/inline/rtems/rtems/.cvsignore | 2 - c/src/exec/rtems/inline/rtems/rtems/asr.inl | 127 - c/src/exec/rtems/inline/rtems/rtems/attr.inl | 212 - c/src/exec/rtems/inline/rtems/rtems/dpmem.inl | 94 - c/src/exec/rtems/inline/rtems/rtems/event.inl | 20 - c/src/exec/rtems/inline/rtems/rtems/eventset.inl | 94 - c/src/exec/rtems/inline/rtems/rtems/message.inl | 82 - c/src/exec/rtems/inline/rtems/rtems/modes.inl | 151 - c/src/exec/rtems/inline/rtems/rtems/options.inl | 54 - c/src/exec/rtems/inline/rtems/rtems/part.inl | 198 - c/src/exec/rtems/inline/rtems/rtems/ratemon.inl | 142 - c/src/exec/rtems/inline/rtems/rtems/region.inl | 126 - c/src/exec/rtems/inline/rtems/rtems/sem.inl | 102 - c/src/exec/rtems/inline/rtems/rtems/status.inl | 55 - c/src/exec/rtems/inline/rtems/rtems/support.inl | 60 - c/src/exec/rtems/inline/rtems/rtems/tasks.inl | 89 - c/src/exec/rtems/inline/rtems/rtems/timer.inl | 141 - c/src/exec/rtems/macros/.cvsignore | 2 - c/src/exec/rtems/macros/Makefile.am | 27 - c/src/exec/rtems/macros/rtems/.cvsignore | 2 - c/src/exec/rtems/macros/rtems/rtems/.cvsignore | 2 - c/src/exec/rtems/macros/rtems/rtems/asr.inl | 89 - c/src/exec/rtems/macros/rtems/rtems/attr.inl | 119 - c/src/exec/rtems/macros/rtems/rtems/dpmem.inl | 58 - c/src/exec/rtems/macros/rtems/rtems/event.inl | 20 - c/src/exec/rtems/macros/rtems/rtems/eventset.inl | 58 - c/src/exec/rtems/macros/rtems/rtems/message.inl | 48 - c/src/exec/rtems/macros/rtems/rtems/modes.inl | 91 - c/src/exec/rtems/macros/rtems/rtems/options.inl | 38 - c/src/exec/rtems/macros/rtems/rtems/part.inl | 116 - c/src/exec/rtems/macros/rtems/rtems/ratemon.inl | 84 - c/src/exec/rtems/macros/rtems/rtems/region.inl | 74 - c/src/exec/rtems/macros/rtems/rtems/sem.inl | 62 - c/src/exec/rtems/macros/rtems/rtems/status.inl | 38 - c/src/exec/rtems/macros/rtems/rtems/support.inl | 43 - c/src/exec/rtems/macros/rtems/rtems/tasks.inl | 57 - c/src/exec/rtems/macros/rtems/rtems/timer.inl | 85 - c/src/exec/rtems/src/.cvsignore | 2 - c/src/exec/rtems/src/Makefile.am | 79 - c/src/exec/rtems/src/attr.c | 29 - c/src/exec/rtems/src/clockget.c | 89 - c/src/exec/rtems/src/clockset.c | 50 - c/src/exec/rtems/src/clocktick.c | 51 - c/src/exec/rtems/src/dpmem.c | 55 - c/src/exec/rtems/src/dpmemcreate.c | 81 - c/src/exec/rtems/src/dpmemdelete.c | 61 - c/src/exec/rtems/src/dpmemexternal2internal.c | 72 - c/src/exec/rtems/src/dpmemident.c | 55 - c/src/exec/rtems/src/dpmeminternal2external.c | 72 - c/src/exec/rtems/src/event.c | 44 - c/src/exec/rtems/src/eventmp.c | 189 - c/src/exec/rtems/src/eventreceive.c | 62 - c/src/exec/rtems/src/eventseize.c | 138 - c/src/exec/rtems/src/eventsend.c | 71 - c/src/exec/rtems/src/eventsurrender.c | 106 - c/src/exec/rtems/src/eventtimeout.c | 75 - c/src/exec/rtems/src/intr.c | 31 - c/src/exec/rtems/src/intrbody.c | 70 - c/src/exec/rtems/src/intrcatch.c | 54 - c/src/exec/rtems/src/mp.c | 41 - c/src/exec/rtems/src/msg.c | 77 - c/src/exec/rtems/src/msgmp.c | 504 -- c/src/exec/rtems/src/msgqallocate.c | 56 - c/src/exec/rtems/src/msgqbroadcast.c | 103 - c/src/exec/rtems/src/msgqcreate.c | 158 - c/src/exec/rtems/src/msgqdelete.c | 104 - c/src/exec/rtems/src/msgqflush.c | 86 - c/src/exec/rtems/src/msgqgetnumberpending.c | 83 - c/src/exec/rtems/src/msgqident.c | 67 - c/src/exec/rtems/src/msgqreceive.c | 104 - c/src/exec/rtems/src/msgqsend.c | 57 - c/src/exec/rtems/src/msgqsubmit.c | 144 - c/src/exec/rtems/src/msgqtranslatereturncode.c | 68 - c/src/exec/rtems/src/msgqurgent.c | 57 - c/src/exec/rtems/src/part.c | 67 - c/src/exec/rtems/src/partcreate.c | 115 - c/src/exec/rtems/src/partdelete.c | 87 - c/src/exec/rtems/src/partgetbuffer.c | 79 - c/src/exec/rtems/src/partident.c | 53 - c/src/exec/rtems/src/partmp.c | 301 -- c/src/exec/rtems/src/partreturnbuffer.c | 75 - c/src/exec/rtems/src/ratemon.c | 57 - c/src/exec/rtems/src/ratemoncancel.c | 64 - c/src/exec/rtems/src/ratemoncreate.c | 67 - c/src/exec/rtems/src/ratemondelete.c | 62 - c/src/exec/rtems/src/ratemongetstatus.c | 79 - c/src/exec/rtems/src/ratemonident.c | 55 - c/src/exec/rtems/src/ratemonperiod.c | 163 - c/src/exec/rtems/src/ratemontimeout.c | 81 - c/src/exec/rtems/src/region.c | 72 - c/src/exec/rtems/src/regioncreate.c | 100 - c/src/exec/rtems/src/regiondelete.c | 72 - c/src/exec/rtems/src/regionextend.c | 93 - c/src/exec/rtems/src/regiongetinfo.c | 74 - c/src/exec/rtems/src/regiongetsegment.c | 112 - c/src/exec/rtems/src/regiongetsegmentsize.c | 75 - c/src/exec/rtems/src/regionident.c | 57 - c/src/exec/rtems/src/regionmp.c | 309 -- c/src/exec/rtems/src/regionreturnsegment.c | 122 - c/src/exec/rtems/src/rtclock.c | 22 - c/src/exec/rtems/src/rtemstimer.c | 61 - c/src/exec/rtems/src/sem.c | 90 - c/src/exec/rtems/src/semcreate.c | 219 - c/src/exec/rtems/src/semdelete.c | 132 - c/src/exec/rtems/src/semflush.c | 98 - c/src/exec/rtems/src/semident.c | 77 - c/src/exec/rtems/src/semmp.c | 361 -- c/src/exec/rtems/src/semobtain.c | 121 - c/src/exec/rtems/src/semrelease.c | 115 - c/src/exec/rtems/src/semtranslatereturncode.c | 120 - c/src/exec/rtems/src/signal.c | 47 - c/src/exec/rtems/src/signalcatch.c | 65 - c/src/exec/rtems/src/signalmp.c | 188 - c/src/exec/rtems/src/signalsend.c | 87 - c/src/exec/rtems/src/taskcreate.c | 228 - c/src/exec/rtems/src/taskdelete.c | 100 - c/src/exec/rtems/src/taskgetnote.c | 105 - c/src/exec/rtems/src/taskident.c | 65 - c/src/exec/rtems/src/taskinitusers.c | 83 - c/src/exec/rtems/src/taskissuspended.c | 77 - c/src/exec/rtems/src/taskmode.c | 122 - c/src/exec/rtems/src/taskmp.c | 339 -- c/src/exec/rtems/src/taskrestart.c | 79 - c/src/exec/rtems/src/taskresume.c | 81 - c/src/exec/rtems/src/tasks.c | 286 -- c/src/exec/rtems/src/tasksetnote.c | 102 - c/src/exec/rtems/src/tasksetpriority.c | 98 - c/src/exec/rtems/src/taskstart.c | 84 - c/src/exec/rtems/src/tasksuspend.c | 82 - c/src/exec/rtems/src/taskvariableadd.c | 85 - c/src/exec/rtems/src/taskvariabledelete.c | 70 - c/src/exec/rtems/src/taskvariableget.c | 72 - c/src/exec/rtems/src/taskwakeafter.c | 64 - c/src/exec/rtems/src/taskwakewhen.c | 79 - c/src/exec/rtems/src/timercancel.c | 61 - c/src/exec/rtems/src/timercreate.c | 66 - c/src/exec/rtems/src/timerdelete.c | 62 - c/src/exec/rtems/src/timerfireafter.c | 72 - c/src/exec/rtems/src/timerfirewhen.c | 83 - c/src/exec/rtems/src/timergetinfo.c | 70 - c/src/exec/rtems/src/timerident.c | 56 - c/src/exec/rtems/src/timerreset.c | 77 - c/src/exec/rtems/src/timerserver.c | 316 -- c/src/exec/rtems/src/timerserverfireafter.c | 83 - c/src/exec/rtems/src/timerserverfirewhen.c | 91 - c/src/exec/sapi/.cvsignore | 2 - c/src/exec/sapi/ChangeLog | 161 - c/src/exec/sapi/Makefile.am | 9 - c/src/exec/sapi/include/.cvsignore | 2 - c/src/exec/sapi/include/Makefile.am | 34 - c/src/exec/sapi/include/confdefs.h | 1076 ---- c/src/exec/sapi/include/rtems/.cvsignore | 3 - c/src/exec/sapi/include/rtems/README | 133 - c/src/exec/sapi/include/rtems/config.h | 183 - c/src/exec/sapi/include/rtems/extension.h | 137 - c/src/exec/sapi/include/rtems/fatal.h | 48 - c/src/exec/sapi/include/rtems/init.h | 109 - c/src/exec/sapi/include/rtems/io.h | 272 - c/src/exec/sapi/include/rtems/mptables.h | 28 - c/src/exec/sapi/include/rtems/sptables.h.in | 85 - c/src/exec/sapi/inline/.cvsignore | 2 - c/src/exec/sapi/inline/Makefile.am | 22 - c/src/exec/sapi/inline/rtems/.cvsignore | 2 - c/src/exec/sapi/inline/rtems/extension.inl | 90 - c/src/exec/sapi/macros/.cvsignore | 2 - c/src/exec/sapi/macros/Makefile.am | 22 - c/src/exec/sapi/macros/rtems/.cvsignore | 2 - c/src/exec/sapi/macros/rtems/extension.inl | 57 - c/src/exec/sapi/src/.cvsignore | 2 - c/src/exec/sapi/src/Makefile.am | 28 - c/src/exec/sapi/src/debug.c | 61 - c/src/exec/sapi/src/exinit.c | 328 -- c/src/exec/sapi/src/extension.c | 51 - c/src/exec/sapi/src/extensioncreate.c | 65 - c/src/exec/sapi/src/extensiondelete.c | 56 - c/src/exec/sapi/src/extensionident.c | 53 - c/src/exec/sapi/src/fatal.c | 37 - c/src/exec/sapi/src/io.c | 460 -- c/src/exec/sapi/src/itronapi.c | 119 - c/src/exec/sapi/src/posixapi.c | 115 - c/src/exec/sapi/src/rtemsapi.c | 97 - c/src/exec/score/.cvsignore | 2 - c/src/exec/score/ChangeLog | 443 -- c/src/exec/score/Makefile.am | 9 - c/src/exec/score/cpu/.cvsignore | 2 - c/src/exec/score/cpu/Makefile.am | 13 - c/src/exec/score/cpu/a29k/.cvsignore | 14 - c/src/exec/score/cpu/a29k/ChangeLog | 124 - c/src/exec/score/cpu/a29k/Makefile.am | 55 - c/src/exec/score/cpu/a29k/amd.ah | 534 -- c/src/exec/score/cpu/a29k/asm.h | 101 - c/src/exec/score/cpu/a29k/configure.ac | 30 - c/src/exec/score/cpu/a29k/cpu.c | 277 - c/src/exec/score/cpu/a29k/cpu_asm.S | 522 -- c/src/exec/score/cpu/a29k/pswmacro.ah | 442 -- c/src/exec/score/cpu/a29k/register.ah | 217 - c/src/exec/score/cpu/a29k/rtems/.cvsignore | 2 - c/src/exec/score/cpu/a29k/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/a29k/rtems/score/a29k.h | 78 - c/src/exec/score/cpu/a29k/rtems/score/cpu.h | 1008 ---- c/src/exec/score/cpu/a29k/rtems/score/cpu_asm.h | 71 - c/src/exec/score/cpu/a29k/rtems/score/types.h | 56 - c/src/exec/score/cpu/a29k/sig.S | 213 - c/src/exec/score/cpu/arm/.cvsignore | 14 - c/src/exec/score/cpu/arm/ChangeLog | 153 - c/src/exec/score/cpu/arm/Makefile.am | 55 - c/src/exec/score/cpu/arm/asm.h | 125 - c/src/exec/score/cpu/arm/configure.ac | 30 - c/src/exec/score/cpu/arm/cpu.c | 243 - c/src/exec/score/cpu/arm/cpu_asm.S | 216 - c/src/exec/score/cpu/arm/rtems/.cvsignore | 2 - c/src/exec/score/cpu/arm/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/arm/rtems/score/arm.h | 62 - c/src/exec/score/cpu/arm/rtems/score/cpu.h | 962 ---- c/src/exec/score/cpu/arm/rtems/score/cpu_asm.h | 41 - c/src/exec/score/cpu/arm/rtems/score/types.h | 55 - c/src/exec/score/cpu/c4x/.cvsignore | 14 - c/src/exec/score/cpu/c4x/ChangeLog | 126 - c/src/exec/score/cpu/c4x/Makefile.am | 55 - c/src/exec/score/cpu/c4x/asm.h | 101 - c/src/exec/score/cpu/c4x/c4xio.h | 110 - c/src/exec/score/cpu/c4x/configure.ac | 30 - c/src/exec/score/cpu/c4x/cpu.c | 199 - c/src/exec/score/cpu/c4x/cpu_asm.S | 770 --- c/src/exec/score/cpu/c4x/irq.c | 82 - c/src/exec/score/cpu/c4x/rtems/.cvsignore | 2 - c/src/exec/score/cpu/c4x/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/c4x/rtems/score/c4x.h | 365 -- c/src/exec/score/cpu/c4x/rtems/score/cpu.h | 1268 ----- c/src/exec/score/cpu/c4x/rtems/score/cpu_asm.h | 70 - c/src/exec/score/cpu/c4x/rtems/score/types.h | 56 - c/src/exec/score/cpu/h8300/.cvsignore | 14 - c/src/exec/score/cpu/h8300/ChangeLog | 126 - c/src/exec/score/cpu/h8300/Makefile.am | 54 - c/src/exec/score/cpu/h8300/README | 31 - c/src/exec/score/cpu/h8300/asm.h | 123 - c/src/exec/score/cpu/h8300/configure.ac | 30 - c/src/exec/score/cpu/h8300/cpu.c | 174 - c/src/exec/score/cpu/h8300/cpu_asm.S | 225 - c/src/exec/score/cpu/h8300/rtems/.cvsignore | 2 - c/src/exec/score/cpu/h8300/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/h8300/rtems/score/cpu.h | 1187 ----- c/src/exec/score/cpu/h8300/rtems/score/h8300.h | 57 - c/src/exec/score/cpu/h8300/rtems/score/types.h | 56 - c/src/exec/score/cpu/hppa1.1/.cvsignore | 14 - c/src/exec/score/cpu/hppa1.1/ChangeLog | 121 - c/src/exec/score/cpu/hppa1.1/Makefile.am | 66 - c/src/exec/score/cpu/hppa1.1/configure.ac | 30 - c/src/exec/score/cpu/hppa1.1/cpu.c | 184 - c/src/exec/score/cpu/hppa1.1/cpu_asm.S | 805 --- c/src/exec/score/cpu/hppa1.1/rtems/.cvsignore | 2 - .../exec/score/cpu/hppa1.1/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/hppa1.1/rtems/score/cpu.h | 653 --- c/src/exec/score/cpu/hppa1.1/rtems/score/cpu_asm.h | 73 - c/src/exec/score/cpu/hppa1.1/rtems/score/hppa.h | 727 --- c/src/exec/score/cpu/hppa1.1/rtems/score/types.h | 46 - c/src/exec/score/cpu/i386/.cvsignore | 14 - c/src/exec/score/cpu/i386/ChangeLog | 135 - c/src/exec/score/cpu/i386/Makefile.am | 58 - c/src/exec/score/cpu/i386/asm.h | 138 - c/src/exec/score/cpu/i386/configure.ac | 30 - c/src/exec/score/cpu/i386/cpu.c | 198 - c/src/exec/score/cpu/i386/cpu_asm.S | 274 - c/src/exec/score/cpu/i386/rtems/.cvsignore | 2 - c/src/exec/score/cpu/i386/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/i386/rtems/score/cpu.h | 513 -- c/src/exec/score/cpu/i386/rtems/score/i386.h | 244 - c/src/exec/score/cpu/i386/rtems/score/idtr.h | 62 - c/src/exec/score/cpu/i386/rtems/score/interrupts.h | 75 - c/src/exec/score/cpu/i386/rtems/score/registers.h | 184 - c/src/exec/score/cpu/i386/rtems/score/types.h | 57 - c/src/exec/score/cpu/i960/.cvsignore | 14 - c/src/exec/score/cpu/i960/ChangeLog | 113 - c/src/exec/score/cpu/i960/Makefile.am | 54 - c/src/exec/score/cpu/i960/asm.h | 110 - c/src/exec/score/cpu/i960/configure.ac | 30 - c/src/exec/score/cpu/i960/cpu.c | 81 - c/src/exec/score/cpu/i960/cpu_asm.S | 214 - c/src/exec/score/cpu/i960/rtems/.cvsignore | 2 - c/src/exec/score/cpu/i960/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/i960/rtems/score/cpu.h | 485 -- c/src/exec/score/cpu/i960/rtems/score/i960.h | 194 - c/src/exec/score/cpu/i960/rtems/score/types.h | 57 - c/src/exec/score/cpu/m68k/.cvsignore | 14 - c/src/exec/score/cpu/m68k/ChangeLog | 145 - c/src/exec/score/cpu/m68k/Makefile.am | 54 - c/src/exec/score/cpu/m68k/asm.h | 144 - c/src/exec/score/cpu/m68k/configure.ac | 30 - c/src/exec/score/cpu/m68k/cpu.c | 213 - c/src/exec/score/cpu/m68k/cpu_asm.S | 263 - c/src/exec/score/cpu/m68k/m68302.h | 661 --- c/src/exec/score/cpu/m68k/m68360.h | 889 ---- c/src/exec/score/cpu/m68k/memcpy.c | 87 - c/src/exec/score/cpu/m68k/qsm.h | 205 - c/src/exec/score/cpu/m68k/rtems/.cvsignore | 2 - c/src/exec/score/cpu/m68k/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/m68k/rtems/score/cpu.h | 678 --- c/src/exec/score/cpu/m68k/rtems/score/m68k.h | 416 -- c/src/exec/score/cpu/m68k/rtems/score/types.h | 57 - c/src/exec/score/cpu/m68k/sim.h | 334 -- c/src/exec/score/cpu/mips/.cvsignore | 14 - c/src/exec/score/cpu/mips/ChangeLog | 355 -- c/src/exec/score/cpu/mips/Makefile.am | 54 - c/src/exec/score/cpu/mips/asm.h | 159 - c/src/exec/score/cpu/mips/configure.ac | 30 - c/src/exec/score/cpu/mips/cpu.c | 280 - c/src/exec/score/cpu/mips/cpu_asm.S | 1051 ---- c/src/exec/score/cpu/mips/idtcpu.h | 478 -- c/src/exec/score/cpu/mips/iregdef.h | 332 -- c/src/exec/score/cpu/mips/rtems/.cvsignore | 2 - c/src/exec/score/cpu/mips/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/mips/rtems/score/cpu.h | 1202 ----- c/src/exec/score/cpu/mips/rtems/score/mips.h | 272 - c/src/exec/score/cpu/mips/rtems/score/types.h | 57 - c/src/exec/score/cpu/mips64orion/.cvsignore | 14 - c/src/exec/score/cpu/mips64orion/ChangeLog | 107 - c/src/exec/score/cpu/mips64orion/Makefile.am | 54 - c/src/exec/score/cpu/mips64orion/asm.h | 100 - c/src/exec/score/cpu/mips64orion/configure.ac | 30 - c/src/exec/score/cpu/mips64orion/cpu.c | 216 - c/src/exec/score/cpu/mips64orion/cpu_asm.S | 971 ---- c/src/exec/score/cpu/mips64orion/cpu_asm.h | 115 - c/src/exec/score/cpu/mips64orion/idtcpu.h | 440 -- c/src/exec/score/cpu/mips64orion/idtmon.h | 171 - c/src/exec/score/cpu/mips64orion/iregdef.h | 325 -- c/src/exec/score/cpu/mips64orion/rtems/.cvsignore | 2 - .../score/cpu/mips64orion/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/mips64orion/rtems/score/cpu.h | 996 ---- .../cpu/mips64orion/rtems/score/mips64orion.h | 83 - .../exec/score/cpu/mips64orion/rtems/score/types.h | 72 - c/src/exec/score/cpu/no_cpu/.cvsignore | 14 - c/src/exec/score/cpu/no_cpu/ChangeLog | 105 - c/src/exec/score/cpu/no_cpu/Makefile.am | 52 - c/src/exec/score/cpu/no_cpu/asm.h | 101 - c/src/exec/score/cpu/no_cpu/configure.ac | 30 - c/src/exec/score/cpu/no_cpu/cpu.c | 185 - c/src/exec/score/cpu/no_cpu/cpu_asm.c | 183 - c/src/exec/score/cpu/no_cpu/rtems/.cvsignore | 2 - c/src/exec/score/cpu/no_cpu/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/no_cpu/rtems/score/cpu.h | 1137 ----- c/src/exec/score/cpu/no_cpu/rtems/score/cpu_asm.h | 70 - c/src/exec/score/cpu/no_cpu/rtems/score/no_cpu.h | 70 - c/src/exec/score/cpu/no_cpu/rtems/score/types.h | 56 - c/src/exec/score/cpu/or16/.cvsignore | 14 - c/src/exec/score/cpu/or16/ChangeLog | 103 - c/src/exec/score/cpu/or16/Makefile.am | 52 - c/src/exec/score/cpu/or16/asm.h | 101 - c/src/exec/score/cpu/or16/configure.ac | 30 - c/src/exec/score/cpu/or16/cpu.c | 185 - c/src/exec/score/cpu/or16/cpu_asm.c | 183 - c/src/exec/score/cpu/or16/rtems/.cvsignore | 2 - c/src/exec/score/cpu/or16/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/or16/rtems/score/cpu.h | 1137 ----- c/src/exec/score/cpu/or16/rtems/score/cpu_asm.h | 70 - c/src/exec/score/cpu/or16/rtems/score/or16.h | 70 - c/src/exec/score/cpu/or16/rtems/score/types.h | 56 - c/src/exec/score/cpu/or32/.cvsignore | 14 - c/src/exec/score/cpu/or32/ChangeLog | 107 - c/src/exec/score/cpu/or32/Makefile.am | 52 - c/src/exec/score/cpu/or32/asm.h | 101 - c/src/exec/score/cpu/or32/configure.ac | 30 - c/src/exec/score/cpu/or32/cpu.c | 185 - c/src/exec/score/cpu/or32/cpu_asm.c | 183 - c/src/exec/score/cpu/or32/rtems/.cvsignore | 2 - c/src/exec/score/cpu/or32/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/or32/rtems/score/cpu.h | 1137 ----- c/src/exec/score/cpu/or32/rtems/score/cpu_asm.h | 70 - c/src/exec/score/cpu/or32/rtems/score/or32.h | 70 - c/src/exec/score/cpu/or32/rtems/score/types.h | 56 - c/src/exec/score/cpu/powerpc/.cvsignore | 14 - c/src/exec/score/cpu/powerpc/ChangeLog | 164 - c/src/exec/score/cpu/powerpc/Makefile.am | 76 - c/src/exec/score/cpu/powerpc/asm.h | 292 -- c/src/exec/score/cpu/powerpc/configure.ac | 30 - c/src/exec/score/cpu/powerpc/rtems/.cvsignore | 2 - .../score/cpu/powerpc/rtems/new-exceptions/cpu.h | 979 ---- .../score/cpu/powerpc/rtems/old-exceptions/cpu.h | 1198 ----- .../score/cpu/powerpc/rtems/powerpc/registers.h | 307 -- .../exec/score/cpu/powerpc/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/powerpc/rtems/score/cpu.h | 19 - c/src/exec/score/cpu/powerpc/rtems/score/ppc.h | 733 --- c/src/exec/score/cpu/powerpc/rtems/score/types.h | 72 - c/src/exec/score/cpu/sh/.cvsignore | 14 - c/src/exec/score/cpu/sh/ChangeLog | 132 - c/src/exec/score/cpu/sh/Makefile.am | 52 - c/src/exec/score/cpu/sh/asm.h | 136 - c/src/exec/score/cpu/sh/configure.ac | 30 - c/src/exec/score/cpu/sh/cpu.c | 255 - c/src/exec/score/cpu/sh/rtems/.cvsignore | 2 - c/src/exec/score/cpu/sh/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/sh/rtems/score/cpu.h | 952 ---- c/src/exec/score/cpu/sh/rtems/score/sh.h | 269 - c/src/exec/score/cpu/sh/rtems/score/sh_io.h | 47 - c/src/exec/score/cpu/sh/rtems/score/types.h | 66 - c/src/exec/score/cpu/sparc/.cvsignore | 14 - c/src/exec/score/cpu/sparc/ChangeLog | 143 - c/src/exec/score/cpu/sparc/Makefile.am | 54 - c/src/exec/score/cpu/sparc/README | 110 - c/src/exec/score/cpu/sparc/asm.h | 123 - c/src/exec/score/cpu/sparc/configure.ac | 30 - c/src/exec/score/cpu/sparc/cpu.c | 331 -- c/src/exec/score/cpu/sparc/cpu_asm.S | 795 --- c/src/exec/score/cpu/sparc/rtems/.cvsignore | 2 - c/src/exec/score/cpu/sparc/rtems/score/.cvsignore | 2 - c/src/exec/score/cpu/sparc/rtems/score/cpu.h | 1000 ---- c/src/exec/score/cpu/sparc/rtems/score/sparc.h | 266 - c/src/exec/score/cpu/sparc/rtems/score/types.h | 56 - c/src/exec/score/cpu/unix/.cvsignore | 15 - c/src/exec/score/cpu/unix/ChangeLog | 134 - c/src/exec/score/cpu/unix/Makefile.am | 50 - c/src/exec/score/cpu/unix/configure.ac | 50 - c/src/exec/score/cpu/unix/cpu.c | 1137 ----- c/src/exec/score/cpu/unix/rtems/.cvsignore | 2 - c/src/exec/score/cpu/unix/rtems/score/.cvsignore | 4 - c/src/exec/score/cpu/unix/rtems/score/cpu.h | 1120 ---- c/src/exec/score/cpu/unix/rtems/score/types.h | 71 - c/src/exec/score/cpu/unix/rtems/score/unix.h | 72 - c/src/exec/score/include/.cvsignore | 2 - c/src/exec/score/include/Makefile.am | 65 - c/src/exec/score/include/rtems/.cvsignore | 2 - c/src/exec/score/include/rtems/debug.h | 97 - c/src/exec/score/include/rtems/score/.cvsignore | 8 - c/src/exec/score/include/rtems/score/address.h | 30 - c/src/exec/score/include/rtems/score/apiext.h | 101 - c/src/exec/score/include/rtems/score/apimutex.h | 154 - c/src/exec/score/include/rtems/score/bitfield.h | 97 - c/src/exec/score/include/rtems/score/chain.h | 167 - c/src/exec/score/include/rtems/score/context.h | 133 - c/src/exec/score/include/rtems/score/copyrt.h | 40 - c/src/exec/score/include/rtems/score/coremsg.h | 300 -- c/src/exec/score/include/rtems/score/coremutex.h | 225 - c/src/exec/score/include/rtems/score/coresem.h | 155 - c/src/exec/score/include/rtems/score/heap.h | 269 - c/src/exec/score/include/rtems/score/interr.h | 96 - c/src/exec/score/include/rtems/score/isr.h | 248 - c/src/exec/score/include/rtems/score/mpci.h | 411 -- c/src/exec/score/include/rtems/score/mppkt.h | 100 - c/src/exec/score/include/rtems/score/object.h | 548 -- c/src/exec/score/include/rtems/score/objectmp.h | 151 - c/src/exec/score/include/rtems/score/priority.h | 96 - c/src/exec/score/include/rtems/score/stack.h | 49 - c/src/exec/score/include/rtems/score/states.h | 83 - c/src/exec/score/include/rtems/score/sysstate.h | 66 - c/src/exec/score/include/rtems/score/thread.h | 778 --- c/src/exec/score/include/rtems/score/threadmp.h | 88 - c/src/exec/score/include/rtems/score/threadq.h | 300 -- c/src/exec/score/include/rtems/score/tod.h | 276 - c/src/exec/score/include/rtems/score/tqdata.h | 89 - c/src/exec/score/include/rtems/score/userext.h | 230 - c/src/exec/score/include/rtems/score/watchdog.h | 195 - c/src/exec/score/include/rtems/score/wkspace.h | 70 - c/src/exec/score/include/rtems/seterr.h | 22 - c/src/exec/score/include/rtems/system.h | 210 - c/src/exec/score/inline/.cvsignore | 2 - c/src/exec/score/inline/Makefile.am | 43 - c/src/exec/score/inline/rtems/.cvsignore | 2 - c/src/exec/score/inline/rtems/score/.cvsignore | 2 - c/src/exec/score/inline/rtems/score/address.inl | 125 - c/src/exec/score/inline/rtems/score/chain.inl | 389 -- c/src/exec/score/inline/rtems/score/coremsg.inl | 275 - c/src/exec/score/inline/rtems/score/coremutex.inl | 196 - c/src/exec/score/inline/rtems/score/coresem.inl | 107 - c/src/exec/score/inline/rtems/score/heap.inl | 273 - c/src/exec/score/inline/rtems/score/isr.inl | 55 - c/src/exec/score/inline/rtems/score/mppkt.inl | 57 - c/src/exec/score/inline/rtems/score/object.inl | 315 -- c/src/exec/score/inline/rtems/score/objectmp.inl | 72 - c/src/exec/score/inline/rtems/score/priority.inl | 246 - c/src/exec/score/inline/rtems/score/stack.inl | 80 - c/src/exec/score/inline/rtems/score/states.inl | 383 -- c/src/exec/score/inline/rtems/score/sysstate.inl | 153 - c/src/exec/score/inline/rtems/score/thread.inl | 427 -- c/src/exec/score/inline/rtems/score/threadmp.inl | 60 - c/src/exec/score/inline/rtems/score/tod.inl | 66 - c/src/exec/score/inline/rtems/score/tqdata.inl | 72 - c/src/exec/score/inline/rtems/score/userext.inl | 169 - c/src/exec/score/inline/rtems/score/watchdog.inl | 323 -- c/src/exec/score/inline/rtems/score/wkspace.inl | 56 - c/src/exec/score/macros/.cvsignore | 2 - c/src/exec/score/macros/Makefile.am | 43 - c/src/exec/score/macros/README | 18 - c/src/exec/score/macros/rtems/.cvsignore | 2 - c/src/exec/score/macros/rtems/score/.cvsignore | 2 - c/src/exec/score/macros/rtems/score/README | 18 - c/src/exec/score/macros/rtems/score/address.inl | 75 - c/src/exec/score/macros/rtems/score/chain.inl | 199 - c/src/exec/score/macros/rtems/score/coremsg.inl | 144 - c/src/exec/score/macros/rtems/score/coremutex.inl | 81 - c/src/exec/score/macros/rtems/score/coresem.inl | 71 - c/src/exec/score/macros/rtems/score/heap.inl | 149 - c/src/exec/score/macros/rtems/score/isr.inl | 38 - c/src/exec/score/macros/rtems/score/mppkt.inl | 40 - c/src/exec/score/macros/rtems/score/object.inl | 188 - c/src/exec/score/macros/rtems/score/objectmp.inl | 49 - c/src/exec/score/macros/rtems/score/priority.inl | 169 - c/src/exec/score/macros/rtems/score/stack.inl | 49 - c/src/exec/score/macros/rtems/score/states.inl | 209 - c/src/exec/score/macros/rtems/score/sysstate.inl | 89 - c/src/exec/score/macros/rtems/score/thread.inl | 234 - c/src/exec/score/macros/rtems/score/threadmp.inl | 49 - c/src/exec/score/macros/rtems/score/tod.inl | 48 - c/src/exec/score/macros/rtems/score/tqdata.inl | 49 - c/src/exec/score/macros/rtems/score/userext.inl | 132 - c/src/exec/score/macros/rtems/score/watchdog.inl | 171 - c/src/exec/score/macros/rtems/score/wkspace.inl | 38 - c/src/exec/score/src/.cvsignore | 2 - c/src/exec/score/src/Makefile.am | 79 - c/src/exec/score/src/Unlimited.txt | 387 -- c/src/exec/score/src/apiext.c | 104 - c/src/exec/score/src/chain.c | 201 - c/src/exec/score/src/coremsg.c | 103 - c/src/exec/score/src/coremsgbroadcast.c | 112 - c/src/exec/score/src/coremsgclose.c | 77 - c/src/exec/score/src/coremsgflush.c | 55 - c/src/exec/score/src/coremsgflushsupp.c | 105 - c/src/exec/score/src/coremsgflushwait.c | 70 - c/src/exec/score/src/coremsginsert.c | 102 - c/src/exec/score/src/coremsgseize.c | 137 - c/src/exec/score/src/coremsgsubmit.c | 175 - c/src/exec/score/src/coremutex.c | 89 - c/src/exec/score/src/coremutexflush.c | 51 - c/src/exec/score/src/coremutexseize.c | 154 - c/src/exec/score/src/coremutexsurrender.c | 142 - c/src/exec/score/src/coresem.c | 62 - c/src/exec/score/src/coresemflush.c | 57 - c/src/exec/score/src/coresemseize.c | 80 - c/src/exec/score/src/coresemsurrender.c | 74 - c/src/exec/score/src/coretod.c | 59 - c/src/exec/score/src/coretodset.c | 63 - c/src/exec/score/src/coretodtickle.c | 67 - c/src/exec/score/src/coretodtoseconds.c | 64 - c/src/exec/score/src/coretodvalidate.c | 63 - c/src/exec/score/src/heap.c | 93 - c/src/exec/score/src/heapallocate.c | 114 - c/src/exec/score/src/heapextend.c | 112 - c/src/exec/score/src/heapfree.c | 104 - c/src/exec/score/src/heapgetinfo.c | 101 - c/src/exec/score/src/heapsizeofuserarea.c | 63 - c/src/exec/score/src/heapwalk.c | 149 - c/src/exec/score/src/interr.c | 60 - c/src/exec/score/src/isr.c | 65 - c/src/exec/score/src/mpci.c | 522 -- c/src/exec/score/src/object.c | 64 - c/src/exec/score/src/objectallocate.c | 68 - c/src/exec/score/src/objectallocatebyindex.c | 73 - c/src/exec/score/src/objectclearname.c | 46 - c/src/exec/score/src/objectcomparenameraw.c | 57 - c/src/exec/score/src/objectcomparenamestring.c | 53 - c/src/exec/score/src/objectcopynameraw.c | 46 - c/src/exec/score/src/objectcopynamestring.c | 48 - c/src/exec/score/src/objectextendinformation.c | 291 -- c/src/exec/score/src/objectfree.c | 65 - c/src/exec/score/src/objectget.c | 83 - c/src/exec/score/src/objectgetbyindex.c | 73 - c/src/exec/score/src/objectgetisr.c | 89 - c/src/exec/score/src/objectgetnext.c | 90 - c/src/exec/score/src/objectgetnoprotection.c | 83 - c/src/exec/score/src/objectinitializeinformation.c | 177 - c/src/exec/score/src/objectmp.c | 274 - c/src/exec/score/src/objectnametoid.c | 95 - c/src/exec/score/src/objectshrinkinformation.c | 115 - c/src/exec/score/src/thread.c | 108 - c/src/exec/score/src/threadchangepriority.c | 113 - c/src/exec/score/src/threadclearstate.c | 81 - c/src/exec/score/src/threadclose.c | 73 - c/src/exec/score/src/threadcreateidle.c | 96 - c/src/exec/score/src/threaddelayended.c | 60 - c/src/exec/score/src/threaddispatch.c | 141 - c/src/exec/score/src/threadevaluatemode.c | 49 - c/src/exec/score/src/threadget.c | 83 - c/src/exec/score/src/threadhandler.c | 158 - c/src/exec/score/src/threadidlebody.c | 50 - c/src/exec/score/src/threadinitialize.c | 218 - c/src/exec/score/src/threadloadenv.c | 70 - c/src/exec/score/src/threadmp.c | 163 - c/src/exec/score/src/threadq.c | 65 - c/src/exec/score/src/threadqdequeue.c | 62 - c/src/exec/score/src/threadqdequeuefifo.c | 86 - c/src/exec/score/src/threadqdequeuepriority.c | 125 - c/src/exec/score/src/threadqenqueue.c | 77 - c/src/exec/score/src/threadqenqueuefifo.c | 101 - c/src/exec/score/src/threadqenqueuepriority.c | 221 - c/src/exec/score/src/threadqextract.c | 54 - c/src/exec/score/src/threadqextractfifo.c | 73 - c/src/exec/score/src/threadqextractpriority.c | 104 - c/src/exec/score/src/threadqextractwithproxy.c | 63 - c/src/exec/score/src/threadqfirst.c | 58 - c/src/exec/score/src/threadqfirstfifo.c | 47 - c/src/exec/score/src/threadqfirstpriority.c | 52 - c/src/exec/score/src/threadqflush.c | 55 - c/src/exec/score/src/threadqtimeout.c | 78 - c/src/exec/score/src/threadready.c | 74 - c/src/exec/score/src/threadreset.c | 65 - c/src/exec/score/src/threadresettimeslice.c | 71 - c/src/exec/score/src/threadrestart.c | 64 - c/src/exec/score/src/threadresume.c | 94 - c/src/exec/score/src/threadrotatequeue.c | 92 - c/src/exec/score/src/threadsetpriority.c | 52 - c/src/exec/score/src/threadsetstate.c | 83 - c/src/exec/score/src/threadsettransient.c | 73 - c/src/exec/score/src/threadstackallocate.c | 81 - c/src/exec/score/src/threadstackfree.c | 56 - c/src/exec/score/src/threadstart.c | 66 - c/src/exec/score/src/threadstartmultitasking.c | 89 - c/src/exec/score/src/threadsuspend.c | 82 - c/src/exec/score/src/threadtickletimeslice.c | 86 - c/src/exec/score/src/threadyieldprocessor.c | 72 - c/src/exec/score/src/userext.c | 203 - c/src/exec/score/src/watchdog.c | 38 - c/src/exec/score/src/watchdogadjust.c | 62 - c/src/exec/score/src/watchdoginsert.c | 96 - c/src/exec/score/src/watchdogremove.c | 70 - c/src/exec/score/src/watchdogtickle.c | 77 - c/src/exec/score/src/wkspace.c | 87 - c/src/exec/wrapup/.cvsignore | 2 - c/src/exec/wrapup/Makefile.am | 87 - 1684 files changed, 265553 deletions(-) delete mode 100644 c/src/exec/.cvsignore delete mode 100644 c/src/exec/ChangeLog delete mode 100644 c/src/exec/Makefile.am delete mode 100644 c/src/exec/configure.ac delete mode 100644 c/src/exec/include/.cvsignore delete mode 100644 c/src/exec/include/Makefile.am delete mode 100644 c/src/exec/include/rtems/bspIo.h delete mode 100644 c/src/exec/include/rtems/fs.h delete mode 100644 c/src/exec/include/rtems/libio_.h delete mode 100644 c/src/exec/include/rtems/userenv.h delete mode 100644 c/src/exec/itron/.cvsignore delete mode 100644 c/src/exec/itron/ChangeLog delete mode 100644 c/src/exec/itron/Makefile.am delete mode 100644 c/src/exec/itron/configure.ac delete mode 100644 c/src/exec/itron/include/.cvsignore delete mode 100644 c/src/exec/itron/include/Makefile.am delete mode 100644 c/src/exec/itron/include/itron.h delete mode 100644 c/src/exec/itron/include/itronsys/.cvsignore delete mode 100644 c/src/exec/itron/include/itronsys/README delete mode 100644 c/src/exec/itron/include/itronsys/eventflags.h delete mode 100644 c/src/exec/itron/include/itronsys/fmempool.h delete mode 100644 c/src/exec/itron/include/itronsys/intr.h delete mode 100644 c/src/exec/itron/include/itronsys/mbox.h delete mode 100644 c/src/exec/itron/include/itronsys/msgbuffer.h delete mode 100644 c/src/exec/itron/include/itronsys/network.h delete mode 100644 c/src/exec/itron/include/itronsys/port.h delete mode 100644 c/src/exec/itron/include/itronsys/semaphore.h delete mode 100644 c/src/exec/itron/include/itronsys/status.h delete mode 100644 c/src/exec/itron/include/itronsys/sysmgmt.h delete mode 100644 c/src/exec/itron/include/itronsys/task.h delete mode 100644 c/src/exec/itron/include/itronsys/time.h delete mode 100644 c/src/exec/itron/include/itronsys/types.h delete mode 100644 c/src/exec/itron/include/itronsys/vmempool.h delete mode 100644 c/src/exec/itron/include/rtems/.cvsignore delete mode 100644 c/src/exec/itron/include/rtems/itron/.cvsignore delete mode 100644 c/src/exec/itron/include/rtems/itron/README delete mode 100644 c/src/exec/itron/include/rtems/itron/config.h delete mode 100644 c/src/exec/itron/include/rtems/itron/eventflags.h delete mode 100644 c/src/exec/itron/include/rtems/itron/fmempool.h delete mode 100644 c/src/exec/itron/include/rtems/itron/intr.h delete mode 100644 c/src/exec/itron/include/rtems/itron/itronapi.h delete mode 100644 c/src/exec/itron/include/rtems/itron/mbox.h delete mode 100644 c/src/exec/itron/include/rtems/itron/msgbuffer.h delete mode 100644 c/src/exec/itron/include/rtems/itron/network.h delete mode 100644 c/src/exec/itron/include/rtems/itron/object.h delete mode 100644 c/src/exec/itron/include/rtems/itron/port.h delete mode 100644 c/src/exec/itron/include/rtems/itron/semaphore.h delete mode 100644 c/src/exec/itron/include/rtems/itron/sysmgmt.h delete mode 100644 c/src/exec/itron/include/rtems/itron/task.h delete mode 100644 c/src/exec/itron/include/rtems/itron/time.h delete mode 100644 c/src/exec/itron/include/rtems/itron/vmempool.h delete mode 100644 c/src/exec/itron/inline/.cvsignore delete mode 100644 c/src/exec/itron/inline/Makefile.am delete mode 100644 c/src/exec/itron/inline/rtems/.cvsignore delete mode 100644 c/src/exec/itron/inline/rtems/itron/.cvsignore delete mode 100644 c/src/exec/itron/inline/rtems/itron/eventflags.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/fmempool.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/intr.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/mbox.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/msgbuffer.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/network.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/port.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/semaphore.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/sysmgmt.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/task.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/time.inl delete mode 100644 c/src/exec/itron/inline/rtems/itron/vmempool.inl delete mode 100644 c/src/exec/itron/macros/.cvsignore delete mode 100644 c/src/exec/itron/macros/Makefile.am delete mode 100644 c/src/exec/itron/macros/rtems/.cvsignore delete mode 100644 c/src/exec/itron/macros/rtems/itron/.cvsignore delete mode 100644 c/src/exec/itron/macros/rtems/itron/eventflags.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/fmempool.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/intr.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/mbox.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/msgbuffer.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/network.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/port.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/semaphore.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/sysmgmt.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/task.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/time.inl delete mode 100644 c/src/exec/itron/macros/rtems/itron/vmempool.inl delete mode 100644 c/src/exec/itron/src/.cvsignore delete mode 100644 c/src/exec/itron/src/Makefile.am delete mode 100644 c/src/exec/itron/src/TODO delete mode 100644 c/src/exec/itron/src/can_wup.c delete mode 100644 c/src/exec/itron/src/chg_pri.c delete mode 100644 c/src/exec/itron/src/cre_mbf.c delete mode 100644 c/src/exec/itron/src/cre_mbx.c delete mode 100644 c/src/exec/itron/src/cre_sem.c delete mode 100644 c/src/exec/itron/src/cre_tsk.c delete mode 100644 c/src/exec/itron/src/del_mbf.c delete mode 100644 c/src/exec/itron/src/del_mbx.c delete mode 100644 c/src/exec/itron/src/del_sem.c delete mode 100644 c/src/exec/itron/src/del_tsk.c delete mode 100644 c/src/exec/itron/src/dis_dsp.c delete mode 100644 c/src/exec/itron/src/ena_dsp.c delete mode 100644 c/src/exec/itron/src/eventflags.c delete mode 100644 c/src/exec/itron/src/exd_tsk.c delete mode 100644 c/src/exec/itron/src/ext_tsk.c delete mode 100644 c/src/exec/itron/src/fmempool.c delete mode 100644 c/src/exec/itron/src/frsm_tsk.c delete mode 100644 c/src/exec/itron/src/get_tid.c delete mode 100644 c/src/exec/itron/src/itronintr.c delete mode 100644 c/src/exec/itron/src/itronsem.c delete mode 100644 c/src/exec/itron/src/itrontime.c delete mode 100644 c/src/exec/itron/src/mbox.c delete mode 100644 c/src/exec/itron/src/mboxtranslatereturncode.c delete mode 100644 c/src/exec/itron/src/msgbuffer.c delete mode 100644 c/src/exec/itron/src/msgbuffertranslatereturncode.c delete mode 100644 c/src/exec/itron/src/network.c delete mode 100644 c/src/exec/itron/src/port.c delete mode 100644 c/src/exec/itron/src/prcv_mbf.c delete mode 100644 c/src/exec/itron/src/prcv_mbx.c delete mode 100644 c/src/exec/itron/src/preq_sem.c delete mode 100644 c/src/exec/itron/src/psnd_mbf.c delete mode 100644 c/src/exec/itron/src/rcv_mbf.c delete mode 100644 c/src/exec/itron/src/rcv_mbx.c delete mode 100644 c/src/exec/itron/src/ref_mbf.c delete mode 100644 c/src/exec/itron/src/ref_mbx.c delete mode 100644 c/src/exec/itron/src/ref_sem.c delete mode 100644 c/src/exec/itron/src/ref_tsk.c delete mode 100644 c/src/exec/itron/src/rel_wai.c delete mode 100644 c/src/exec/itron/src/rot_rdq.c delete mode 100644 c/src/exec/itron/src/rsm_tsk.c delete mode 100644 c/src/exec/itron/src/sig_sem.c delete mode 100644 c/src/exec/itron/src/slp_tsk.c delete mode 100644 c/src/exec/itron/src/snd_mbf.c delete mode 100644 c/src/exec/itron/src/snd_mbx.c delete mode 100644 c/src/exec/itron/src/sta_tsk.c delete mode 100644 c/src/exec/itron/src/sus_tsk.c delete mode 100644 c/src/exec/itron/src/sysmgmt.c delete mode 100644 c/src/exec/itron/src/task.c delete mode 100644 c/src/exec/itron/src/ter_tsk.c delete mode 100644 c/src/exec/itron/src/trcv_mbf.c delete mode 100644 c/src/exec/itron/src/trcv_mbx.c delete mode 100644 c/src/exec/itron/src/tslp_tsk.c delete mode 100644 c/src/exec/itron/src/tsnd_mbf.c delete mode 100644 c/src/exec/itron/src/twai_sem.c delete mode 100644 c/src/exec/itron/src/vmempool.c delete mode 100644 c/src/exec/itron/src/wai_sem.c delete mode 100644 c/src/exec/itron/src/wup_tsk.c delete mode 100644 c/src/exec/libblock/.cvsignore delete mode 100644 c/src/exec/libblock/ChangeLog delete mode 100644 c/src/exec/libblock/Makefile.am delete mode 100644 c/src/exec/libblock/README delete mode 100644 c/src/exec/libblock/configure.ac delete mode 100644 c/src/exec/libblock/include/.cvsignore delete mode 100644 c/src/exec/libblock/include/rtems/.cvsignore delete mode 100644 c/src/exec/libblock/include/rtems/bdbuf.h delete mode 100644 c/src/exec/libblock/include/rtems/blkdev.h delete mode 100644 c/src/exec/libblock/include/rtems/diskdevs.h delete mode 100644 c/src/exec/libblock/include/rtems/ramdisk.h delete mode 100644 c/src/exec/libblock/src/.cvsignore delete mode 100644 c/src/exec/libblock/src/Makefile.am delete mode 100644 c/src/exec/libblock/src/bdbuf.c delete mode 100644 c/src/exec/libblock/src/blkdev.c delete mode 100644 c/src/exec/libblock/src/diskdevs.c delete mode 100644 c/src/exec/libblock/src/ramdisk.c delete mode 100644 c/src/exec/libcsupport/.cvsignore delete mode 100755 c/src/exec/libcsupport/ChangeLog delete mode 100644 c/src/exec/libcsupport/Makefile.am delete mode 100644 c/src/exec/libcsupport/configure.ac delete mode 100644 c/src/exec/libcsupport/include/.cvsignore delete mode 100644 c/src/exec/libcsupport/include/chain.h delete mode 100644 c/src/exec/libcsupport/include/clockdrv.h delete mode 100644 c/src/exec/libcsupport/include/console.h delete mode 100644 c/src/exec/libcsupport/include/inttypes.h delete mode 100644 c/src/exec/libcsupport/include/iosupp.h delete mode 100644 c/src/exec/libcsupport/include/motorola/.cvsignore delete mode 100644 c/src/exec/libcsupport/include/motorola/mc68230.h delete mode 100644 c/src/exec/libcsupport/include/motorola/mc68681.h delete mode 100644 c/src/exec/libcsupport/include/ringbuf.h delete mode 100644 c/src/exec/libcsupport/include/rtc.h delete mode 100644 c/src/exec/libcsupport/include/rtems/.cvsignore delete mode 100644 c/src/exec/libcsupport/include/rtems/assoc.h delete mode 100644 c/src/exec/libcsupport/include/rtems/error.h delete mode 100644 c/src/exec/libcsupport/include/rtems/libcsupport.h delete mode 100644 c/src/exec/libcsupport/include/rtems/libio.h delete mode 100644 c/src/exec/libcsupport/include/rtems/libio_.h delete mode 100644 c/src/exec/libcsupport/include/rtems/termiostypes.h delete mode 100644 c/src/exec/libcsupport/include/spurious.h delete mode 100644 c/src/exec/libcsupport/include/stdint.h delete mode 100644 c/src/exec/libcsupport/include/sys/.cvsignore delete mode 100644 c/src/exec/libcsupport/include/sys/cdefs.h delete mode 100644 c/src/exec/libcsupport/include/sys/filio.h delete mode 100644 c/src/exec/libcsupport/include/sys/ioccom.h delete mode 100644 c/src/exec/libcsupport/include/sys/ioctl.h delete mode 100644 c/src/exec/libcsupport/include/sys/sockio.h delete mode 100644 c/src/exec/libcsupport/include/sys/termios.h delete mode 100644 c/src/exec/libcsupport/include/sys/ttycom.h delete mode 100644 c/src/exec/libcsupport/include/sys/utime.h delete mode 100644 c/src/exec/libcsupport/include/sys/utsname.h delete mode 100644 c/src/exec/libcsupport/include/timerdrv.h delete mode 100644 c/src/exec/libcsupport/include/vmeintr.h delete mode 100644 c/src/exec/libcsupport/include/zilog/.cvsignore delete mode 100644 c/src/exec/libcsupport/include/zilog/z8036.h delete mode 100644 c/src/exec/libcsupport/include/zilog/z8530.h delete mode 100644 c/src/exec/libcsupport/include/zilog/z8536.h delete mode 100644 c/src/exec/libcsupport/src/.cvsignore delete mode 100644 c/src/exec/libcsupport/src/CASES delete mode 100644 c/src/exec/libcsupport/src/README delete mode 100644 c/src/exec/libcsupport/src/TODO delete mode 100644 c/src/exec/libcsupport/src/__brk.c delete mode 100644 c/src/exec/libcsupport/src/__getpid.c delete mode 100644 c/src/exec/libcsupport/src/__gettod.c delete mode 100644 c/src/exec/libcsupport/src/__sbrk.c delete mode 100644 c/src/exec/libcsupport/src/__times.c delete mode 100644 c/src/exec/libcsupport/src/access.c delete mode 100644 c/src/exec/libcsupport/src/assoc.c delete mode 100644 c/src/exec/libcsupport/src/assocnamebad.c delete mode 100644 c/src/exec/libcsupport/src/base_fs.c delete mode 100644 c/src/exec/libcsupport/src/cfgetispeed.c delete mode 100644 c/src/exec/libcsupport/src/cfgetospeed.c delete mode 100644 c/src/exec/libcsupport/src/cfsetispeed.c delete mode 100644 c/src/exec/libcsupport/src/cfsetospeed.c delete mode 100644 c/src/exec/libcsupport/src/chdir.c delete mode 100644 c/src/exec/libcsupport/src/chmod.c delete mode 100644 c/src/exec/libcsupport/src/chown.c delete mode 100644 c/src/exec/libcsupport/src/chroot.c delete mode 100644 c/src/exec/libcsupport/src/close.c delete mode 100644 c/src/exec/libcsupport/src/closedir.c delete mode 100644 c/src/exec/libcsupport/src/creat.c delete mode 100644 c/src/exec/libcsupport/src/ctermid.c delete mode 100644 c/src/exec/libcsupport/src/dup.c delete mode 100644 c/src/exec/libcsupport/src/dup2.c delete mode 100644 c/src/exec/libcsupport/src/envlock.c delete mode 100644 c/src/exec/libcsupport/src/error.c delete mode 100644 c/src/exec/libcsupport/src/eval.c delete mode 100644 c/src/exec/libcsupport/src/fchdir.c delete mode 100644 c/src/exec/libcsupport/src/fchmod.c delete mode 100644 c/src/exec/libcsupport/src/fcntl.c delete mode 100644 c/src/exec/libcsupport/src/fdatasync.c delete mode 100644 c/src/exec/libcsupport/src/fpathconf.c delete mode 100644 c/src/exec/libcsupport/src/fs_null_handlers.c delete mode 100644 c/src/exec/libcsupport/src/fstat.c delete mode 100644 c/src/exec/libcsupport/src/fsync.c delete mode 100644 c/src/exec/libcsupport/src/ftruncate.c delete mode 100644 c/src/exec/libcsupport/src/getcwd.c delete mode 100644 c/src/exec/libcsupport/src/getdents.c delete mode 100644 c/src/exec/libcsupport/src/getgrent.c delete mode 100644 c/src/exec/libcsupport/src/getpwent.c delete mode 100644 c/src/exec/libcsupport/src/gxx_wrappers.c delete mode 100644 c/src/exec/libcsupport/src/hosterr.c delete mode 100644 c/src/exec/libcsupport/src/ioctl.c delete mode 100644 c/src/exec/libcsupport/src/isatty.c delete mode 100644 c/src/exec/libcsupport/src/libio.c delete mode 100644 c/src/exec/libcsupport/src/libio_sockets.c delete mode 100644 c/src/exec/libcsupport/src/link.c delete mode 100644 c/src/exec/libcsupport/src/lseek.c delete mode 100644 c/src/exec/libcsupport/src/lstat.c delete mode 100644 c/src/exec/libcsupport/src/malloc.c delete mode 100644 c/src/exec/libcsupport/src/mallocfreespace.c delete mode 100644 c/src/exec/libcsupport/src/mkdir.c delete mode 100644 c/src/exec/libcsupport/src/mkfifo.c delete mode 100644 c/src/exec/libcsupport/src/mknod.c delete mode 100644 c/src/exec/libcsupport/src/mount.c delete mode 100644 c/src/exec/libcsupport/src/newlibc.c delete mode 100644 c/src/exec/libcsupport/src/no_libc.c delete mode 100644 c/src/exec/libcsupport/src/no_posix.c delete mode 100644 c/src/exec/libcsupport/src/open.c delete mode 100644 c/src/exec/libcsupport/src/opendir.c delete mode 100644 c/src/exec/libcsupport/src/pathconf.c delete mode 100644 c/src/exec/libcsupport/src/pipe.c delete mode 100644 c/src/exec/libcsupport/src/printk.c delete mode 100644 c/src/exec/libcsupport/src/privateenv.c delete mode 100644 c/src/exec/libcsupport/src/read.c delete mode 100644 c/src/exec/libcsupport/src/readdir.c delete mode 100644 c/src/exec/libcsupport/src/readlink.c delete mode 100644 c/src/exec/libcsupport/src/rewinddir.c delete mode 100644 c/src/exec/libcsupport/src/rmdir.c delete mode 100644 c/src/exec/libcsupport/src/scandir.c delete mode 100644 c/src/exec/libcsupport/src/seekdir.c delete mode 100644 c/src/exec/libcsupport/src/stat.c delete mode 100644 c/src/exec/libcsupport/src/symlink.c delete mode 100644 c/src/exec/libcsupport/src/tcdrain.c delete mode 100644 c/src/exec/libcsupport/src/tcflow.c delete mode 100644 c/src/exec/libcsupport/src/tcflush.c delete mode 100644 c/src/exec/libcsupport/src/tcgetattr.c delete mode 100644 c/src/exec/libcsupport/src/tcgetprgrp.c delete mode 100644 c/src/exec/libcsupport/src/tcsendbreak.c delete mode 100644 c/src/exec/libcsupport/src/tcsetattr.c delete mode 100644 c/src/exec/libcsupport/src/tcsetpgrp.c delete mode 100644 c/src/exec/libcsupport/src/telldir.c delete mode 100644 c/src/exec/libcsupport/src/termios.c delete mode 100644 c/src/exec/libcsupport/src/termiosinitialize.c delete mode 100644 c/src/exec/libcsupport/src/termiosreserveresources.c delete mode 100644 c/src/exec/libcsupport/src/truncate.c delete mode 100644 c/src/exec/libcsupport/src/ttyname.c delete mode 100644 c/src/exec/libcsupport/src/ttyname_r.c delete mode 100644 c/src/exec/libcsupport/src/umask.c delete mode 100644 c/src/exec/libcsupport/src/unixlibc.c delete mode 100644 c/src/exec/libcsupport/src/unlink.c delete mode 100644 c/src/exec/libcsupport/src/unmount.c delete mode 100644 c/src/exec/libcsupport/src/utime.c delete mode 100644 c/src/exec/libcsupport/src/utsname.c delete mode 100644 c/src/exec/libcsupport/src/write.c delete mode 100644 c/src/exec/libfs/.cvsignore delete mode 100644 c/src/exec/libfs/ChangeLog delete mode 100644 c/src/exec/libfs/Makefile.am delete mode 100644 c/src/exec/libfs/README delete mode 100644 c/src/exec/libfs/configure.ac delete mode 100644 c/src/exec/libfs/src/.cvsignore delete mode 100644 c/src/exec/libfs/src/Makefile.am delete mode 100644 c/src/exec/libfs/src/dosfs/.cvsignore delete mode 100644 c/src/exec/libfs/src/dosfs/Makefile.am delete mode 100644 c/src/exec/libfs/src/dosfs/dosfs.h delete mode 100644 c/src/exec/libfs/src/dosfs/fat.c delete mode 100644 c/src/exec/libfs/src/dosfs/fat.h delete mode 100644 c/src/exec/libfs/src/dosfs/fat_fat_operations.c delete mode 100644 c/src/exec/libfs/src/dosfs/fat_fat_operations.h delete mode 100644 c/src/exec/libfs/src/dosfs/fat_file.c delete mode 100644 c/src/exec/libfs/src/dosfs/fat_file.h delete mode 100644 c/src/exec/libfs/src/dosfs/msdos.h delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_create.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_dir.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_eval.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_file.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_free.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_fsunmount.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_handlers_dir.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_handlers_file.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_init.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_initsupp.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_misc.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_mknod.c delete mode 100644 c/src/exec/libfs/src/dosfs/msdos_node_type.c delete mode 100644 c/src/exec/libfs/src/imfs/.cvsignore delete mode 100644 c/src/exec/libfs/src/imfs/Makefile.am delete mode 100644 c/src/exec/libfs/src/imfs/deviceio.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs.h delete mode 100644 c/src/exec/libfs/src/imfs/imfs_chown.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_config.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_creat.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_debug.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_directory.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_eval.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_fchmod.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_fcntl.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_fdatasync.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_free.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_fsunmount.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_getchild.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_gtkn.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_handlers_device.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_handlers_directory.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_handlers_link.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_handlers_memfile.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_init.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_initsupp.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_link.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_load_tar.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_mknod.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_mount.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_ntype.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_readlink.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_rmnod.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_stat.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_symlink.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_unixstub.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_unlink.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_unmount.c delete mode 100644 c/src/exec/libfs/src/imfs/imfs_utime.c delete mode 100644 c/src/exec/libfs/src/imfs/ioman.c delete mode 100644 c/src/exec/libfs/src/imfs/linearfile.c delete mode 100644 c/src/exec/libfs/src/imfs/memfile.c delete mode 100644 c/src/exec/libfs/src/imfs/miniimfs_init.c delete mode 100644 c/src/exec/libfs/wrapup/.cvsignore delete mode 100644 c/src/exec/libfs/wrapup/Makefile.am delete mode 100644 c/src/exec/libnetworking/.cvsignore delete mode 100644 c/src/exec/libnetworking/ChangeLog delete mode 100644 c/src/exec/libnetworking/Makefile.am delete mode 100644 c/src/exec/libnetworking/README delete mode 100644 c/src/exec/libnetworking/arpa/.cvsignore delete mode 100644 c/src/exec/libnetworking/arpa/Makefile.am delete mode 100644 c/src/exec/libnetworking/arpa/ftp.h delete mode 100644 c/src/exec/libnetworking/arpa/inet.h delete mode 100644 c/src/exec/libnetworking/arpa/nameser.h delete mode 100644 c/src/exec/libnetworking/arpa/nameser_compat.h delete mode 100644 c/src/exec/libnetworking/arpa/telnet.h delete mode 100644 c/src/exec/libnetworking/bpfilter.h delete mode 100644 c/src/exec/libnetworking/configure.ac delete mode 100644 c/src/exec/libnetworking/kern/.cvsignore delete mode 100644 c/src/exec/libnetworking/kern/Makefile.am delete mode 100644 c/src/exec/libnetworking/kern/kern_subr.c delete mode 100644 c/src/exec/libnetworking/kern/uipc_domain.c delete mode 100644 c/src/exec/libnetworking/kern/uipc_mbuf.c delete mode 100644 c/src/exec/libnetworking/kern/uipc_socket.c delete mode 100644 c/src/exec/libnetworking/kern/uipc_socket2.c delete mode 100644 c/src/exec/libnetworking/lib/.cvsignore delete mode 100644 c/src/exec/libnetworking/lib/Makefile.am delete mode 100644 c/src/exec/libnetworking/lib/README delete mode 100644 c/src/exec/libnetworking/lib/ftpfs.c delete mode 100644 c/src/exec/libnetworking/lib/getprotoby.c delete mode 100644 c/src/exec/libnetworking/lib/rtems_bsdnet_ntp.c delete mode 100644 c/src/exec/libnetworking/lib/syslog.c delete mode 100644 c/src/exec/libnetworking/lib/tftpDriver.c delete mode 100644 c/src/exec/libnetworking/libc/.cvsignore delete mode 100644 c/src/exec/libnetworking/libc/Makefile.am delete mode 100644 c/src/exec/libnetworking/libc/addr2ascii.3 delete mode 100644 c/src/exec/libnetworking/libc/addr2ascii.c delete mode 100644 c/src/exec/libnetworking/libc/ascii2addr.c delete mode 100644 c/src/exec/libnetworking/libc/base64.c delete mode 100644 c/src/exec/libnetworking/libc/byteorder.3 delete mode 100644 c/src/exec/libnetworking/libc/ether_addr.c delete mode 100644 c/src/exec/libnetworking/libc/ethers.3 delete mode 100644 c/src/exec/libnetworking/libc/gethostbydns.c delete mode 100644 c/src/exec/libnetworking/libc/gethostbyht.c delete mode 100644 c/src/exec/libnetworking/libc/gethostbyname.3 delete mode 100644 c/src/exec/libnetworking/libc/gethostbynis.c delete mode 100644 c/src/exec/libnetworking/libc/gethostnamadr.c delete mode 100644 c/src/exec/libnetworking/libc/gethostname.c delete mode 100644 c/src/exec/libnetworking/libc/getnetbydns.c delete mode 100644 c/src/exec/libnetworking/libc/getnetbyht.c delete mode 100644 c/src/exec/libnetworking/libc/getnetbynis.c delete mode 100644 c/src/exec/libnetworking/libc/getnetent.3 delete mode 100644 c/src/exec/libnetworking/libc/getnetnamadr.c delete mode 100644 c/src/exec/libnetworking/libc/getproto.c delete mode 100644 c/src/exec/libnetworking/libc/getprotoent.3 delete mode 100644 c/src/exec/libnetworking/libc/getprotoent.c delete mode 100644 c/src/exec/libnetworking/libc/getprotoname.c delete mode 100644 c/src/exec/libnetworking/libc/getservbyname.c delete mode 100644 c/src/exec/libnetworking/libc/getservbyport.c delete mode 100644 c/src/exec/libnetworking/libc/getservent.3 delete mode 100644 c/src/exec/libnetworking/libc/getservent.c delete mode 100644 c/src/exec/libnetworking/libc/herror.c delete mode 100644 c/src/exec/libnetworking/libc/inet.3 delete mode 100644 c/src/exec/libnetworking/libc/inet_addr.c delete mode 100644 c/src/exec/libnetworking/libc/inet_lnaof.c delete mode 100644 c/src/exec/libnetworking/libc/inet_makeaddr.c delete mode 100644 c/src/exec/libnetworking/libc/inet_net_ntop.c delete mode 100644 c/src/exec/libnetworking/libc/inet_net_pton.c delete mode 100644 c/src/exec/libnetworking/libc/inet_neta.c delete mode 100644 c/src/exec/libnetworking/libc/inet_netof.c delete mode 100644 c/src/exec/libnetworking/libc/inet_network.c delete mode 100644 c/src/exec/libnetworking/libc/inet_ntoa.c delete mode 100644 c/src/exec/libnetworking/libc/inet_ntop.c delete mode 100644 c/src/exec/libnetworking/libc/inet_pton.c delete mode 100644 c/src/exec/libnetworking/libc/iso_addr.3 delete mode 100644 c/src/exec/libnetworking/libc/iso_addr.c delete mode 100644 c/src/exec/libnetworking/libc/linkaddr.3 delete mode 100644 c/src/exec/libnetworking/libc/linkaddr.c delete mode 100644 c/src/exec/libnetworking/libc/map_v4v6.c delete mode 100644 c/src/exec/libnetworking/libc/ns.3 delete mode 100644 c/src/exec/libnetworking/libc/ns_addr.c delete mode 100644 c/src/exec/libnetworking/libc/ns_name.c delete mode 100644 c/src/exec/libnetworking/libc/ns_netint.c delete mode 100644 c/src/exec/libnetworking/libc/ns_ntoa.c delete mode 100644 c/src/exec/libnetworking/libc/ns_parse.c delete mode 100644 c/src/exec/libnetworking/libc/ns_print.c delete mode 100644 c/src/exec/libnetworking/libc/ns_ttl.c delete mode 100644 c/src/exec/libnetworking/libc/nsap_addr.c delete mode 100644 c/src/exec/libnetworking/libc/rcmd.3 delete mode 100644 c/src/exec/libnetworking/libc/rcmd.c delete mode 100644 c/src/exec/libnetworking/libc/recv.c delete mode 100644 c/src/exec/libnetworking/libc/res_comp.c delete mode 100644 c/src/exec/libnetworking/libc/res_config.h delete mode 100644 c/src/exec/libnetworking/libc/res_data.c delete mode 100644 c/src/exec/libnetworking/libc/res_debug.c delete mode 100644 c/src/exec/libnetworking/libc/res_init.c delete mode 100644 c/src/exec/libnetworking/libc/res_mkquery.c delete mode 100644 c/src/exec/libnetworking/libc/res_mkupdate.c delete mode 100644 c/src/exec/libnetworking/libc/res_query.c delete mode 100644 c/src/exec/libnetworking/libc/res_send.c delete mode 100644 c/src/exec/libnetworking/libc/res_stubs.c delete mode 100644 c/src/exec/libnetworking/libc/res_update.c delete mode 100644 c/src/exec/libnetworking/libc/resolver.3 delete mode 100644 c/src/exec/libnetworking/libc/send.c delete mode 100644 c/src/exec/libnetworking/libc/strsep.c delete mode 100644 c/src/exec/libnetworking/loop.h delete mode 100644 c/src/exec/libnetworking/machine/.cvsignore delete mode 100644 c/src/exec/libnetworking/machine/Makefile.am delete mode 100644 c/src/exec/libnetworking/machine/conf.h delete mode 100644 c/src/exec/libnetworking/machine/cpu.h delete mode 100644 c/src/exec/libnetworking/machine/cpufunc.h delete mode 100644 c/src/exec/libnetworking/machine/endian.h delete mode 100644 c/src/exec/libnetworking/machine/in_cksum.h delete mode 100644 c/src/exec/libnetworking/machine/limits.h delete mode 100644 c/src/exec/libnetworking/machine/param.h delete mode 100644 c/src/exec/libnetworking/machine/types.h delete mode 100644 c/src/exec/libnetworking/machine/vmparam.h delete mode 100644 c/src/exec/libnetworking/memory.h delete mode 100644 c/src/exec/libnetworking/net/.cvsignore delete mode 100644 c/src/exec/libnetworking/net/Makefile.am delete mode 100644 c/src/exec/libnetworking/net/bpf.h delete mode 100644 c/src/exec/libnetworking/net/bsd-comp.c delete mode 100644 c/src/exec/libnetworking/net/ethernet.h delete mode 100644 c/src/exec/libnetworking/net/if.c delete mode 100644 c/src/exec/libnetworking/net/if.h delete mode 100644 c/src/exec/libnetworking/net/if_arp.h delete mode 100644 c/src/exec/libnetworking/net/if_dl.h delete mode 100644 c/src/exec/libnetworking/net/if_ethersubr.c delete mode 100644 c/src/exec/libnetworking/net/if_llc.h delete mode 100644 c/src/exec/libnetworking/net/if_loop.c delete mode 100644 c/src/exec/libnetworking/net/if_ppp.c delete mode 100644 c/src/exec/libnetworking/net/if_ppp.h delete mode 100644 c/src/exec/libnetworking/net/if_pppvar.h delete mode 100644 c/src/exec/libnetworking/net/if_types.h delete mode 100644 c/src/exec/libnetworking/net/netisr.h delete mode 100644 c/src/exec/libnetworking/net/ppp-comp.h delete mode 100644 c/src/exec/libnetworking/net/ppp-deflate.c delete mode 100644 c/src/exec/libnetworking/net/ppp.h delete mode 100644 c/src/exec/libnetworking/net/ppp_defs.h delete mode 100644 c/src/exec/libnetworking/net/ppp_tty.c delete mode 100644 c/src/exec/libnetworking/net/pppcompress.c delete mode 100644 c/src/exec/libnetworking/net/pppcompress.h delete mode 100644 c/src/exec/libnetworking/net/radix.c delete mode 100644 c/src/exec/libnetworking/net/radix.h delete mode 100644 c/src/exec/libnetworking/net/raw_cb.c delete mode 100644 c/src/exec/libnetworking/net/raw_cb.h delete mode 100644 c/src/exec/libnetworking/net/raw_usrreq.c delete mode 100644 c/src/exec/libnetworking/net/route.c delete mode 100644 c/src/exec/libnetworking/net/route.h delete mode 100644 c/src/exec/libnetworking/net/rtsock.c delete mode 100644 c/src/exec/libnetworking/net/zlib.c delete mode 100644 c/src/exec/libnetworking/net/zlib.h delete mode 100644 c/src/exec/libnetworking/netdb.h delete mode 100644 c/src/exec/libnetworking/netinet/.cvsignore delete mode 100644 c/src/exec/libnetworking/netinet/Makefile.am delete mode 100644 c/src/exec/libnetworking/netinet/icmp_var.h delete mode 100644 c/src/exec/libnetworking/netinet/if_ether.c delete mode 100644 c/src/exec/libnetworking/netinet/if_ether.h delete mode 100644 c/src/exec/libnetworking/netinet/igmp.c delete mode 100644 c/src/exec/libnetworking/netinet/igmp.h delete mode 100644 c/src/exec/libnetworking/netinet/igmp_var.h delete mode 100644 c/src/exec/libnetworking/netinet/in.c delete mode 100644 c/src/exec/libnetworking/netinet/in.h delete mode 100644 c/src/exec/libnetworking/netinet/in_cksum.c delete mode 100644 c/src/exec/libnetworking/netinet/in_cksum_i386.c delete mode 100644 c/src/exec/libnetworking/netinet/in_cksum_m68k.c delete mode 100644 c/src/exec/libnetworking/netinet/in_cksum_powerpc.c delete mode 100644 c/src/exec/libnetworking/netinet/in_pcb.c delete mode 100644 c/src/exec/libnetworking/netinet/in_pcb.h delete mode 100644 c/src/exec/libnetworking/netinet/in_proto.c delete mode 100644 c/src/exec/libnetworking/netinet/in_rmx.c delete mode 100644 c/src/exec/libnetworking/netinet/in_systm.h delete mode 100644 c/src/exec/libnetworking/netinet/in_var.h delete mode 100644 c/src/exec/libnetworking/netinet/ip.h delete mode 100644 c/src/exec/libnetworking/netinet/ip_divert.c delete mode 100644 c/src/exec/libnetworking/netinet/ip_fw.c delete mode 100644 c/src/exec/libnetworking/netinet/ip_fw.h delete mode 100644 c/src/exec/libnetworking/netinet/ip_icmp.c delete mode 100644 c/src/exec/libnetworking/netinet/ip_icmp.h delete mode 100644 c/src/exec/libnetworking/netinet/ip_input.c delete mode 100644 c/src/exec/libnetworking/netinet/ip_mroute.c delete mode 100644 c/src/exec/libnetworking/netinet/ip_mroute.h delete mode 100644 c/src/exec/libnetworking/netinet/ip_output.c delete mode 100644 c/src/exec/libnetworking/netinet/ip_var.h delete mode 100644 c/src/exec/libnetworking/netinet/raw_ip.c delete mode 100644 c/src/exec/libnetworking/netinet/tcp.h delete mode 100644 c/src/exec/libnetworking/netinet/tcp_debug.c delete mode 100644 c/src/exec/libnetworking/netinet/tcp_debug.h delete mode 100644 c/src/exec/libnetworking/netinet/tcp_fsm.h delete mode 100644 c/src/exec/libnetworking/netinet/tcp_input.c delete mode 100644 c/src/exec/libnetworking/netinet/tcp_output.c delete mode 100644 c/src/exec/libnetworking/netinet/tcp_seq.h delete mode 100644 c/src/exec/libnetworking/netinet/tcp_subr.c delete mode 100644 c/src/exec/libnetworking/netinet/tcp_timer.c delete mode 100644 c/src/exec/libnetworking/netinet/tcp_timer.h delete mode 100644 c/src/exec/libnetworking/netinet/tcp_usrreq.c delete mode 100644 c/src/exec/libnetworking/netinet/tcp_var.h delete mode 100644 c/src/exec/libnetworking/netinet/tcpip.h delete mode 100644 c/src/exec/libnetworking/netinet/udp.h delete mode 100644 c/src/exec/libnetworking/netinet/udp_usrreq.c delete mode 100644 c/src/exec/libnetworking/netinet/udp_var.h delete mode 100644 c/src/exec/libnetworking/nfs/.cvsignore delete mode 100644 c/src/exec/libnetworking/nfs/Makefile.am delete mode 100644 c/src/exec/libnetworking/nfs/bootp_subr.c delete mode 100644 c/src/exec/libnetworking/nfs/krpc.h delete mode 100644 c/src/exec/libnetworking/nfs/nfs.h delete mode 100644 c/src/exec/libnetworking/nfs/nfsdiskless.h delete mode 100644 c/src/exec/libnetworking/nfs/nfsproto.h delete mode 100644 c/src/exec/libnetworking/nfs/rpcv2.h delete mode 100644 c/src/exec/libnetworking/nfs/xdr_subs.h delete mode 100644 c/src/exec/libnetworking/opt_ipfw.h delete mode 100644 c/src/exec/libnetworking/opt_mrouting.h delete mode 100644 c/src/exec/libnetworking/opt_tcpdebug.h delete mode 100644 c/src/exec/libnetworking/poll.h delete mode 100644 c/src/exec/libnetworking/resolv.h delete mode 100644 c/src/exec/libnetworking/rtems/.cvsignore delete mode 100644 c/src/exec/libnetworking/rtems/Makefile.am delete mode 100644 c/src/exec/libnetworking/rtems/ftpfs.h delete mode 100644 c/src/exec/libnetworking/rtems/issetugid.c delete mode 100644 c/src/exec/libnetworking/rtems/mkrootfs.c delete mode 100644 c/src/exec/libnetworking/rtems/mkrootfs.h delete mode 100644 c/src/exec/libnetworking/rtems/rtems_bootp.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_bsdnet.h delete mode 100644 c/src/exec/libnetworking/rtems/rtems_bsdnet_internal.h delete mode 100644 c/src/exec/libnetworking/rtems/rtems_glue.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_select.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_showicmpstat.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_showifstat.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_showipstat.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_showmbuf.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_showroute.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_showtcpstat.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_showudpstat.c delete mode 100644 c/src/exec/libnetworking/rtems/rtems_syscall.c delete mode 100644 c/src/exec/libnetworking/rtems/sghostname.c delete mode 100644 c/src/exec/libnetworking/rtems/tftp.h delete mode 100644 c/src/exec/libnetworking/sys/.cvsignore delete mode 100644 c/src/exec/libnetworking/sys/Makefile.am delete mode 100644 c/src/exec/libnetworking/sys/buf.h delete mode 100644 c/src/exec/libnetworking/sys/callout.h delete mode 100644 c/src/exec/libnetworking/sys/conf.h delete mode 100644 c/src/exec/libnetworking/sys/domain.h delete mode 100644 c/src/exec/libnetworking/sys/kernel.h delete mode 100644 c/src/exec/libnetworking/sys/libkern.h delete mode 100644 c/src/exec/libnetworking/sys/malloc.h delete mode 100644 c/src/exec/libnetworking/sys/mbuf.h delete mode 100644 c/src/exec/libnetworking/sys/mount.h delete mode 100644 c/src/exec/libnetworking/sys/param.h delete mode 100644 c/src/exec/libnetworking/sys/proc.h delete mode 100644 c/src/exec/libnetworking/sys/protosw.h delete mode 100644 c/src/exec/libnetworking/sys/queue.h delete mode 100644 c/src/exec/libnetworking/sys/reboot.h delete mode 100644 c/src/exec/libnetworking/sys/resourcevar.h delete mode 100644 c/src/exec/libnetworking/sys/rtprio.h delete mode 100644 c/src/exec/libnetworking/sys/select.h delete mode 100644 c/src/exec/libnetworking/sys/signalvar.h delete mode 100644 c/src/exec/libnetworking/sys/socket.h delete mode 100644 c/src/exec/libnetworking/sys/socketvar.h delete mode 100644 c/src/exec/libnetworking/sys/sysctl.h delete mode 100644 c/src/exec/libnetworking/sys/syslimits.h delete mode 100644 c/src/exec/libnetworking/sys/syslog.h delete mode 100644 c/src/exec/libnetworking/sys/systm.h delete mode 100644 c/src/exec/libnetworking/sys/ttydefaults.h delete mode 100644 c/src/exec/libnetworking/sys/ucred.h delete mode 100644 c/src/exec/libnetworking/sys/uio.h delete mode 100644 c/src/exec/libnetworking/sys/un.h delete mode 100644 c/src/exec/libnetworking/syslog.h delete mode 100644 c/src/exec/libnetworking/vm/.cvsignore delete mode 100644 c/src/exec/libnetworking/vm/Makefile.am delete mode 100644 c/src/exec/libnetworking/vm/vm.h delete mode 100644 c/src/exec/libnetworking/vm/vm_extern.h delete mode 100644 c/src/exec/libnetworking/vm/vm_kern.h delete mode 100644 c/src/exec/libnetworking/vm/vm_param.h delete mode 100644 c/src/exec/libnetworking/wrapup/.cvsignore delete mode 100644 c/src/exec/libnetworking/wrapup/Makefile.am delete mode 100644 c/src/exec/librpc/.cvsignore delete mode 100644 c/src/exec/librpc/ChangeLog delete mode 100644 c/src/exec/librpc/Makefile.am delete mode 100644 c/src/exec/librpc/README_RTEMS delete mode 100644 c/src/exec/librpc/configure.ac delete mode 100644 c/src/exec/librpc/include/.cvsignore delete mode 100644 c/src/exec/librpc/include/Makefile.am delete mode 100644 c/src/exec/librpc/include/rpc/.cvsignore delete mode 100644 c/src/exec/librpc/include/rpc/Makefile.am delete mode 100644 c/src/exec/librpc/include/rpc/auth.h delete mode 100644 c/src/exec/librpc/include/rpc/auth_des.h delete mode 100644 c/src/exec/librpc/include/rpc/auth_unix.h delete mode 100644 c/src/exec/librpc/include/rpc/clnt.h delete mode 100644 c/src/exec/librpc/include/rpc/des.h delete mode 100644 c/src/exec/librpc/include/rpc/des_crypt.h delete mode 100644 c/src/exec/librpc/include/rpc/pmap_clnt.h delete mode 100644 c/src/exec/librpc/include/rpc/pmap_prot.h delete mode 100644 c/src/exec/librpc/include/rpc/pmap_rmt.h delete mode 100644 c/src/exec/librpc/include/rpc/rpc.h delete mode 100644 c/src/exec/librpc/include/rpc/rpc_com.h delete mode 100644 c/src/exec/librpc/include/rpc/rpc_msg.h delete mode 100644 c/src/exec/librpc/include/rpc/svc.h delete mode 100644 c/src/exec/librpc/include/rpc/svc_auth.h delete mode 100644 c/src/exec/librpc/include/rpc/types.h delete mode 100644 c/src/exec/librpc/include/rpc/xdr.h delete mode 100644 c/src/exec/librpc/include/rpcsvc/.cvsignore delete mode 100644 c/src/exec/librpc/include/rpcsvc/Makefile.am delete mode 100644 c/src/exec/librpc/include/rpcsvc/bootparam_prot.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/crypt.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/key_prot.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/klm_prot.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/mount.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/nfs_prot.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/nis.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/nis_cache.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/nis_callback.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/nis_db.h delete mode 100644 c/src/exec/librpc/include/rpcsvc/nis_object.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/nis_tags.h delete mode 100644 c/src/exec/librpc/include/rpcsvc/nislib.h delete mode 100644 c/src/exec/librpc/include/rpcsvc/nlm_prot.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/pmap_prot.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/rex.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/rnusers.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/rquota.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/rstat.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/rwall.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/sm_inter.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/spray.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/yp.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/yp_prot.h delete mode 100644 c/src/exec/librpc/include/rpcsvc/ypclnt.h delete mode 100644 c/src/exec/librpc/include/rpcsvc/yppasswd.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/ypupdate_prot.x delete mode 100644 c/src/exec/librpc/include/rpcsvc/ypxfrd.x delete mode 100644 c/src/exec/librpc/src/.cvsignore delete mode 100644 c/src/exec/librpc/src/Makefile.am delete mode 100644 c/src/exec/librpc/src/rpc/.cvsignore delete mode 100644 c/src/exec/librpc/src/rpc/DISCLAIMER delete mode 100644 c/src/exec/librpc/src/rpc/Makefile.am delete mode 100644 c/src/exec/librpc/src/rpc/PSD.doc/.cvsignore delete mode 100644 c/src/exec/librpc/src/rpc/PSD.doc/Makefile.am delete mode 100644 c/src/exec/librpc/src/rpc/PSD.doc/nfs.rfc.ms delete mode 100644 c/src/exec/librpc/src/rpc/PSD.doc/rpc.prog.ms delete mode 100644 c/src/exec/librpc/src/rpc/PSD.doc/rpc.rfc.ms delete mode 100644 c/src/exec/librpc/src/rpc/PSD.doc/rpcgen.ms delete mode 100644 c/src/exec/librpc/src/rpc/PSD.doc/xdr.nts.ms delete mode 100644 c/src/exec/librpc/src/rpc/PSD.doc/xdr.rfc.ms delete mode 100644 c/src/exec/librpc/src/rpc/README delete mode 100644 c/src/exec/librpc/src/rpc/auth_des.c delete mode 100644 c/src/exec/librpc/src/rpc/auth_none.c delete mode 100644 c/src/exec/librpc/src/rpc/auth_time.c delete mode 100644 c/src/exec/librpc/src/rpc/auth_unix.c delete mode 100644 c/src/exec/librpc/src/rpc/authdes_prot.c delete mode 100644 c/src/exec/librpc/src/rpc/authunix_prot.c delete mode 100644 c/src/exec/librpc/src/rpc/bindresvport.3 delete mode 100644 c/src/exec/librpc/src/rpc/bindresvport.c delete mode 100644 c/src/exec/librpc/src/rpc/clnt_generic.c delete mode 100644 c/src/exec/librpc/src/rpc/clnt_perror.c delete mode 100644 c/src/exec/librpc/src/rpc/clnt_raw.c delete mode 100644 c/src/exec/librpc/src/rpc/clnt_simple.c delete mode 100644 c/src/exec/librpc/src/rpc/clnt_tcp.c delete mode 100644 c/src/exec/librpc/src/rpc/clnt_udp.c delete mode 100644 c/src/exec/librpc/src/rpc/clnt_unix.c delete mode 100644 c/src/exec/librpc/src/rpc/crypt_client.c delete mode 100644 c/src/exec/librpc/src/rpc/des_crypt.3 delete mode 100644 c/src/exec/librpc/src/rpc/des_crypt.c delete mode 100644 c/src/exec/librpc/src/rpc/des_soft.c delete mode 100644 c/src/exec/librpc/src/rpc/get_myaddress.c delete mode 100644 c/src/exec/librpc/src/rpc/getpublickey.c delete mode 100644 c/src/exec/librpc/src/rpc/getrpcent.3 delete mode 100644 c/src/exec/librpc/src/rpc/getrpcent.c delete mode 100644 c/src/exec/librpc/src/rpc/getrpcport.3 delete mode 100644 c/src/exec/librpc/src/rpc/getrpcport.c delete mode 100644 c/src/exec/librpc/src/rpc/key_call.c delete mode 100644 c/src/exec/librpc/src/rpc/key_prot_xdr.c delete mode 100644 c/src/exec/librpc/src/rpc/netname.c delete mode 100644 c/src/exec/librpc/src/rpc/netnamer.c delete mode 100644 c/src/exec/librpc/src/rpc/pmap_clnt.c delete mode 100644 c/src/exec/librpc/src/rpc/pmap_getmaps.c delete mode 100644 c/src/exec/librpc/src/rpc/pmap_getport.c delete mode 100644 c/src/exec/librpc/src/rpc/pmap_prot.c delete mode 100644 c/src/exec/librpc/src/rpc/pmap_prot2.c delete mode 100644 c/src/exec/librpc/src/rpc/pmap_rmt.c delete mode 100644 c/src/exec/librpc/src/rpc/publickey.3 delete mode 100644 c/src/exec/librpc/src/rpc/publickey.5 delete mode 100644 c/src/exec/librpc/src/rpc/rpc.3 delete mode 100644 c/src/exec/librpc/src/rpc/rpc.5 delete mode 100644 c/src/exec/librpc/src/rpc/rpc_callmsg.c delete mode 100644 c/src/exec/librpc/src/rpc/rpc_commondata.c delete mode 100644 c/src/exec/librpc/src/rpc/rpc_dtablesize.c delete mode 100644 c/src/exec/librpc/src/rpc/rpc_prot.c delete mode 100644 c/src/exec/librpc/src/rpc/rpc_secure.3 delete mode 100644 c/src/exec/librpc/src/rpc/rpcdname.c delete mode 100644 c/src/exec/librpc/src/rpc/rstat.1 delete mode 100644 c/src/exec/librpc/src/rpc/rstat_svc.8 delete mode 100644 c/src/exec/librpc/src/rpc/rtems_portmapper.c delete mode 100644 c/src/exec/librpc/src/rpc/rtems_rpc.c delete mode 100644 c/src/exec/librpc/src/rpc/rtime.3 delete mode 100644 c/src/exec/librpc/src/rpc/rtime.c delete mode 100644 c/src/exec/librpc/src/rpc/svc.c delete mode 100644 c/src/exec/librpc/src/rpc/svc_auth.c delete mode 100644 c/src/exec/librpc/src/rpc/svc_auth_des.c delete mode 100644 c/src/exec/librpc/src/rpc/svc_auth_unix.c delete mode 100644 c/src/exec/librpc/src/rpc/svc_raw.c delete mode 100644 c/src/exec/librpc/src/rpc/svc_run.c delete mode 100644 c/src/exec/librpc/src/rpc/svc_simple.c delete mode 100644 c/src/exec/librpc/src/rpc/svc_tcp.c delete mode 100644 c/src/exec/librpc/src/rpc/svc_udp.c delete mode 100644 c/src/exec/librpc/src/rpc/svc_unix.c delete mode 100644 c/src/exec/librpc/src/xdr/.cvsignore delete mode 100644 c/src/exec/librpc/src/xdr/Makefile.am delete mode 100644 c/src/exec/librpc/src/xdr/xdr.3 delete mode 100644 c/src/exec/librpc/src/xdr/xdr.c delete mode 100644 c/src/exec/librpc/src/xdr/xdr_array.c delete mode 100644 c/src/exec/librpc/src/xdr/xdr_float.c delete mode 100644 c/src/exec/librpc/src/xdr/xdr_mem.c delete mode 100644 c/src/exec/librpc/src/xdr/xdr_rec.c delete mode 100644 c/src/exec/librpc/src/xdr/xdr_reference.c delete mode 100644 c/src/exec/librpc/src/xdr/xdr_sizeof.c delete mode 100644 c/src/exec/librpc/src/xdr/xdr_stdio.c delete mode 100644 c/src/exec/posix/.cvsignore delete mode 100644 c/src/exec/posix/ChangeLog delete mode 100644 c/src/exec/posix/Makefile.am delete mode 100644 c/src/exec/posix/configure.ac delete mode 100644 c/src/exec/posix/include/.cvsignore delete mode 100644 c/src/exec/posix/include/Makefile.am delete mode 100644 c/src/exec/posix/include/aio.h delete mode 100644 c/src/exec/posix/include/devctl.h delete mode 100644 c/src/exec/posix/include/intr.h delete mode 100644 c/src/exec/posix/include/mqueue.h delete mode 100644 c/src/exec/posix/include/rtems/.cvsignore delete mode 100644 c/src/exec/posix/include/rtems/posix/.cvsignore delete mode 100644 c/src/exec/posix/include/rtems/posix/cancel.h delete mode 100644 c/src/exec/posix/include/rtems/posix/cond.h delete mode 100644 c/src/exec/posix/include/rtems/posix/condmp.h delete mode 100644 c/src/exec/posix/include/rtems/posix/config.h delete mode 100644 c/src/exec/posix/include/rtems/posix/intr.h delete mode 100644 c/src/exec/posix/include/rtems/posix/key.h delete mode 100644 c/src/exec/posix/include/rtems/posix/mqueue.h delete mode 100644 c/src/exec/posix/include/rtems/posix/mqueuemp.h delete mode 100644 c/src/exec/posix/include/rtems/posix/mutex.h delete mode 100644 c/src/exec/posix/include/rtems/posix/mutexmp.h delete mode 100644 c/src/exec/posix/include/rtems/posix/posixapi.h delete mode 100644 c/src/exec/posix/include/rtems/posix/priority.h delete mode 100644 c/src/exec/posix/include/rtems/posix/psignal.h delete mode 100644 c/src/exec/posix/include/rtems/posix/pthread.h delete mode 100644 c/src/exec/posix/include/rtems/posix/pthreadmp.h delete mode 100644 c/src/exec/posix/include/rtems/posix/ptimer.h delete mode 100644 c/src/exec/posix/include/rtems/posix/semaphore.h delete mode 100644 c/src/exec/posix/include/rtems/posix/semaphoremp.h delete mode 100644 c/src/exec/posix/include/rtems/posix/threadsup.h delete mode 100644 c/src/exec/posix/include/rtems/posix/time.h delete mode 100644 c/src/exec/posix/include/rtems/posix/timer.h delete mode 100644 c/src/exec/posix/include/sched.h delete mode 100644 c/src/exec/posix/include/semaphore.h delete mode 100644 c/src/exec/posix/inline/.cvsignore delete mode 100644 c/src/exec/posix/inline/Makefile.am delete mode 100644 c/src/exec/posix/inline/rtems/.cvsignore delete mode 100644 c/src/exec/posix/inline/rtems/posix/.cvsignore delete mode 100644 c/src/exec/posix/inline/rtems/posix/cond.inl delete mode 100644 c/src/exec/posix/inline/rtems/posix/intr.inl delete mode 100644 c/src/exec/posix/inline/rtems/posix/key.inl delete mode 100644 c/src/exec/posix/inline/rtems/posix/mqueue.inl delete mode 100644 c/src/exec/posix/inline/rtems/posix/mutex.inl delete mode 100644 c/src/exec/posix/inline/rtems/posix/priority.inl delete mode 100644 c/src/exec/posix/inline/rtems/posix/pthread.inl delete mode 100644 c/src/exec/posix/inline/rtems/posix/semaphore.inl delete mode 100644 c/src/exec/posix/inline/rtems/posix/timer.inl delete mode 100644 c/src/exec/posix/macros/.cvsignore delete mode 100644 c/src/exec/posix/macros/Makefile.am delete mode 100644 c/src/exec/posix/macros/rtems/.cvsignore delete mode 100644 c/src/exec/posix/macros/rtems/posix/.cvsignore delete mode 100644 c/src/exec/posix/macros/rtems/posix/cond.inl delete mode 100644 c/src/exec/posix/macros/rtems/posix/intr.inl delete mode 100644 c/src/exec/posix/macros/rtems/posix/key.inl delete mode 100644 c/src/exec/posix/macros/rtems/posix/mqueue.inl delete mode 100644 c/src/exec/posix/macros/rtems/posix/mutex.inl delete mode 100644 c/src/exec/posix/macros/rtems/posix/priority.inl delete mode 100644 c/src/exec/posix/macros/rtems/posix/pthread.inl delete mode 100644 c/src/exec/posix/macros/rtems/posix/semaphore.inl delete mode 100644 c/src/exec/posix/macros/rtems/posix/timer.inl delete mode 100644 c/src/exec/posix/src/.cvsignore delete mode 100644 c/src/exec/posix/src/Makefile.am delete mode 100644 c/src/exec/posix/src/README.mqueue delete mode 100644 c/src/exec/posix/src/adasupp.c delete mode 100644 c/src/exec/posix/src/aio.c delete mode 100644 c/src/exec/posix/src/alarm.c delete mode 100644 c/src/exec/posix/src/cancel.c delete mode 100644 c/src/exec/posix/src/cancelrun.c delete mode 100644 c/src/exec/posix/src/cleanuppop.c delete mode 100644 c/src/exec/posix/src/cleanuppush.c delete mode 100644 c/src/exec/posix/src/clockgetcpuclockid.c delete mode 100644 c/src/exec/posix/src/clockgetenableattr.c delete mode 100644 c/src/exec/posix/src/clockgetres.c delete mode 100644 c/src/exec/posix/src/clockgettime.c delete mode 100644 c/src/exec/posix/src/clocksetenableattr.c delete mode 100644 c/src/exec/posix/src/clocksettime.c delete mode 100644 c/src/exec/posix/src/cond.c delete mode 100644 c/src/exec/posix/src/condattrdestroy.c delete mode 100644 c/src/exec/posix/src/condattrgetpshared.c delete mode 100644 c/src/exec/posix/src/condattrinit.c delete mode 100644 c/src/exec/posix/src/condattrsetpshared.c delete mode 100644 c/src/exec/posix/src/condbroadcast.c delete mode 100644 c/src/exec/posix/src/conddefaultattributes.c delete mode 100644 c/src/exec/posix/src/conddestroy.c delete mode 100644 c/src/exec/posix/src/condinit.c delete mode 100644 c/src/exec/posix/src/condmp.c delete mode 100644 c/src/exec/posix/src/condsignal.c delete mode 100644 c/src/exec/posix/src/condsignalsupp.c delete mode 100644 c/src/exec/posix/src/condtimedwait.c delete mode 100644 c/src/exec/posix/src/condwait.c delete mode 100644 c/src/exec/posix/src/condwaitsupp.c delete mode 100644 c/src/exec/posix/src/devctl.c delete mode 100644 c/src/exec/posix/src/execl.c delete mode 100644 c/src/exec/posix/src/execle.c delete mode 100644 c/src/exec/posix/src/execlp.c delete mode 100644 c/src/exec/posix/src/execv.c delete mode 100644 c/src/exec/posix/src/execve.c delete mode 100644 c/src/exec/posix/src/execvp.c delete mode 100644 c/src/exec/posix/src/fork.c delete mode 100644 c/src/exec/posix/src/getegid.c delete mode 100644 c/src/exec/posix/src/geteuid.c delete mode 100644 c/src/exec/posix/src/getgid.c delete mode 100644 c/src/exec/posix/src/getgroups.c delete mode 100644 c/src/exec/posix/src/getlogin.c delete mode 100644 c/src/exec/posix/src/getpagesize.c delete mode 100644 c/src/exec/posix/src/getpgrp.c delete mode 100644 c/src/exec/posix/src/getpid.c delete mode 100644 c/src/exec/posix/src/getppid.c delete mode 100644 c/src/exec/posix/src/getuid.c delete mode 100644 c/src/exec/posix/src/intr.c delete mode 100644 c/src/exec/posix/src/key.c delete mode 100644 c/src/exec/posix/src/keycreate.c delete mode 100644 c/src/exec/posix/src/keydelete.c delete mode 100644 c/src/exec/posix/src/keygetspecific.c delete mode 100644 c/src/exec/posix/src/keyrundestructors.c delete mode 100644 c/src/exec/posix/src/keysetspecific.c delete mode 100644 c/src/exec/posix/src/kill.c delete mode 100644 c/src/exec/posix/src/killinfo.c delete mode 100644 c/src/exec/posix/src/mprotect.c delete mode 100644 c/src/exec/posix/src/mqueue.c delete mode 100644 c/src/exec/posix/src/mqueueclose.c delete mode 100644 c/src/exec/posix/src/mqueuecreatesupp.c delete mode 100644 c/src/exec/posix/src/mqueuedeletesupp.c delete mode 100644 c/src/exec/posix/src/mqueuegetattr.c delete mode 100644 c/src/exec/posix/src/mqueuenametoid.c delete mode 100644 c/src/exec/posix/src/mqueuenotify.c delete mode 100644 c/src/exec/posix/src/mqueueopen.c delete mode 100644 c/src/exec/posix/src/mqueuereceive.c delete mode 100644 c/src/exec/posix/src/mqueuerecvsupp.c delete mode 100644 c/src/exec/posix/src/mqueuesend.c delete mode 100644 c/src/exec/posix/src/mqueuesendsupp.c delete mode 100644 c/src/exec/posix/src/mqueuesetattr.c delete mode 100644 c/src/exec/posix/src/mqueuetimedreceive.c delete mode 100644 c/src/exec/posix/src/mqueuetimedsend.c delete mode 100644 c/src/exec/posix/src/mqueuetranslatereturncode.c delete mode 100644 c/src/exec/posix/src/mqueueunlink.c delete mode 100644 c/src/exec/posix/src/mutex.c delete mode 100644 c/src/exec/posix/src/mutexattrdestroy.c delete mode 100644 c/src/exec/posix/src/mutexattrgetprioceiling.c delete mode 100644 c/src/exec/posix/src/mutexattrgetprotocol.c delete mode 100644 c/src/exec/posix/src/mutexattrgetpshared.c delete mode 100644 c/src/exec/posix/src/mutexattrinit.c delete mode 100644 c/src/exec/posix/src/mutexattrsetprioceiling.c delete mode 100644 c/src/exec/posix/src/mutexattrsetprotocol.c delete mode 100644 c/src/exec/posix/src/mutexattrsetpshared.c delete mode 100644 c/src/exec/posix/src/mutexdefaultattributes.c delete mode 100644 c/src/exec/posix/src/mutexdestroy.c delete mode 100644 c/src/exec/posix/src/mutexfromcorestatus.c delete mode 100644 c/src/exec/posix/src/mutexgetprioceiling.c delete mode 100644 c/src/exec/posix/src/mutexinit.c delete mode 100644 c/src/exec/posix/src/mutexlock.c delete mode 100644 c/src/exec/posix/src/mutexlocksupp.c delete mode 100644 c/src/exec/posix/src/mutexmp.c delete mode 100644 c/src/exec/posix/src/mutexsetprioceiling.c delete mode 100644 c/src/exec/posix/src/mutextimedlock.c delete mode 100644 c/src/exec/posix/src/mutextrylock.c delete mode 100644 c/src/exec/posix/src/mutexunlock.c delete mode 100644 c/src/exec/posix/src/nanosleep.c delete mode 100644 c/src/exec/posix/src/pause.c delete mode 100644 c/src/exec/posix/src/posixintervaltotimespec.c delete mode 100644 c/src/exec/posix/src/posixtimespecsubtract.c delete mode 100644 c/src/exec/posix/src/posixtimespectointerval.c delete mode 100644 c/src/exec/posix/src/psignal.c delete mode 100644 c/src/exec/posix/src/psignalchecksignal.c delete mode 100644 c/src/exec/posix/src/psignalclearprocesssignals.c delete mode 100644 c/src/exec/posix/src/psignalclearsignals.c delete mode 100644 c/src/exec/posix/src/psignalsetprocesssignals.c delete mode 100644 c/src/exec/posix/src/psignalunblockthread.c delete mode 100644 c/src/exec/posix/src/pthread.c delete mode 100644 c/src/exec/posix/src/pthreadatfork.c delete mode 100644 c/src/exec/posix/src/pthreadattrdestroy.c delete mode 100644 c/src/exec/posix/src/pthreadattrgetdetachstate.c delete mode 100644 c/src/exec/posix/src/pthreadattrgetinheritsched.c delete mode 100644 c/src/exec/posix/src/pthreadattrgetschedparam.c delete mode 100644 c/src/exec/posix/src/pthreadattrgetschedpolicy.c delete mode 100644 c/src/exec/posix/src/pthreadattrgetscope.c delete mode 100644 c/src/exec/posix/src/pthreadattrgetstackaddr.c delete mode 100644 c/src/exec/posix/src/pthreadattrgetstacksize.c delete mode 100644 c/src/exec/posix/src/pthreadattrinit.c delete mode 100644 c/src/exec/posix/src/pthreadattrsetdetachstate.c delete mode 100644 c/src/exec/posix/src/pthreadattrsetinheritsched.c delete mode 100644 c/src/exec/posix/src/pthreadattrsetschedparam.c delete mode 100644 c/src/exec/posix/src/pthreadattrsetschedpolicy.c delete mode 100644 c/src/exec/posix/src/pthreadattrsetscope.c delete mode 100644 c/src/exec/posix/src/pthreadattrsetstackaddr.c delete mode 100644 c/src/exec/posix/src/pthreadattrsetstacksize.c delete mode 100644 c/src/exec/posix/src/pthreadcreate.c delete mode 100644 c/src/exec/posix/src/pthreaddetach.c delete mode 100644 c/src/exec/posix/src/pthreadequal.c delete mode 100644 c/src/exec/posix/src/pthreadexit.c delete mode 100644 c/src/exec/posix/src/pthreadgetcpuclockid.c delete mode 100644 c/src/exec/posix/src/pthreadgetcputime.c delete mode 100644 c/src/exec/posix/src/pthreadgetschedparam.c delete mode 100644 c/src/exec/posix/src/pthreadjoin.c delete mode 100644 c/src/exec/posix/src/pthreadkill.c delete mode 100644 c/src/exec/posix/src/pthreadonce.c delete mode 100644 c/src/exec/posix/src/pthreadself.c delete mode 100644 c/src/exec/posix/src/pthreadsetcputime.c delete mode 100644 c/src/exec/posix/src/pthreadsetschedparam.c delete mode 100644 c/src/exec/posix/src/pthreadsigmask.c delete mode 100644 c/src/exec/posix/src/ptimer.c delete mode 100644 c/src/exec/posix/src/ptimer1.c delete mode 100644 c/src/exec/posix/src/sched.c delete mode 100644 c/src/exec/posix/src/semaphore.c delete mode 100644 c/src/exec/posix/src/semaphorecreatesupp.c delete mode 100644 c/src/exec/posix/src/semaphoredeletesupp.c delete mode 100644 c/src/exec/posix/src/semaphoremp.c delete mode 100644 c/src/exec/posix/src/semaphorenametoid.c delete mode 100644 c/src/exec/posix/src/semaphorewaitsupp.c delete mode 100644 c/src/exec/posix/src/semclose.c delete mode 100644 c/src/exec/posix/src/semdestroy.c delete mode 100644 c/src/exec/posix/src/semgetvalue.c delete mode 100644 c/src/exec/posix/src/seminit.c delete mode 100644 c/src/exec/posix/src/semopen.c delete mode 100644 c/src/exec/posix/src/sempost.c delete mode 100644 c/src/exec/posix/src/semtimedwait.c delete mode 100644 c/src/exec/posix/src/semtrywait.c delete mode 100644 c/src/exec/posix/src/semunlink.c delete mode 100644 c/src/exec/posix/src/semwait.c delete mode 100644 c/src/exec/posix/src/setcancelstate.c delete mode 100644 c/src/exec/posix/src/setcanceltype.c delete mode 100644 c/src/exec/posix/src/setpgid.c delete mode 100644 c/src/exec/posix/src/setsid.c delete mode 100644 c/src/exec/posix/src/sigaction.c delete mode 100644 c/src/exec/posix/src/sigaddset.c delete mode 100644 c/src/exec/posix/src/sigdelset.c delete mode 100644 c/src/exec/posix/src/sigemptyset.c delete mode 100644 c/src/exec/posix/src/sigfillset.c delete mode 100644 c/src/exec/posix/src/sigismember.c delete mode 100644 c/src/exec/posix/src/signal_2.c delete mode 100644 c/src/exec/posix/src/sigpending.c delete mode 100644 c/src/exec/posix/src/sigprocmask.c delete mode 100644 c/src/exec/posix/src/sigqueue.c delete mode 100644 c/src/exec/posix/src/sigsuspend.c delete mode 100644 c/src/exec/posix/src/sigtimedwait.c delete mode 100644 c/src/exec/posix/src/sigwait.c delete mode 100644 c/src/exec/posix/src/sigwaitinfo.c delete mode 100644 c/src/exec/posix/src/sleep.c delete mode 100644 c/src/exec/posix/src/sysconf.c delete mode 100644 c/src/exec/posix/src/testcancel.c delete mode 100644 c/src/exec/posix/src/time.c delete mode 100644 c/src/exec/posix/src/types.c delete mode 100644 c/src/exec/posix/src/wait.c delete mode 100644 c/src/exec/posix/src/waitpid.c delete mode 100644 c/src/exec/rtems/.cvsignore delete mode 100644 c/src/exec/rtems/ChangeLog delete mode 100644 c/src/exec/rtems/Makefile.am delete mode 100644 c/src/exec/rtems/include/.cvsignore delete mode 100644 c/src/exec/rtems/include/Makefile.am delete mode 100644 c/src/exec/rtems/include/rtems.h delete mode 100644 c/src/exec/rtems/include/rtems/.cvsignore delete mode 100644 c/src/exec/rtems/include/rtems/rtems/.cvsignore delete mode 100644 c/src/exec/rtems/include/rtems/rtems/asr.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/attr.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/cache.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/clock.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/config.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/dpmem.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/event.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/eventmp.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/eventset.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/intr.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/message.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/modes.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/mp.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/msgmp.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/options.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/part.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/partmp.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/ratemon.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/region.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/regionmp.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/rtemsapi.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/sem.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/semmp.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/signal.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/signalmp.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/status.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/support.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/taskmp.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/tasks.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/timer.h delete mode 100644 c/src/exec/rtems/include/rtems/rtems/types.h delete mode 100644 c/src/exec/rtems/inline/.cvsignore delete mode 100644 c/src/exec/rtems/inline/Makefile.am delete mode 100644 c/src/exec/rtems/inline/rtems/.cvsignore delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/.cvsignore delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/asr.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/attr.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/dpmem.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/event.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/eventset.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/message.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/modes.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/options.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/part.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/ratemon.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/region.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/sem.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/status.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/support.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/tasks.inl delete mode 100644 c/src/exec/rtems/inline/rtems/rtems/timer.inl delete mode 100644 c/src/exec/rtems/macros/.cvsignore delete mode 100644 c/src/exec/rtems/macros/Makefile.am delete mode 100644 c/src/exec/rtems/macros/rtems/.cvsignore delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/.cvsignore delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/asr.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/attr.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/dpmem.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/event.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/eventset.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/message.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/modes.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/options.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/part.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/ratemon.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/region.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/sem.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/status.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/support.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/tasks.inl delete mode 100644 c/src/exec/rtems/macros/rtems/rtems/timer.inl delete mode 100644 c/src/exec/rtems/src/.cvsignore delete mode 100644 c/src/exec/rtems/src/Makefile.am delete mode 100644 c/src/exec/rtems/src/attr.c delete mode 100644 c/src/exec/rtems/src/clockget.c delete mode 100644 c/src/exec/rtems/src/clockset.c delete mode 100644 c/src/exec/rtems/src/clocktick.c delete mode 100644 c/src/exec/rtems/src/dpmem.c delete mode 100644 c/src/exec/rtems/src/dpmemcreate.c delete mode 100644 c/src/exec/rtems/src/dpmemdelete.c delete mode 100644 c/src/exec/rtems/src/dpmemexternal2internal.c delete mode 100644 c/src/exec/rtems/src/dpmemident.c delete mode 100644 c/src/exec/rtems/src/dpmeminternal2external.c delete mode 100644 c/src/exec/rtems/src/event.c delete mode 100644 c/src/exec/rtems/src/eventmp.c delete mode 100644 c/src/exec/rtems/src/eventreceive.c delete mode 100644 c/src/exec/rtems/src/eventseize.c delete mode 100644 c/src/exec/rtems/src/eventsend.c delete mode 100644 c/src/exec/rtems/src/eventsurrender.c delete mode 100644 c/src/exec/rtems/src/eventtimeout.c delete mode 100644 c/src/exec/rtems/src/intr.c delete mode 100644 c/src/exec/rtems/src/intrbody.c delete mode 100644 c/src/exec/rtems/src/intrcatch.c delete mode 100644 c/src/exec/rtems/src/mp.c delete mode 100644 c/src/exec/rtems/src/msg.c delete mode 100644 c/src/exec/rtems/src/msgmp.c delete mode 100644 c/src/exec/rtems/src/msgqallocate.c delete mode 100644 c/src/exec/rtems/src/msgqbroadcast.c delete mode 100644 c/src/exec/rtems/src/msgqcreate.c delete mode 100644 c/src/exec/rtems/src/msgqdelete.c delete mode 100644 c/src/exec/rtems/src/msgqflush.c delete mode 100644 c/src/exec/rtems/src/msgqgetnumberpending.c delete mode 100644 c/src/exec/rtems/src/msgqident.c delete mode 100644 c/src/exec/rtems/src/msgqreceive.c delete mode 100644 c/src/exec/rtems/src/msgqsend.c delete mode 100644 c/src/exec/rtems/src/msgqsubmit.c delete mode 100644 c/src/exec/rtems/src/msgqtranslatereturncode.c delete mode 100644 c/src/exec/rtems/src/msgqurgent.c delete mode 100644 c/src/exec/rtems/src/part.c delete mode 100644 c/src/exec/rtems/src/partcreate.c delete mode 100644 c/src/exec/rtems/src/partdelete.c delete mode 100644 c/src/exec/rtems/src/partgetbuffer.c delete mode 100644 c/src/exec/rtems/src/partident.c delete mode 100644 c/src/exec/rtems/src/partmp.c delete mode 100644 c/src/exec/rtems/src/partreturnbuffer.c delete mode 100644 c/src/exec/rtems/src/ratemon.c delete mode 100644 c/src/exec/rtems/src/ratemoncancel.c delete mode 100644 c/src/exec/rtems/src/ratemoncreate.c delete mode 100644 c/src/exec/rtems/src/ratemondelete.c delete mode 100644 c/src/exec/rtems/src/ratemongetstatus.c delete mode 100644 c/src/exec/rtems/src/ratemonident.c delete mode 100644 c/src/exec/rtems/src/ratemonperiod.c delete mode 100644 c/src/exec/rtems/src/ratemontimeout.c delete mode 100644 c/src/exec/rtems/src/region.c delete mode 100644 c/src/exec/rtems/src/regioncreate.c delete mode 100644 c/src/exec/rtems/src/regiondelete.c delete mode 100644 c/src/exec/rtems/src/regionextend.c delete mode 100644 c/src/exec/rtems/src/regiongetinfo.c delete mode 100644 c/src/exec/rtems/src/regiongetsegment.c delete mode 100644 c/src/exec/rtems/src/regiongetsegmentsize.c delete mode 100644 c/src/exec/rtems/src/regionident.c delete mode 100644 c/src/exec/rtems/src/regionmp.c delete mode 100644 c/src/exec/rtems/src/regionreturnsegment.c delete mode 100644 c/src/exec/rtems/src/rtclock.c delete mode 100644 c/src/exec/rtems/src/rtemstimer.c delete mode 100644 c/src/exec/rtems/src/sem.c delete mode 100644 c/src/exec/rtems/src/semcreate.c delete mode 100644 c/src/exec/rtems/src/semdelete.c delete mode 100644 c/src/exec/rtems/src/semflush.c delete mode 100644 c/src/exec/rtems/src/semident.c delete mode 100644 c/src/exec/rtems/src/semmp.c delete mode 100644 c/src/exec/rtems/src/semobtain.c delete mode 100644 c/src/exec/rtems/src/semrelease.c delete mode 100644 c/src/exec/rtems/src/semtranslatereturncode.c delete mode 100644 c/src/exec/rtems/src/signal.c delete mode 100644 c/src/exec/rtems/src/signalcatch.c delete mode 100644 c/src/exec/rtems/src/signalmp.c delete mode 100644 c/src/exec/rtems/src/signalsend.c delete mode 100644 c/src/exec/rtems/src/taskcreate.c delete mode 100644 c/src/exec/rtems/src/taskdelete.c delete mode 100644 c/src/exec/rtems/src/taskgetnote.c delete mode 100644 c/src/exec/rtems/src/taskident.c delete mode 100644 c/src/exec/rtems/src/taskinitusers.c delete mode 100644 c/src/exec/rtems/src/taskissuspended.c delete mode 100644 c/src/exec/rtems/src/taskmode.c delete mode 100644 c/src/exec/rtems/src/taskmp.c delete mode 100644 c/src/exec/rtems/src/taskrestart.c delete mode 100644 c/src/exec/rtems/src/taskresume.c delete mode 100644 c/src/exec/rtems/src/tasks.c delete mode 100644 c/src/exec/rtems/src/tasksetnote.c delete mode 100644 c/src/exec/rtems/src/tasksetpriority.c delete mode 100644 c/src/exec/rtems/src/taskstart.c delete mode 100644 c/src/exec/rtems/src/tasksuspend.c delete mode 100644 c/src/exec/rtems/src/taskvariableadd.c delete mode 100644 c/src/exec/rtems/src/taskvariabledelete.c delete mode 100644 c/src/exec/rtems/src/taskvariableget.c delete mode 100644 c/src/exec/rtems/src/taskwakeafter.c delete mode 100644 c/src/exec/rtems/src/taskwakewhen.c delete mode 100644 c/src/exec/rtems/src/timercancel.c delete mode 100644 c/src/exec/rtems/src/timercreate.c delete mode 100644 c/src/exec/rtems/src/timerdelete.c delete mode 100644 c/src/exec/rtems/src/timerfireafter.c delete mode 100644 c/src/exec/rtems/src/timerfirewhen.c delete mode 100644 c/src/exec/rtems/src/timergetinfo.c delete mode 100644 c/src/exec/rtems/src/timerident.c delete mode 100644 c/src/exec/rtems/src/timerreset.c delete mode 100644 c/src/exec/rtems/src/timerserver.c delete mode 100644 c/src/exec/rtems/src/timerserverfireafter.c delete mode 100644 c/src/exec/rtems/src/timerserverfirewhen.c delete mode 100644 c/src/exec/sapi/.cvsignore delete mode 100644 c/src/exec/sapi/ChangeLog delete mode 100644 c/src/exec/sapi/Makefile.am delete mode 100644 c/src/exec/sapi/include/.cvsignore delete mode 100644 c/src/exec/sapi/include/Makefile.am delete mode 100644 c/src/exec/sapi/include/confdefs.h delete mode 100644 c/src/exec/sapi/include/rtems/.cvsignore delete mode 100644 c/src/exec/sapi/include/rtems/README delete mode 100644 c/src/exec/sapi/include/rtems/config.h delete mode 100644 c/src/exec/sapi/include/rtems/extension.h delete mode 100644 c/src/exec/sapi/include/rtems/fatal.h delete mode 100644 c/src/exec/sapi/include/rtems/init.h delete mode 100644 c/src/exec/sapi/include/rtems/io.h delete mode 100644 c/src/exec/sapi/include/rtems/mptables.h delete mode 100644 c/src/exec/sapi/include/rtems/sptables.h.in delete mode 100644 c/src/exec/sapi/inline/.cvsignore delete mode 100644 c/src/exec/sapi/inline/Makefile.am delete mode 100644 c/src/exec/sapi/inline/rtems/.cvsignore delete mode 100644 c/src/exec/sapi/inline/rtems/extension.inl delete mode 100644 c/src/exec/sapi/macros/.cvsignore delete mode 100644 c/src/exec/sapi/macros/Makefile.am delete mode 100644 c/src/exec/sapi/macros/rtems/.cvsignore delete mode 100644 c/src/exec/sapi/macros/rtems/extension.inl delete mode 100644 c/src/exec/sapi/src/.cvsignore delete mode 100644 c/src/exec/sapi/src/Makefile.am delete mode 100644 c/src/exec/sapi/src/debug.c delete mode 100644 c/src/exec/sapi/src/exinit.c delete mode 100644 c/src/exec/sapi/src/extension.c delete mode 100644 c/src/exec/sapi/src/extensioncreate.c delete mode 100644 c/src/exec/sapi/src/extensiondelete.c delete mode 100644 c/src/exec/sapi/src/extensionident.c delete mode 100644 c/src/exec/sapi/src/fatal.c delete mode 100644 c/src/exec/sapi/src/io.c delete mode 100644 c/src/exec/sapi/src/itronapi.c delete mode 100644 c/src/exec/sapi/src/posixapi.c delete mode 100644 c/src/exec/sapi/src/rtemsapi.c delete mode 100644 c/src/exec/score/.cvsignore delete mode 100644 c/src/exec/score/ChangeLog delete mode 100644 c/src/exec/score/Makefile.am delete mode 100644 c/src/exec/score/cpu/.cvsignore delete mode 100644 c/src/exec/score/cpu/Makefile.am delete mode 100644 c/src/exec/score/cpu/a29k/.cvsignore delete mode 100644 c/src/exec/score/cpu/a29k/ChangeLog delete mode 100644 c/src/exec/score/cpu/a29k/Makefile.am delete mode 100644 c/src/exec/score/cpu/a29k/amd.ah delete mode 100644 c/src/exec/score/cpu/a29k/asm.h delete mode 100644 c/src/exec/score/cpu/a29k/configure.ac delete mode 100644 c/src/exec/score/cpu/a29k/cpu.c delete mode 100644 c/src/exec/score/cpu/a29k/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/a29k/pswmacro.ah delete mode 100644 c/src/exec/score/cpu/a29k/register.ah delete mode 100644 c/src/exec/score/cpu/a29k/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/a29k/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/a29k/rtems/score/a29k.h delete mode 100644 c/src/exec/score/cpu/a29k/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/a29k/rtems/score/cpu_asm.h delete mode 100644 c/src/exec/score/cpu/a29k/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/a29k/sig.S delete mode 100644 c/src/exec/score/cpu/arm/.cvsignore delete mode 100644 c/src/exec/score/cpu/arm/ChangeLog delete mode 100644 c/src/exec/score/cpu/arm/Makefile.am delete mode 100644 c/src/exec/score/cpu/arm/asm.h delete mode 100644 c/src/exec/score/cpu/arm/configure.ac delete mode 100644 c/src/exec/score/cpu/arm/cpu.c delete mode 100644 c/src/exec/score/cpu/arm/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/arm/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/arm/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/arm/rtems/score/arm.h delete mode 100644 c/src/exec/score/cpu/arm/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/arm/rtems/score/cpu_asm.h delete mode 100644 c/src/exec/score/cpu/arm/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/c4x/.cvsignore delete mode 100644 c/src/exec/score/cpu/c4x/ChangeLog delete mode 100644 c/src/exec/score/cpu/c4x/Makefile.am delete mode 100644 c/src/exec/score/cpu/c4x/asm.h delete mode 100644 c/src/exec/score/cpu/c4x/c4xio.h delete mode 100644 c/src/exec/score/cpu/c4x/configure.ac delete mode 100644 c/src/exec/score/cpu/c4x/cpu.c delete mode 100644 c/src/exec/score/cpu/c4x/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/c4x/irq.c delete mode 100644 c/src/exec/score/cpu/c4x/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/c4x/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/c4x/rtems/score/c4x.h delete mode 100644 c/src/exec/score/cpu/c4x/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/c4x/rtems/score/cpu_asm.h delete mode 100644 c/src/exec/score/cpu/c4x/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/h8300/.cvsignore delete mode 100644 c/src/exec/score/cpu/h8300/ChangeLog delete mode 100644 c/src/exec/score/cpu/h8300/Makefile.am delete mode 100644 c/src/exec/score/cpu/h8300/README delete mode 100644 c/src/exec/score/cpu/h8300/asm.h delete mode 100644 c/src/exec/score/cpu/h8300/configure.ac delete mode 100644 c/src/exec/score/cpu/h8300/cpu.c delete mode 100644 c/src/exec/score/cpu/h8300/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/h8300/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/h8300/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/h8300/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/h8300/rtems/score/h8300.h delete mode 100644 c/src/exec/score/cpu/h8300/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/hppa1.1/.cvsignore delete mode 100644 c/src/exec/score/cpu/hppa1.1/ChangeLog delete mode 100644 c/src/exec/score/cpu/hppa1.1/Makefile.am delete mode 100644 c/src/exec/score/cpu/hppa1.1/configure.ac delete mode 100644 c/src/exec/score/cpu/hppa1.1/cpu.c delete mode 100644 c/src/exec/score/cpu/hppa1.1/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/hppa1.1/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/hppa1.1/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/hppa1.1/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/hppa1.1/rtems/score/cpu_asm.h delete mode 100644 c/src/exec/score/cpu/hppa1.1/rtems/score/hppa.h delete mode 100644 c/src/exec/score/cpu/hppa1.1/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/i386/.cvsignore delete mode 100644 c/src/exec/score/cpu/i386/ChangeLog delete mode 100644 c/src/exec/score/cpu/i386/Makefile.am delete mode 100644 c/src/exec/score/cpu/i386/asm.h delete mode 100644 c/src/exec/score/cpu/i386/configure.ac delete mode 100644 c/src/exec/score/cpu/i386/cpu.c delete mode 100644 c/src/exec/score/cpu/i386/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/i386/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/i386/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/i386/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/i386/rtems/score/i386.h delete mode 100644 c/src/exec/score/cpu/i386/rtems/score/idtr.h delete mode 100644 c/src/exec/score/cpu/i386/rtems/score/interrupts.h delete mode 100644 c/src/exec/score/cpu/i386/rtems/score/registers.h delete mode 100644 c/src/exec/score/cpu/i386/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/i960/.cvsignore delete mode 100644 c/src/exec/score/cpu/i960/ChangeLog delete mode 100644 c/src/exec/score/cpu/i960/Makefile.am delete mode 100644 c/src/exec/score/cpu/i960/asm.h delete mode 100644 c/src/exec/score/cpu/i960/configure.ac delete mode 100644 c/src/exec/score/cpu/i960/cpu.c delete mode 100644 c/src/exec/score/cpu/i960/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/i960/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/i960/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/i960/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/i960/rtems/score/i960.h delete mode 100644 c/src/exec/score/cpu/i960/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/m68k/.cvsignore delete mode 100644 c/src/exec/score/cpu/m68k/ChangeLog delete mode 100644 c/src/exec/score/cpu/m68k/Makefile.am delete mode 100644 c/src/exec/score/cpu/m68k/asm.h delete mode 100644 c/src/exec/score/cpu/m68k/configure.ac delete mode 100644 c/src/exec/score/cpu/m68k/cpu.c delete mode 100644 c/src/exec/score/cpu/m68k/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/m68k/m68302.h delete mode 100644 c/src/exec/score/cpu/m68k/m68360.h delete mode 100644 c/src/exec/score/cpu/m68k/memcpy.c delete mode 100644 c/src/exec/score/cpu/m68k/qsm.h delete mode 100644 c/src/exec/score/cpu/m68k/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/m68k/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/m68k/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/m68k/rtems/score/m68k.h delete mode 100644 c/src/exec/score/cpu/m68k/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/m68k/sim.h delete mode 100644 c/src/exec/score/cpu/mips/.cvsignore delete mode 100644 c/src/exec/score/cpu/mips/ChangeLog delete mode 100644 c/src/exec/score/cpu/mips/Makefile.am delete mode 100644 c/src/exec/score/cpu/mips/asm.h delete mode 100644 c/src/exec/score/cpu/mips/configure.ac delete mode 100644 c/src/exec/score/cpu/mips/cpu.c delete mode 100644 c/src/exec/score/cpu/mips/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/mips/idtcpu.h delete mode 100644 c/src/exec/score/cpu/mips/iregdef.h delete mode 100644 c/src/exec/score/cpu/mips/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/mips/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/mips/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/mips/rtems/score/mips.h delete mode 100644 c/src/exec/score/cpu/mips/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/mips64orion/.cvsignore delete mode 100644 c/src/exec/score/cpu/mips64orion/ChangeLog delete mode 100644 c/src/exec/score/cpu/mips64orion/Makefile.am delete mode 100644 c/src/exec/score/cpu/mips64orion/asm.h delete mode 100644 c/src/exec/score/cpu/mips64orion/configure.ac delete mode 100644 c/src/exec/score/cpu/mips64orion/cpu.c delete mode 100644 c/src/exec/score/cpu/mips64orion/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/mips64orion/cpu_asm.h delete mode 100644 c/src/exec/score/cpu/mips64orion/idtcpu.h delete mode 100644 c/src/exec/score/cpu/mips64orion/idtmon.h delete mode 100644 c/src/exec/score/cpu/mips64orion/iregdef.h delete mode 100644 c/src/exec/score/cpu/mips64orion/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/mips64orion/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/mips64orion/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/mips64orion/rtems/score/mips64orion.h delete mode 100644 c/src/exec/score/cpu/mips64orion/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/no_cpu/.cvsignore delete mode 100644 c/src/exec/score/cpu/no_cpu/ChangeLog delete mode 100644 c/src/exec/score/cpu/no_cpu/Makefile.am delete mode 100644 c/src/exec/score/cpu/no_cpu/asm.h delete mode 100644 c/src/exec/score/cpu/no_cpu/configure.ac delete mode 100644 c/src/exec/score/cpu/no_cpu/cpu.c delete mode 100644 c/src/exec/score/cpu/no_cpu/cpu_asm.c delete mode 100644 c/src/exec/score/cpu/no_cpu/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/no_cpu/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/no_cpu/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/no_cpu/rtems/score/cpu_asm.h delete mode 100644 c/src/exec/score/cpu/no_cpu/rtems/score/no_cpu.h delete mode 100644 c/src/exec/score/cpu/no_cpu/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/or16/.cvsignore delete mode 100644 c/src/exec/score/cpu/or16/ChangeLog delete mode 100644 c/src/exec/score/cpu/or16/Makefile.am delete mode 100644 c/src/exec/score/cpu/or16/asm.h delete mode 100644 c/src/exec/score/cpu/or16/configure.ac delete mode 100644 c/src/exec/score/cpu/or16/cpu.c delete mode 100644 c/src/exec/score/cpu/or16/cpu_asm.c delete mode 100644 c/src/exec/score/cpu/or16/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/or16/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/or16/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/or16/rtems/score/cpu_asm.h delete mode 100644 c/src/exec/score/cpu/or16/rtems/score/or16.h delete mode 100644 c/src/exec/score/cpu/or16/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/or32/.cvsignore delete mode 100644 c/src/exec/score/cpu/or32/ChangeLog delete mode 100644 c/src/exec/score/cpu/or32/Makefile.am delete mode 100644 c/src/exec/score/cpu/or32/asm.h delete mode 100644 c/src/exec/score/cpu/or32/configure.ac delete mode 100644 c/src/exec/score/cpu/or32/cpu.c delete mode 100644 c/src/exec/score/cpu/or32/cpu_asm.c delete mode 100644 c/src/exec/score/cpu/or32/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/or32/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/or32/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/or32/rtems/score/cpu_asm.h delete mode 100644 c/src/exec/score/cpu/or32/rtems/score/or32.h delete mode 100644 c/src/exec/score/cpu/or32/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/powerpc/.cvsignore delete mode 100644 c/src/exec/score/cpu/powerpc/ChangeLog delete mode 100644 c/src/exec/score/cpu/powerpc/Makefile.am delete mode 100644 c/src/exec/score/cpu/powerpc/asm.h delete mode 100644 c/src/exec/score/cpu/powerpc/configure.ac delete mode 100644 c/src/exec/score/cpu/powerpc/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/powerpc/rtems/new-exceptions/cpu.h delete mode 100644 c/src/exec/score/cpu/powerpc/rtems/old-exceptions/cpu.h delete mode 100644 c/src/exec/score/cpu/powerpc/rtems/powerpc/registers.h delete mode 100644 c/src/exec/score/cpu/powerpc/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/powerpc/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/powerpc/rtems/score/ppc.h delete mode 100644 c/src/exec/score/cpu/powerpc/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/sh/.cvsignore delete mode 100644 c/src/exec/score/cpu/sh/ChangeLog delete mode 100644 c/src/exec/score/cpu/sh/Makefile.am delete mode 100644 c/src/exec/score/cpu/sh/asm.h delete mode 100644 c/src/exec/score/cpu/sh/configure.ac delete mode 100644 c/src/exec/score/cpu/sh/cpu.c delete mode 100644 c/src/exec/score/cpu/sh/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/sh/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/sh/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/sh/rtems/score/sh.h delete mode 100644 c/src/exec/score/cpu/sh/rtems/score/sh_io.h delete mode 100644 c/src/exec/score/cpu/sh/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/sparc/.cvsignore delete mode 100644 c/src/exec/score/cpu/sparc/ChangeLog delete mode 100644 c/src/exec/score/cpu/sparc/Makefile.am delete mode 100644 c/src/exec/score/cpu/sparc/README delete mode 100644 c/src/exec/score/cpu/sparc/asm.h delete mode 100644 c/src/exec/score/cpu/sparc/configure.ac delete mode 100644 c/src/exec/score/cpu/sparc/cpu.c delete mode 100644 c/src/exec/score/cpu/sparc/cpu_asm.S delete mode 100644 c/src/exec/score/cpu/sparc/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/sparc/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/sparc/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/sparc/rtems/score/sparc.h delete mode 100644 c/src/exec/score/cpu/sparc/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/unix/.cvsignore delete mode 100644 c/src/exec/score/cpu/unix/ChangeLog delete mode 100644 c/src/exec/score/cpu/unix/Makefile.am delete mode 100644 c/src/exec/score/cpu/unix/configure.ac delete mode 100644 c/src/exec/score/cpu/unix/cpu.c delete mode 100644 c/src/exec/score/cpu/unix/rtems/.cvsignore delete mode 100644 c/src/exec/score/cpu/unix/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/cpu/unix/rtems/score/cpu.h delete mode 100644 c/src/exec/score/cpu/unix/rtems/score/types.h delete mode 100644 c/src/exec/score/cpu/unix/rtems/score/unix.h delete mode 100644 c/src/exec/score/include/.cvsignore delete mode 100644 c/src/exec/score/include/Makefile.am delete mode 100644 c/src/exec/score/include/rtems/.cvsignore delete mode 100644 c/src/exec/score/include/rtems/debug.h delete mode 100644 c/src/exec/score/include/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/include/rtems/score/address.h delete mode 100644 c/src/exec/score/include/rtems/score/apiext.h delete mode 100644 c/src/exec/score/include/rtems/score/apimutex.h delete mode 100644 c/src/exec/score/include/rtems/score/bitfield.h delete mode 100644 c/src/exec/score/include/rtems/score/chain.h delete mode 100644 c/src/exec/score/include/rtems/score/context.h delete mode 100644 c/src/exec/score/include/rtems/score/copyrt.h delete mode 100644 c/src/exec/score/include/rtems/score/coremsg.h delete mode 100644 c/src/exec/score/include/rtems/score/coremutex.h delete mode 100644 c/src/exec/score/include/rtems/score/coresem.h delete mode 100644 c/src/exec/score/include/rtems/score/heap.h delete mode 100644 c/src/exec/score/include/rtems/score/interr.h delete mode 100644 c/src/exec/score/include/rtems/score/isr.h delete mode 100644 c/src/exec/score/include/rtems/score/mpci.h delete mode 100644 c/src/exec/score/include/rtems/score/mppkt.h delete mode 100644 c/src/exec/score/include/rtems/score/object.h delete mode 100644 c/src/exec/score/include/rtems/score/objectmp.h delete mode 100644 c/src/exec/score/include/rtems/score/priority.h delete mode 100644 c/src/exec/score/include/rtems/score/stack.h delete mode 100644 c/src/exec/score/include/rtems/score/states.h delete mode 100644 c/src/exec/score/include/rtems/score/sysstate.h delete mode 100644 c/src/exec/score/include/rtems/score/thread.h delete mode 100644 c/src/exec/score/include/rtems/score/threadmp.h delete mode 100644 c/src/exec/score/include/rtems/score/threadq.h delete mode 100644 c/src/exec/score/include/rtems/score/tod.h delete mode 100644 c/src/exec/score/include/rtems/score/tqdata.h delete mode 100644 c/src/exec/score/include/rtems/score/userext.h delete mode 100644 c/src/exec/score/include/rtems/score/watchdog.h delete mode 100644 c/src/exec/score/include/rtems/score/wkspace.h delete mode 100644 c/src/exec/score/include/rtems/seterr.h delete mode 100644 c/src/exec/score/include/rtems/system.h delete mode 100644 c/src/exec/score/inline/.cvsignore delete mode 100644 c/src/exec/score/inline/Makefile.am delete mode 100644 c/src/exec/score/inline/rtems/.cvsignore delete mode 100644 c/src/exec/score/inline/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/inline/rtems/score/address.inl delete mode 100644 c/src/exec/score/inline/rtems/score/chain.inl delete mode 100644 c/src/exec/score/inline/rtems/score/coremsg.inl delete mode 100644 c/src/exec/score/inline/rtems/score/coremutex.inl delete mode 100644 c/src/exec/score/inline/rtems/score/coresem.inl delete mode 100644 c/src/exec/score/inline/rtems/score/heap.inl delete mode 100644 c/src/exec/score/inline/rtems/score/isr.inl delete mode 100644 c/src/exec/score/inline/rtems/score/mppkt.inl delete mode 100644 c/src/exec/score/inline/rtems/score/object.inl delete mode 100644 c/src/exec/score/inline/rtems/score/objectmp.inl delete mode 100644 c/src/exec/score/inline/rtems/score/priority.inl delete mode 100644 c/src/exec/score/inline/rtems/score/stack.inl delete mode 100644 c/src/exec/score/inline/rtems/score/states.inl delete mode 100644 c/src/exec/score/inline/rtems/score/sysstate.inl delete mode 100644 c/src/exec/score/inline/rtems/score/thread.inl delete mode 100644 c/src/exec/score/inline/rtems/score/threadmp.inl delete mode 100644 c/src/exec/score/inline/rtems/score/tod.inl delete mode 100644 c/src/exec/score/inline/rtems/score/tqdata.inl delete mode 100644 c/src/exec/score/inline/rtems/score/userext.inl delete mode 100644 c/src/exec/score/inline/rtems/score/watchdog.inl delete mode 100644 c/src/exec/score/inline/rtems/score/wkspace.inl delete mode 100644 c/src/exec/score/macros/.cvsignore delete mode 100644 c/src/exec/score/macros/Makefile.am delete mode 100644 c/src/exec/score/macros/README delete mode 100644 c/src/exec/score/macros/rtems/.cvsignore delete mode 100644 c/src/exec/score/macros/rtems/score/.cvsignore delete mode 100644 c/src/exec/score/macros/rtems/score/README delete mode 100644 c/src/exec/score/macros/rtems/score/address.inl delete mode 100644 c/src/exec/score/macros/rtems/score/chain.inl delete mode 100644 c/src/exec/score/macros/rtems/score/coremsg.inl delete mode 100644 c/src/exec/score/macros/rtems/score/coremutex.inl delete mode 100644 c/src/exec/score/macros/rtems/score/coresem.inl delete mode 100644 c/src/exec/score/macros/rtems/score/heap.inl delete mode 100644 c/src/exec/score/macros/rtems/score/isr.inl delete mode 100644 c/src/exec/score/macros/rtems/score/mppkt.inl delete mode 100644 c/src/exec/score/macros/rtems/score/object.inl delete mode 100644 c/src/exec/score/macros/rtems/score/objectmp.inl delete mode 100644 c/src/exec/score/macros/rtems/score/priority.inl delete mode 100644 c/src/exec/score/macros/rtems/score/stack.inl delete mode 100644 c/src/exec/score/macros/rtems/score/states.inl delete mode 100644 c/src/exec/score/macros/rtems/score/sysstate.inl delete mode 100644 c/src/exec/score/macros/rtems/score/thread.inl delete mode 100644 c/src/exec/score/macros/rtems/score/threadmp.inl delete mode 100644 c/src/exec/score/macros/rtems/score/tod.inl delete mode 100644 c/src/exec/score/macros/rtems/score/tqdata.inl delete mode 100644 c/src/exec/score/macros/rtems/score/userext.inl delete mode 100644 c/src/exec/score/macros/rtems/score/watchdog.inl delete mode 100644 c/src/exec/score/macros/rtems/score/wkspace.inl delete mode 100644 c/src/exec/score/src/.cvsignore delete mode 100644 c/src/exec/score/src/Makefile.am delete mode 100644 c/src/exec/score/src/Unlimited.txt delete mode 100644 c/src/exec/score/src/apiext.c delete mode 100644 c/src/exec/score/src/chain.c delete mode 100644 c/src/exec/score/src/coremsg.c delete mode 100644 c/src/exec/score/src/coremsgbroadcast.c delete mode 100644 c/src/exec/score/src/coremsgclose.c delete mode 100644 c/src/exec/score/src/coremsgflush.c delete mode 100644 c/src/exec/score/src/coremsgflushsupp.c delete mode 100644 c/src/exec/score/src/coremsgflushwait.c delete mode 100644 c/src/exec/score/src/coremsginsert.c delete mode 100644 c/src/exec/score/src/coremsgseize.c delete mode 100644 c/src/exec/score/src/coremsgsubmit.c delete mode 100644 c/src/exec/score/src/coremutex.c delete mode 100644 c/src/exec/score/src/coremutexflush.c delete mode 100644 c/src/exec/score/src/coremutexseize.c delete mode 100644 c/src/exec/score/src/coremutexsurrender.c delete mode 100644 c/src/exec/score/src/coresem.c delete mode 100644 c/src/exec/score/src/coresemflush.c delete mode 100644 c/src/exec/score/src/coresemseize.c delete mode 100644 c/src/exec/score/src/coresemsurrender.c delete mode 100644 c/src/exec/score/src/coretod.c delete mode 100644 c/src/exec/score/src/coretodset.c delete mode 100644 c/src/exec/score/src/coretodtickle.c delete mode 100644 c/src/exec/score/src/coretodtoseconds.c delete mode 100644 c/src/exec/score/src/coretodvalidate.c delete mode 100644 c/src/exec/score/src/heap.c delete mode 100644 c/src/exec/score/src/heapallocate.c delete mode 100644 c/src/exec/score/src/heapextend.c delete mode 100644 c/src/exec/score/src/heapfree.c delete mode 100644 c/src/exec/score/src/heapgetinfo.c delete mode 100644 c/src/exec/score/src/heapsizeofuserarea.c delete mode 100644 c/src/exec/score/src/heapwalk.c delete mode 100644 c/src/exec/score/src/interr.c delete mode 100644 c/src/exec/score/src/isr.c delete mode 100644 c/src/exec/score/src/mpci.c delete mode 100644 c/src/exec/score/src/object.c delete mode 100644 c/src/exec/score/src/objectallocate.c delete mode 100644 c/src/exec/score/src/objectallocatebyindex.c delete mode 100644 c/src/exec/score/src/objectclearname.c delete mode 100644 c/src/exec/score/src/objectcomparenameraw.c delete mode 100644 c/src/exec/score/src/objectcomparenamestring.c delete mode 100644 c/src/exec/score/src/objectcopynameraw.c delete mode 100644 c/src/exec/score/src/objectcopynamestring.c delete mode 100644 c/src/exec/score/src/objectextendinformation.c delete mode 100644 c/src/exec/score/src/objectfree.c delete mode 100644 c/src/exec/score/src/objectget.c delete mode 100644 c/src/exec/score/src/objectgetbyindex.c delete mode 100644 c/src/exec/score/src/objectgetisr.c delete mode 100644 c/src/exec/score/src/objectgetnext.c delete mode 100644 c/src/exec/score/src/objectgetnoprotection.c delete mode 100644 c/src/exec/score/src/objectinitializeinformation.c delete mode 100644 c/src/exec/score/src/objectmp.c delete mode 100644 c/src/exec/score/src/objectnametoid.c delete mode 100644 c/src/exec/score/src/objectshrinkinformation.c delete mode 100644 c/src/exec/score/src/thread.c delete mode 100644 c/src/exec/score/src/threadchangepriority.c delete mode 100644 c/src/exec/score/src/threadclearstate.c delete mode 100644 c/src/exec/score/src/threadclose.c delete mode 100644 c/src/exec/score/src/threadcreateidle.c delete mode 100644 c/src/exec/score/src/threaddelayended.c delete mode 100644 c/src/exec/score/src/threaddispatch.c delete mode 100644 c/src/exec/score/src/threadevaluatemode.c delete mode 100644 c/src/exec/score/src/threadget.c delete mode 100644 c/src/exec/score/src/threadhandler.c delete mode 100644 c/src/exec/score/src/threadidlebody.c delete mode 100644 c/src/exec/score/src/threadinitialize.c delete mode 100644 c/src/exec/score/src/threadloadenv.c delete mode 100644 c/src/exec/score/src/threadmp.c delete mode 100644 c/src/exec/score/src/threadq.c delete mode 100644 c/src/exec/score/src/threadqdequeue.c delete mode 100644 c/src/exec/score/src/threadqdequeuefifo.c delete mode 100644 c/src/exec/score/src/threadqdequeuepriority.c delete mode 100644 c/src/exec/score/src/threadqenqueue.c delete mode 100644 c/src/exec/score/src/threadqenqueuefifo.c delete mode 100644 c/src/exec/score/src/threadqenqueuepriority.c delete mode 100644 c/src/exec/score/src/threadqextract.c delete mode 100644 c/src/exec/score/src/threadqextractfifo.c delete mode 100644 c/src/exec/score/src/threadqextractpriority.c delete mode 100644 c/src/exec/score/src/threadqextractwithproxy.c delete mode 100644 c/src/exec/score/src/threadqfirst.c delete mode 100644 c/src/exec/score/src/threadqfirstfifo.c delete mode 100644 c/src/exec/score/src/threadqfirstpriority.c delete mode 100644 c/src/exec/score/src/threadqflush.c delete mode 100644 c/src/exec/score/src/threadqtimeout.c delete mode 100644 c/src/exec/score/src/threadready.c delete mode 100644 c/src/exec/score/src/threadreset.c delete mode 100644 c/src/exec/score/src/threadresettimeslice.c delete mode 100644 c/src/exec/score/src/threadrestart.c delete mode 100644 c/src/exec/score/src/threadresume.c delete mode 100644 c/src/exec/score/src/threadrotatequeue.c delete mode 100644 c/src/exec/score/src/threadsetpriority.c delete mode 100644 c/src/exec/score/src/threadsetstate.c delete mode 100644 c/src/exec/score/src/threadsettransient.c delete mode 100644 c/src/exec/score/src/threadstackallocate.c delete mode 100644 c/src/exec/score/src/threadstackfree.c delete mode 100644 c/src/exec/score/src/threadstart.c delete mode 100644 c/src/exec/score/src/threadstartmultitasking.c delete mode 100644 c/src/exec/score/src/threadsuspend.c delete mode 100644 c/src/exec/score/src/threadtickletimeslice.c delete mode 100644 c/src/exec/score/src/threadyieldprocessor.c delete mode 100644 c/src/exec/score/src/userext.c delete mode 100644 c/src/exec/score/src/watchdog.c delete mode 100644 c/src/exec/score/src/watchdogadjust.c delete mode 100644 c/src/exec/score/src/watchdoginsert.c delete mode 100644 c/src/exec/score/src/watchdogremove.c delete mode 100644 c/src/exec/score/src/watchdogtickle.c delete mode 100644 c/src/exec/score/src/wkspace.c delete mode 100644 c/src/exec/wrapup/.cvsignore delete mode 100644 c/src/exec/wrapup/Makefile.am diff --git a/c/src/exec/.cvsignore b/c/src/exec/.cvsignore deleted file mode 100644 index 62edb16be0..0000000000 --- a/c/src/exec/.cvsignore +++ /dev/null @@ -1,15 +0,0 @@ -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -config.cache -config.guess -config.log -config.status -config.sub -configure -depcomp -install-sh -missing -mkinstalldirs -stamp-h.in diff --git a/c/src/exec/ChangeLog b/c/src/exec/ChangeLog deleted file mode 100644 index c17f70c470..0000000000 --- a/c/src/exec/ChangeLog +++ /dev/null @@ -1,295 +0,0 @@ -2002-07-05 Ralf Corsepius - - * automake/multilib.am: Add install-multi. - * aclocal/rtems-top.m4: Reflect new RTEMS_TOPdir to detecting - version.m4. - Add --with-project-root. - Reflect --with-project-root to setting up PROJECT_ROOT. - * aclocal/env-rtemscpu.m4: Reflect new RTEMS_TOPdir (HACK). - * aclocal/check-cpu.m4: Reflect new RTEMS_TOPdir. - * aclocal/check-bsps.m4: Reflect new RTEMS_TOPdir. - -2002-07-05 Ralf Corsepius - - * configure.ac: RTEMS_TOP(..). - -2002-07-01 Ralf Corsepius - - * wrapup/Makefile.am: Install by using cpulibdir, cpulib_DATA. - -2002-07-01 Ralf Corsepius - - * aclocal/check-bsp-cache.m4: Remove RTEMS_BSP_FAMILY. - -2002-07-01 Ralf Corsepius - - * configure.ac: Remove RTEMS_PROJECT_ROOT. - * aclocal/project-root.m4: Remove. - -2002-07-01 Ralf Corsepius - - * aclocal/enable-multiprocessing.m4: Fix typo. - * aclocal/prog-cc.m4: Remove obsolete comments. - Comment out GCCSED. - -2002-06-27 Ralf Corsepius - - * aclocal/prog-ccas.m4: New. - * aclocal/canonicalize-tools.m4: Remove AS, OBJCOPY, NM, SIZE, STRIP. - RTEMS_GCC_PRINT - * aclocal/check-multiprocessing.m4: Fix typo. - * automake/compile.am: Remove CXX support. - Replace AS by CCAS. Remove LINK_LIBS, LINK_OBJS, LINK_FILES. - -2002-06-27 Ralf Corsepius - - * configure.ac: Use AC_CONFIG_AUX_DIR(..). - -2002-06-26 Ralf Corsepius - - * configure.ac: Remove references to RTEMS_BSP. - * aclocal/check-multiprocessing.m4: Remove references to RTEMS_BSP. - Allow building w/ --enable-multiprocessing --enable-multilib. - * aclocal/enable-multiprocessing.m4: - Eliminate RTEMS_HAS_MULTIPROCESSING. - -2002-06-25 Ralf Corsepius - - * wrapup/Makefile.am: Fix stupid typo in previous patch. - -2002-06-25 Ralf Corsepius - - * configure.ac: Add librpc. AC_PROG_RANLIB. - * wrapup/Makefile.am: Add librpc. - Use relative path to lib*.a for - POSIX_OBJS, ITRON_OBJS, NETWORKING_OBJS. - -2002-06-19 Ralf Corsepius - - * aclocal/subdirs.m4: Remove. - -2002-06-18 Ralf Corsepius - - * wrapup/Makefile.am: Use relative path to lib*.a for - LIBCSUPPORT_OBJS, LIBBLOCK_OBJS, LIBDOSFS_OBJS, LIBIMFS_OBJS. - -2002-06-17 Ralf Corsepius - - * Makefile.am: Include $(top_srcdir)/automake/*.am. - Use aclocal. - * sapi/include/Makefile.am: Include $(top_srcdir)/automake/*.am. - * sapi/Makefile.am: Include $(top_srcdir)/automake/*.am. - * sapi/inline/Makefile.am: Include $(top_srcdir)/automake/*.am. - * sapi/macros/Makefile.am: Include $(top_srcdir)/automake/*.am. - * sapi/src/Makefile.am: Include $(top_srcdir)/automake/*.am. - * score/include/Makefile.am: Include $(top_srcdir)/automake/*.am. - * score/Makefile.am: Include $(top_srcdir)/automake/*.am. - * score/cpu/Makefile.am: Include $(top_srcdir)/automake/*.am. - * score/inline/Makefile.am: Include $(top_srcdir)/automake/*.am. - * score/macros/Makefile.am: Include $(top_srcdir)/automake/*.am. - * score/src/Makefile.am: Include $(top_srcdir)/automake/*.am. - * wrapup/Makefile.am: Include $(top_srcdir)/automake/*.am. - * include/Makefile.am: Include $(top_srcdir)/automake/*.am. - * rtems/include/Makefile.am: Include $(top_srcdir)/automake/*.am. - * rtems/Makefile.am: Include $(top_srcdir)/automake/*.am. - * rtems/inline/Makefile.am: Include $(top_srcdir)/automake/*.am. - * rtems/macros/Makefile.am: Include $(top_srcdir)/automake/*.am. - * rtems/src/Makefile.am: Include $(top_srcdir)/automake/*.am. - -2002-06-17 Ralf Corsepius - - * aclocal/bsp-alias.m4: Copied over from aclocal/. - * aclocal/canonical-host.m4: Ditto. - * aclocal/canonical-target-name.m4: Ditto. - * aclocal/canonicalize-tools.m4: Ditto. - * aclocal/check-bsp-cache.m4: Ditto. - * aclocal/check-bsps.m4: Ditto. - * aclocal/check-cpu.m4: Ditto. - * aclocal/check-itron.m4: Ditto. - * aclocal/check-multiprocessing.m4: Ditto. - * aclocal/check-networking.m4: Ditto. - * aclocal/check-newlib.m4: Ditto. - * aclocal/check-posix.m4: Ditto. - * aclocal/check-tool.m4: Ditto. - * aclocal/enable-bare.m4: Ditto. - * aclocal/enable-inlines.m4: Ditto. - * aclocal/enable-itron.m4: Ditto. - * aclocal/enable-multiprocessing.m4: Ditto. - * aclocal/enable-networking.m4: Ditto. - * aclocal/enable-posix.m4: Ditto. - * aclocal/enable-rtemsbsp.m4: Ditto. - * aclocal/env-rtemsbsp.m4: Ditto. - * aclocal/env-rtemscpu.m4: Ditto. - * aclocal/gcc-pipe.m4: Ditto. - * aclocal/gcc-specs.m4: Ditto. - * aclocal/multi.m4: Ditto. - * aclocal/multilib.m4: Ditto. - * aclocal/prog-cc.m4: Ditto. - * aclocal/project-root.m4: Ditto. - * aclocal/rtems-cpu-subdirs.m4: Ditto. - * aclocal/rtems-debug.m4: Ditto. - * aclocal/rtems-top.m4: Ditto. - * aclocal/subdirs.m4: Ditto. - * aclocal/sysv-ipc.m4: Ditto. - * aclocal/tool-paths.m4: Ditto. - * aclocal/version.m4: Ditto. - -2002-06-15 Ralf Corsepius - - * automake/compile.am: Copied over from automake/. - * automake/lib.am: Copied over from automake/. - * automake/local.am: Copied over from automake/. - * automake/multilib.am: Copied over from automake/. - * automake/subdirs.am: Copied over from automake/. - * Makefile.am: Add automake/*.am. - -2002-05-29 Ralf Corsepius - - * configure.ac: Add libnetworking. - * wrapup/Makefile.am: Ditto. - -2002-05-18 Ralf Corsepius - - * configure.ac: Add libblock. Add libfs. Add AM_CONDITIONAL(UNIX). - * wrapup/Makefile.am: Add libblock, libfs/dosfs, libfs/imfs. - -2002-05-15 Ralf Corsepius - - * configure.ac: Add libcsupport. - * wrapup/Makefile.am: Ditto. - -2002-05-15 Ralf Corsepius - - * Makefile.am: Add preinstall-stamp. - -2002-04-14 Ralf Corsepius - - * configure.ac: Remove ENABLE_GCC28. - -2002-04-06 Ralf Corsepius - - * include/rtems/bspIo.h: Fix cpp-guards, remove references to i386. - -2002-03-27 Ralf Corsepius - - * configure.ac: - AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS). - AM_INIT_AUTOMAKE([no-define foreign 1.6]). - * include/Makefile.am: Remove AUTOMAKE_OPTIONS. - * Makefile.am: Remove AUTOMAKE_OPTIONS. - * wrapup/Makefile.am: Remove AUTOMAKE_OPTIONS. - -2001-01-17 Joel Sherrill - - * ChangeLog: Deleted duplicate blank line. - -2002-01-09 Ralf Corsepius - - * Makefile.am: Apply @subdirs. Remove POSIX_SUBDIRS. Remove - ITRON_SUBDIRS. - * configure.ac: Rework enable_unixlib handling. - Add RTEMS_MULTILIBS to cpuopts.h. - * include/Makefile.am: Add rtems/fs.h, rtems/userenv.h. - Add $(PROJECT_INCLUDE)/rtems. Remove libio_.h. - -2002-01-07 Ralf Corsepius - - * wrapup/Makefile.am: Add install-hook. - Remove SIZE_RTEMS. - * include/rtems/fs.h: New, extracted from libio_.h. - * include/rtems/userenv.h: New. extracted from libio_.h. - -2002-02-05 Ralf Corsepius - - * Makefile.am: Readded reference to wrapup. - -2002-01-06 Joel Sherrill - - * wrapup/.cvsignore: Readded. - * include/.cvsignore: New file. - -2002-01-04 Joel Sherrill - - * Makefile.am, configure.ac: Remove references to wrapup subdirectory. - -2001-12-22 Ralf Corsepius - - * configure.ac: Use AS_IF instead of if/then/else. - Add AC_DEFINE_UNQUOTED(RTEMS_UNIX) for RTEMS_CPU==unix. - Add AC_DEFINE_UNQUOTED(RTEMS_UNIXLIB) for RTEMS_CPU==unix. - Add include/Makefile to CONFIG_FILES. - Add AC_ENABLE_MULITLIB. - Remove wrapup/rtems, wrapup/itron, wrapup/posix. - Remove */optman/Makefile from CONFIG_FILES. - * Makefile.am: Add include to SUBDIRS. - * rtems/Makefile.am: Remove optman from SUBDIRS. - * sapi/Makefile.am: Remove optman from SUBDIRS. - * include/Makefile.am: New file. - * include/rtems/bspIo.h: Relocated from lib/include. - * include/rtems/libio_.h: Relocated from lib/include. - -2001-12-19 Ralf Corsepius - - * wrapup/posix/Makefile.am: Add multilib support. - * wrapup/itron/Makefile.am: Add multilib support. - * wrapup/rtems/Makefile.am: Add multilib support. - * Makefile.am: Add multilib support. - -2001-10-16 Ralf Corsepius - - * configure.ac: Use RTEMS_CPU_SUBDIRS to make autoconf-2.52 happy. - -2001-10-16 Ralf Corsepius - - * configure.ac: Use AC_CONFIG_SUBDIRS for posix and itron. - Reflect changes to configuration of rtems, score and sapi subdirs. - * Makefile.am: require automake-1.5. - -2001-10-11 Ralf Corsepius - - * .cvsignore: Add autom4te.cache for autoconf > 2.52. - * configure.in: Remove. - * configure.ac: New file, generated from configure.in by autoupdate. - -2001-09-22 Ralf Corsepius - - * wrapup/rtems/Makefile.am: Fix comments to make automake-1.5 happy. - -2001-04-27 Ralf Corsepius - - * configure.in: Add [-ansi -fasm] to RTEMS_PROG_CC_FOR_TARGET. - -2001-02-07 Ralf Corsepius - - * configure.in: AC_DEFINE RTEMS_UNIX if RTEMS_CPU=unix. - -2000-12-01 Joel Sherrill - - * configure.in: Removed error check for enabling macros with - either POSIX or ITRON API. - -2000-11-09 Ralf Corsepius - - * Makefile.am: Use ... instead of RTEMS_TOPdir in ACLOCAL_AMFLAGS. - -2000-11-02 Ralf Corsepius - - * Makefile.am: Switch to ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal. - -2000-10-25 Ralf Corsepius - - * Makefile.am: ACLOCAL_AMFLAGS= -I $(RTEMS_TOPdir)/macros. - Switch to GNU canonicalization. - -2000-09-06 Ralf Corsepius - - * wrapup/rtems/Makefile.am: Use PROJECT_TOPdir in path to size_rtems. - -2000-09-04 Ralf Corsepius - - * wrapup/itron/Makefile.am, wrapup/posix/Makefile.am, - wrapup/rtems/Makefile.am: Include compile.am - -2000-08-10 Joel Sherrill - - * ChangeLog: New file. diff --git a/c/src/exec/Makefile.am b/c/src/exec/Makefile.am deleted file mode 100644 index b6f3182430..0000000000 --- a/c/src/exec/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -## -## $Id$ -## - -ACLOCAL_AMFLAGS = -I aclocal - -include $(top_srcdir)/automake/multilib.am - -SUBDIRS = . include score rtems sapi @subdirs@ wrapup - -noinst_DATA = preinstall-stamp - -preinstall-stamp: - $(MAKE) $(AM_MAKEFLAGS) preinstall - touch preinstall-stamp -DISTCLEANFILES = preinstall-stamp - -AUTOMAKE_FILES = automake/compile.am automake/lib.am automake/local.am \ - automake/multilib.am automake/subdirs.am -EXTRA_DIST = $(AUTOMAKE_FILES) - -include $(top_srcdir)/automake/subdirs.am -include $(top_srcdir)/automake/local.am diff --git a/c/src/exec/configure.ac b/c/src/exec/configure.ac deleted file mode 100644 index 53b9e7f4df..0000000000 --- a/c/src/exec/configure.ac +++ /dev/null @@ -1,121 +0,0 @@ -## Process this file with autoconf to produce a configure script. -## -## $Id$ - -AC_PREREQ(2.52) -AC_INIT([rtems-c-src-exec],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com]) -AC_CONFIG_SRCDIR([score]) -RTEMS_TOP(..) -AC_CONFIG_AUX_DIR(..) - -RTEMS_CANONICAL_TARGET_CPU - -AM_INIT_AUTOMAKE([no-define foreign 1.6]) -AM_MAINTAINER_MODE - -RTEMS_ENABLE_MULTILIB -RTEMS_ENABLE_MULTIPROCESSING -RTEMS_ENABLE_POSIX -RTEMS_ENABLE_ITRON -RTEMS_ENABLE_INLINES -RTEMS_ENABLE_RTEMS_DEBUG -RTEMS_ENABLE_NETWORKING - -RTEMS_ENV_RTEMSCPU -RTEMS_CHECK_RTEMS_DEBUG - -RTEMS_CHECK_CPU -RTEMS_CANONICAL_HOST - -RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) -RTEMS_CANONICALIZE_TOOLS -AC_PROG_RANLIB - -RTEMS_CHECK_NEWLIB - -RTEMS_CHECK_MULTIPROCESSING -RTEMS_CHECK_POSIX_API -RTEMS_CHECK_ITRON_API -RTEMS_CHECK_NETWORKING - -# If RTEMS macros are enabled, then use them. Otherwise, use inlines. -AS_IF([test "$RTEMS_USE_MACROS" = "yes"], - [INLINEdir="macros"], - [INLINEdir="inline"]) - -AM_CONDITIONAL(INLINE,test x"$INLINEdir" = x"inline" ) -AM_CONDITIONAL(MACROS,test x"$INLINEdir" = x"macros" ) -AM_CONDITIONAL(HAS_MP,test x"$HAS_MP" = x"yes" ) - -AC_SUBST(RTEMS_VERSION) - -AM_CONDITIONAL(HAS_POSIX,test x"$HAS_POSIX_API" = x"yes") -AM_CONDITIONAL(HAS_ITRON,test x"$HAS_ITRON_API" = x"yes") -AM_CONDITIONAL(HAS_NETWORKING,test x"$HAS_NETWORKING" = x"yes") - -AS_IF([test x"$HAS_POSIX_API" = x"yes"], - [AC_CONFIG_SUBDIRS([posix])] -) -AS_IF([test x"$HAS_ITRON_API" = x"yes"], - [AC_CONFIG_SUBDIRS(itron)] -) -RTEMS_CPU_SUBDIRS([score/cpu]) - -AC_CONFIG_SUBDIRS([libcsupport]) -AC_CONFIG_SUBDIRS([libblock]) -AC_CONFIG_SUBDIRS([libfs]) -AS_IF([test x"$HAS_NETWORKING" = x"yes"], - [AC_CONFIG_SUBDIRS(libnetworking librpc)]) - -RTEMS_DEFINE_POSIX_API -RTEMS_DEFINE_ITRON_API -RTEMS_DEFINE_MULTIPROCESSING - -# HACK: We should use a feature-based configuration. -AS_IF([test x"${RTEMS_CPU}" = x"unix"],[ - AC_DEFINE_UNQUOTED([RTEMS_UNIX],[1],[to indicate RTEMS unix]) -# HACK: silently accept --enable-unixlib - test -n "${enable_unixlib}" || enable_unixlib="yes" -]) - -AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"]) - -AS_IF([test x"${enable_unixlib}" = x"yes"], - [AC_DEFINE_UNQUOTED([RTEMS_UNIXLIB],[1], - [to indicate RTEMS using RTEMS's unixlib])] -) - -AM_CONFIG_HEADER(score/include/rtems/score/cpuopts-tmp.h) - -AC_ENABLE_MULTILIB([Makefile],[..]) - -## HACK: Add a define to cpuopts.h to indicate using multilibs -## Can be applied to produce compiler errors if using -## multilib-incompatible settings somewhere else (eg. bspopts.h). -AS_IF([test x"${enable_multilib}" = x"yes"],[ - AC_DEFINE_UNQUOTED([RTEMS_MULTILIBS],[1],[using multilib'ed RTEMS]) -]) - -# Explicitly list all Makefiles here -AC_CONFIG_FILES([Makefile -include/Makefile -rtems/Makefile -rtems/src/Makefile -rtems/include/Makefile -rtems/inline/Makefile -rtems/macros/Makefile -sapi/Makefile -sapi/src/Makefile -sapi/include/Makefile -sapi/include/rtems/sptables.h -sapi/inline/Makefile -sapi/macros/Makefile -score/Makefile -score/cpu/Makefile -score/include/Makefile -score/inline/Makefile -score/macros/Makefile -score/src/Makefile -wrapup/Makefile -]) -AC_OUTPUT diff --git a/c/src/exec/include/.cvsignore b/c/src/exec/include/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/include/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/include/Makefile.am b/c/src/exec/include/Makefile.am deleted file mode 100644 index c47b90bfa3..0000000000 --- a/c/src/exec/include/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -## -## $Id$ -## - - -$(PROJECT_INCLUDE)/%.h: %.h - $(INSTALL_DATA) $< $@ - -$(PROJECT_INCLUDE): - @$(mkinstalldirs) $@ - -$(PROJECT_INCLUDE)/rtems: - @$(mkinstalldirs) $@ - -PREINSTALL_FILES = $(PROJECT_INCLUDE) \ - $(include_HEADERS:%=$(PROJECT_INCLUDE)/%) - -include_rtemsdir = $(includedir)/rtems -include_rtems_HEADERS = rtems/bspIo.h rtems/userenv.h rtems/fs.h - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems \ - $(include_rtems_HEADERS:%=$(PROJECT_INCLUDE)/%) - -all-local: $(PREINSTALL_FILES) - -include $(top_srcdir)/automake/local.am diff --git a/c/src/exec/include/rtems/bspIo.h b/c/src/exec/include/rtems/bspIo.h deleted file mode 100644 index 0e2cdfb713..0000000000 --- a/c/src/exec/include/rtems/bspIo.h +++ /dev/null @@ -1,37 +0,0 @@ -/* bspIo.h - * - * This include file contains declaration of interface that - * will be provided by the file contained in this directory. - * - * COPYRIGHT (c) 1998 valette@crf.canon.fr - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ -#ifndef _rtems_bspIo_h -#define _rtems_bspIo_h - -/* - * All the functions declared as extern after this comment - * MUST be implemented in each BSP. Using this function, - * this directory contains shared code that export higher level - * functionnality described after the next command. - */ -typedef void (*BSP_output_char_function_type) (char c); -typedef char (*BSP_polling_getchar_function_type) (void); - -extern BSP_output_char_function_type BSP_output_char; -extern BSP_polling_getchar_function_type BSP_poll_char; - -/* - * All the function declared as extern after this comment - * are available for each BSP by compiling and linking - * the files contained in this directory PROVIDED definition - * and initialisation of the previous variable are done. - */ -extern void printk(char *fmt, ...); - -#endif diff --git a/c/src/exec/include/rtems/fs.h b/c/src/exec/include/rtems/fs.h deleted file mode 100644 index 1749e4d95e..0000000000 --- a/c/src/exec/include/rtems/fs.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Some basic filesystem types - * - * 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_fstypes_h -#define __rtems_fstypes_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * File descriptor Table Information - */ - -/* Forward declarations */ - -/* FIXME: shouldn't this better not be here? */ -typedef struct rtems_libio_tt rtems_libio_t; - -typedef struct rtems_filesystem_location_info_tt - rtems_filesystem_location_info_t; - -struct rtems_filesystem_mount_table_entry_tt; -typedef struct rtems_filesystem_mount_table_entry_tt - rtems_filesystem_mount_table_entry_t; - -typedef struct _rtems_filesystem_file_handlers_r - rtems_filesystem_file_handlers_r; -typedef struct _rtems_filesystem_operations_table - rtems_filesystem_operations_table; - -/* - * 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; -}; - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/exec/include/rtems/libio_.h b/c/src/exec/include/rtems/libio_.h deleted file mode 100644 index f0721dafb6..0000000000 --- a/c/src/exec/include/rtems/libio_.h +++ /dev/null @@ -1,310 +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 /* assoc.h not included by rtems.h */ - -#include - -#include /* O_RDONLY, et.al. */ -#include /* O_RDONLY, et.al. */ -#include -#include -#include -#include - -#if ! defined(O_NDELAY) -# if defined(solaris2) -# define O_NDELAY O_NONBLOCK -# elif defined(RTEMS_NEWLIB) -# define O_NDELAY _FNBIO -# endif -#endif - -#if !defined(ENOTSUP) -#define ENOTSUP EOPNOTSUPP -#endif - -#include -#include /* strcmp */ -#include -#include /* calloc() */ - -/* - * 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; - -/* - * set_errno_and_return_minus_one - * - * Macro to ease common way to return an error. - */ - -#ifndef set_errno_and_return_minus_one -#define set_errno_and_return_minus_one( _error ) \ - do { errno = (_error); return -1; } while(0) -#endif - -/* - * 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) { \ - 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 - */ -#if !defined(LOGIN_NAME_MAX) -#if defined(__linux__) -#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX -#else -#error "don't know how to set LOGIN_NAME_MAX" -#endif -#endif - -typedef struct { - rtems_id task_id; - rtems_filesystem_location_info_t current_directory; - rtems_filesystem_location_info_t root_directory; - /* Default mode for all files. */ - mode_t umask; - nlink_t link_counts; - /* _POSIX_types */ - uid_t uid; - gid_t gid; - uid_t euid; - gid_t egid; - char login_buffer[LOGIN_NAME_MAX]; - - pid_t pgrp; /* process group id */ -} rtems_user_env_t; - -extern rtems_user_env_t * rtems_current_user_env; -extern rtems_user_env_t rtems_global_user_env; - -#define rtems_filesystem_current (rtems_current_user_env->current_directory) -#define rtems_filesystem_root (rtems_current_user_env->root_directory) -#define rtems_filesystem_link_counts (rtems_current_user_env->link_counts) -#define rtems_filesystem_umask (rtems_current_user_env->umask) - -#define _POSIX_types_Uid (rtems_current_user_env->uid) -#define _POSIX_types_Gid (rtems_current_user_env->gid) -#define _POSIX_types_Euid (rtems_current_user_env->euid) -#define _POSIX_types_Egid (rtems_current_user_env->egid) -#define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer) - - -/* - * 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/exec/include/rtems/userenv.h b/c/src/exec/include/rtems/userenv.h deleted file mode 100644 index d86abd7e3d..0000000000 --- a/c/src/exec/include/rtems/userenv.h +++ /dev/null @@ -1,79 +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_userenv_h -#define __rtems_userenv_h - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * External structures - */ -#if !defined(LOGIN_NAME_MAX) -#if defined(__linux__) -#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX -#else -#error "don't know how to set LOGIN_NAME_MAX" -#endif -#endif - -typedef struct { - rtems_id task_id; - rtems_filesystem_location_info_t current_directory; - rtems_filesystem_location_info_t root_directory; - /* Default mode for all files. */ - mode_t umask; - nlink_t link_counts; - /* _POSIX_types */ - uid_t uid; - gid_t gid; - uid_t euid; - gid_t egid; - char login_buffer[LOGIN_NAME_MAX]; - - pid_t pgrp; /* process group id */ -} rtems_user_env_t; - -extern rtems_user_env_t * rtems_current_user_env; -extern rtems_user_env_t rtems_global_user_env; - -#define rtems_filesystem_current (rtems_current_user_env->current_directory) -#define rtems_filesystem_root (rtems_current_user_env->root_directory) -#define rtems_filesystem_link_counts (rtems_current_user_env->link_counts) -#define rtems_filesystem_umask (rtems_current_user_env->umask) - -#define _POSIX_types_Uid (rtems_current_user_env->uid) -#define _POSIX_types_Gid (rtems_current_user_env->gid) -#define _POSIX_types_Euid (rtems_current_user_env->euid) -#define _POSIX_types_Egid (rtems_current_user_env->egid) -#define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer) - - -/* - * 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) ; - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/exec/itron/.cvsignore b/c/src/exec/itron/.cvsignore deleted file mode 100644 index d29e5050f5..0000000000 --- a/c/src/exec/itron/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -config.cache -config.guess -config.log -config.status -config.sub -configure -depcomp -install-sh -missing -mkinstalldirs diff --git a/c/src/exec/itron/ChangeLog b/c/src/exec/itron/ChangeLog deleted file mode 100644 index 10fa8d6a65..0000000000 --- a/c/src/exec/itron/ChangeLog +++ /dev/null @@ -1,167 +0,0 @@ -2002-07-05 Ralf Corsepius - - * configure.ac: RTEMS_TOP(../..). - -2002-07-01 Joel Sherrill - - * Mega patch merge to change the format of the object IDs to - loosen the dependency between the SCORE and the various APIs. - There was considerable work to simplify the object name management - and it appears that the name_table field is no longer needed. - This patch also includes the addition of the internal mutex - which is currently only used to protect some types of allocation - and deallocation. This significantly can reduce context - switch latency under certain circumstances. In particular, - some heap/region operations were O(n) and had dispatching - disabled. This should help enormously. With this merge, - the patch is not as clean as it should be. In particular, - the documentation has not been modified to reflect the new object - ID layout, the IDs in the test screens are not updated, and - _Objects_Get_information needs to be a real routine not inlined. - As part of this patch a lot of MP code for thread/proxy blocking - was made conditional and cleaned up. - * src/cre_mbf.c, src/cre_sem.c, src/eventflags.c, src/fmempool.c, - src/itronsem.c, src/mbox.c, src/msgbuffer.c, src/port.c, src/task.c, - src/vmempool.c: Modified as part of above. -2002-07-01 Ralf Corsepius - - * configure.ac: Remove RTEMS_PROJECT_ROOT. - -2002-06-27 Ralf Corsepius - - * configure.ac: Use AC_CONFIG_AUX_DIR(../..). - Add AC_PROG_RANLIB. - -2002-06-26 Ralf Corsepius - - * configure.ac: Remove references to RTEMS_BSP. - * src/Makefile.am: Add libitron.a. - -2002-06-17 Ralf Corsepius - - * include/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * Makefile.am: Include $(top_srcdir)/../automake/*.am. - Use ../aclocal. - * inline/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * macros/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * src/Makefile.am: Include $(top_srcdir)/../automake/*.am. - -2001-04-22 Joel Sherrill - - * src/task.c (_ITRON_Task_User_extensions): Add new fields to - be correct in respect to newly added fields for separate switch list. - -2002-03-27 Ralf Corsepius - - * configure.ac: - AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS). - AM_INIT_AUTOMAKE([no-define foreign 1.6]). - * include/Makefile.am: Remove AUTOMAKE_OPTIONS. - * Makefile.am: Remove AUTOMAKE_OPTIONS. - * inline/Makefile.am: Remove AUTOMAKE_OPTIONS. - * macros/Makefile.am: Remove AUTOMAKE_OPTIONS. - * src/Makefile.am: Remove AUTOMAKE_OPTIONS. - -2001-12-19 Ralf Corsepius - - * src/Makefile.am: Add multilib support. - -2001-11-07 Joel Sherrill - - Discovered while fixing PR36 reported by Todor.Todorov@barco.com. - * include/rtems/itron/object.h: Corrected _ITRON_Objects_Get() - to use _Objects_Get_by_index(). - -2001-10-16 Ralf Corsepius - - * include/itronsys/Makefile.am: Remove. - * include/rtems/Makefile.am: Remove. - * include/rtems/itron/Makefile.am: Remove. - * inline/rtems/Makefile.am: Remove. - * inline/rtems/itron/Makefile.am: Remove. - * macros/rtems/Makefile.am: Remove. - * macros/rtems/itron/Makefile.am: Remove. - * include/Makefile.am: handle subdirs. - * inline/Makefile.am: handle subdirs. - * macros/Makefile.am: handle subdirs. - * configure.ac: Reflect changes above. - -2001-10-11 Ralf Corsepius - - * .cvsignore: Add autom4te.cache for autoconf > 2.52. - * configure.in: Remove. - * configure.ac: New file, generated from configure.in by autoupdate. - -2001-09-23 Ralf Corsepius - - * include/itronsys/Makefile.am: Use 'PREINSTALL_FILES ='. - * include/rtems/itron/Makefile.am: Use 'PREINSTALL_FILES ='. - * include/Makefile.am: Use 'PREINSTALL_FILES ='. - * inline/rtems/itron/Makefile.am: Use 'PREINSTALL_FILES ='. - * macros/rtems/itron/Makefile.am: Use 'PREINSTALL_FILES ='. - -2001-09-22 Ralf Corsepius - - * src/Makefile.am: Revamp INCLUDES handling to make automake-1.5 - happy. - -2001-08-09 Joel Sherrill - - * src/snd_mbx.c, src/tsnd_mbf.c: Unblocking message queue operations - should NOT use _Thread_Executing for return status since it is - permissible to invoke message send operations from an ISR. This was - reported by Suvrat Gupta . - -2001-04-27 Ralf Corsepius - - * configure.in: Add [-ansi -fasm] to RTEMS_PROG_CC_FOR_TARGET. - -2001-02-03 Ralf Corsepius - - * include/Makefile.am, include/itronsys/Makefile.am, - include/rtems/itron/Makefile.am, inline/rtems/itron/Makefile.am, - macros/rtems/itron/Makefile.am: - Apply include_*HEADERS instead of H_FILES. - -2001-01-06 Ralf Corsepius - - * configure.in: Add src/config.h - * src/Makefile.am: Add INCLUDES += -I. to pickup config.h - * src/.cvsignore: Add config.h and stamp-h - * src/*.c: Add config.h support. - -2000-12-01 Joel Sherrill - - * Added macro support to ITRON API. This is known to compile. - * Makefile.am: Added macros directory. - * configure.in: Removed error check for enabling macros. - * macros/.cvsignore, macros/Makefile.am, - macros/rtems/.cvsignore, macros/rtems/Makefile.am, - macros/rtems/itron/.cvsignore, macros/rtems/itron/Makefile.am, - macros/rtems/itron/eventflags.inl, macros/rtems/itron/fmempool.inl, - macros/rtems/itron/intr.inl, macros/rtems/itron/mbox.inl, - macros/rtems/itron/msgbuffer.inl, macros/rtems/itron/network.inl, - macros/rtems/itron/port.inl, macros/rtems/itron/semaphore.inl, - macros/rtems/itron/sysmgmt.inl, macros/rtems/itron/task.inl, - macros/rtems/itron/time.inl, macros/rtems/itron/vmempool.inl: New files. - -2000-11-09 Ralf Corsepius - - * Makefile.am: Use ... instead of RTEMS_TOPdir in ACLOCAL_AMFLAGS. - -2000-11-02 Ralf Corsepius - - * Makefile.am: Switch to ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal. - -2000-10-25 Ralf Corsepius - - * Makefile.am: ACLOCAL_AMFLAGS= -I $(RTEMS_TOPdir)/macros. - Switch to GNU canonicalization. - -2000-09-04 Ralf Corsepius - - * src/Makefile.am: Include compile.am. - -2000-08-10 Joel Sherrill - - * ChangeLog: New file. diff --git a/c/src/exec/itron/Makefile.am b/c/src/exec/itron/Makefile.am deleted file mode 100644 index e76b696b26..0000000000 --- a/c/src/exec/itron/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -## -## $Id$ -## - -ACLOCAL_AMFLAGS = -I ../aclocal - -SUBDIRS = include inline macros src - -include $(top_srcdir)/../automake/subdirs.am -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/itron/configure.ac b/c/src/exec/itron/configure.ac deleted file mode 100644 index cb2c152566..0000000000 --- a/c/src/exec/itron/configure.ac +++ /dev/null @@ -1,55 +0,0 @@ -## Process this file with autoconf to produce a configure script. -## -## $Id$ - -AC_PREREQ(2.52) -AC_INIT([rtems-c-src-exec-itron],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com]) -AC_CONFIG_SRCDIR([include/itronsys]) -RTEMS_TOP(../..) -AC_CONFIG_AUX_DIR(../..) - -RTEMS_CANONICAL_TARGET_CPU - -AM_INIT_AUTOMAKE([no-define foreign 1.6]) -AM_MAINTAINER_MODE - -RTEMS_ENABLE_ITRON -RTEMS_ENABLE_INLINES - -RTEMS_ENV_RTEMSCPU - -RTEMS_CHECK_CPU -RTEMS_CANONICAL_HOST - -RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) -RTEMS_CANONICALIZE_TOOLS -AC_PROG_RANLIB - -RTEMS_CHECK_ITRON_API - -# If RTEMS macros are enabled, then use them. Otherwise, use inlines. -if test "$RTEMS_USE_MACROS" = "yes"; then - INLINEdir="macros" -else - INLINEdir="inline" -fi -AM_CONDITIONAL(INLINE,test "$INLINEdir" = "inline" ) -AM_CONDITIONAL(MACROS,test "$INLINEdir" = "macros" ) - -## Needed when using automake for libs/rels -RTEMS_CHECK_NEWLIB - -AM_CONFIG_HEADER(src/config.h) - -## -## FIXME: We configure and build the macros subdirectory, too. -## Should probably use AM_CONDITIONALs to disable them in future -# Explicitly list all Makefiles here -AC_CONFIG_FILES([Makefile -src/Makefile -include/Makefile -inline/Makefile -macros/Makefile -]) -AC_OUTPUT - diff --git a/c/src/exec/itron/include/.cvsignore b/c/src/exec/itron/include/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/include/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/include/Makefile.am b/c/src/exec/itron/include/Makefile.am deleted file mode 100644 index 4d6f968519..0000000000 --- a/c/src/exec/itron/include/Makefile.am +++ /dev/null @@ -1,55 +0,0 @@ -## -## $Id$ -## - - -$(PROJECT_INCLUDE): - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/itronsys: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/rtems/itron: - @$(mkinstalldirs) $@ - -$(PROJECT_INCLUDE)/%: % - $(INSTALL_DATA) $< $@ - -## include - -include_HEADERS = itron.h - -PREINSTALL_FILES = $(PROJECT_INCLUDE) \ - $(include_HEADERS:%=$(PROJECT_INCLUDE)/%) - -## itronsys - -include_itronsysdir = $(includedir)/itronsys - -include_itronsys_HEADERS = itronsys/eventflags.h itronsys/fmempool.h \ - itronsys/intr.h itronsys/mbox.h itronsys/msgbuffer.h itronsys/network.h \ - itronsys/port.h itronsys/semaphore.h itronsys/status.h itronsys/sysmgmt.h \ - itronsys/task.h itronsys/time.h itronsys/types.h itronsys/vmempool.h - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/itronsys \ - $(include_itronsys_HEADERS:%=$(PROJECT_INCLUDE)/%) - -EXTRA_DIST = itronsys/README - -## rtems/itron -include_rtems_itrondir = $(includedir)/rtems/itron - -include_rtems_itron_HEADERS = rtems/itron/config.h rtems/itron/eventflags.h \ - rtems/itron/fmempool.h rtems/itron/intr.h rtems/itron/itronapi.h \ - rtems/itron/mbox.h rtems/itron/msgbuffer.h rtems/itron/network.h \ - rtems/itron/object.h rtems/itron/port.h rtems/itron/semaphore.h \ - rtems/itron/sysmgmt.h rtems/itron/task.h rtems/itron/time.h \ - rtems/itron/vmempool.h - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/itron \ - $(include_rtems_itron_HEADERS:%=$(PROJECT_INCLUDE)/%) - -EXTRA_DIST += rtems/itron/README - -## General -all-local: $(PREINSTALL_FILES) - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/itron/include/itron.h b/c/src/exec/itron/include/itron.h deleted file mode 100644 index 445042e1d3..0000000000 --- a/c/src/exec/itron/include/itron.h +++ /dev/null @@ -1,52 +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$ - */ - -#ifndef __ITRON_h_ -#define __ITRON_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Include the basic requirements - */ - -#include /* basic RTEMS types defined by */ - /* each port */ -#include /* define all the TRON types */ - /* in terms of the RTEMS base types */ -#include /* define all ITRON status codes */ - -/* - * Now include the per manager include files - */ - -#include -#include -#include -#include -#include -#include /* network depends on this file */ -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/.cvsignore b/c/src/exec/itron/include/itronsys/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/include/itronsys/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/include/itronsys/README b/c/src/exec/itron/include/itronsys/README deleted file mode 100644 index 8191ad3c5f..0000000000 --- a/c/src/exec/itron/include/itronsys/README +++ /dev/null @@ -1,9 +0,0 @@ -# -# $Id$ -# - -This directory contains the public interface of each manager. -Each file in this directory is included from . - -The private header file for each ITRON manager is in -../rtems/itron. \ No newline at end of file diff --git a/c/src/exec/itron/include/itronsys/eventflags.h b/c/src/exec/itron/include/itronsys/eventflags.h deleted file mode 100644 index 1e0c7ac3b6..0000000000 --- a/c/src/exec/itron/include/itronsys/eventflags.h +++ /dev/null @@ -1,146 +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$ - */ - -#ifndef __ITRON_EVENTFLAGS_h_ -#define __ITRON_EVENTFLAGS_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Create Eventflags (cre_flg) Structure - */ - -typedef struct t_cflg { - VP exinf; /* extended information */ - ATR flgatr; /* eventflag attribute */ - UINT iflgptn; /* initial eventflag */ - /* additional information may be included depending on the implementation */ -} T_CFLG; - -/* - * flgatr - */ - -#define TA_WSGL 0x00 /* multiple tasks are not allowed to wait (Wait - Single Task) */ -#define TA_WMUL 0x08 /* multiple tasks are allowed to wait (Wait - Multiple Task) */ - -/* - * wfmode - */ - -#define TWF_ANDW 0x00 /* AND wait */ -#define TWF_ORW 0x02 /* OR wait */ -#define TWF_CLR 0x01 /* clear specification */ - -/* - * Reference Eventflags (ref_flg) Structure - */ - -typedef struct t_rflg { - VP exinf; /* extended information */ - BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ - UINT flgptn; /* eventflag bit pattern */ - /* additional information may be included depending on the implementation */ -} T_RFLG; - -/* - * Eventflag Functions - */ - -/* - * cre_flg - Create Eventflag - */ - -ER cre_flg( - ID flgid, - T_CFLG *pk_cflg -); - -/* - * del_flg - Delete Eventflag - */ - -ER del_flg( - ID flgid -); - -/* - * set_flg - Set Eventflag - */ - -ER set_flg( - ID flgid, - UINT setptn -); - -/* - * clr_flg - Clear Eventflag - */ - -ER clr_flg( - ID flgid, - UINT clrptn -); - -/* - * wai_flg - Wait on Eventflag - */ - -ER wai_flg( - UINT *p_flgptn, - ID flgid, - UINT waiptn, - UINT wfmode -); - -/* - * pol_flg - Wait for Eventflag(Polling) - */ - -ER pol_flg( - UINT *p_flgptn, - ID flgid, - UINT waiptn, - UINT wfmode -); - -/* - * twai_flg - Wait on Eventflag with Timeout - */ - -ER twai_flg( - UINT *p_flgptn, - ID flgid, - UINT waiptn, - UINT wfmode, - TMO tmout -); - -/* - * ref_flg - Reference Eventflag Status - */ - -ER ref_flg( - T_RFLG *pk_rflg, - ID flgid -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/fmempool.h b/c/src/exec/itron/include/itronsys/fmempool.h deleted file mode 100644 index 4f63d9ba5d..0000000000 --- a/c/src/exec/itron/include/itronsys/fmempool.h +++ /dev/null @@ -1,125 +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$ - */ - -#ifndef __ITRON_FIXED_MEMORYPOOL_h_ -#define __ITRON_FIXED_MEMORYPOOL_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Create Fixed Memory Pool (cre_mpf) Structure - */ - - /* cre_mpf */ -typedef struct t_cmpf { - VP exinf; /* extended information */ - ATR mpfatr; /* memorypool attributes */ - INT mpfcnt; /* block count for entire memorypool */ - INT blfsz; /* fixed-size memory block size */ - /* additional information may be included depending on the implementation */ -} T_CMPF; - -/* - * mpfatr - */ - -#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ -#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ - - -/* - * Reference Fixed Memory Pool (ref_mpf) Structure - */ - - /* ref_mpf */ -typedef struct t_rmpf { - VP exinf; /* extended information */ - BOOL_ID wtsk; /* indicates whether or not there are waiting tasks */ - INT frbcnt; /* free block count */ - /* additional information may be included depending on the implementation */ -} T_RMPF; - -/* - * Fixed Memory Pool Functions - */ - -/* - * cre_mpf - Create Fixed-Size Memorypool - */ - -ER cre_mpf( - ID mpfid, - T_CMPF *pk_cmpf -); - -/* - * del_mpf - Delete Fixed-Size Memorypool - */ - -ER del_mpf( - ID mpfid -); - -/* - * get_blf - Get Fixed-Size Memory Block - */ - -ER get_blf( - VP *p_blf, - ID mpfid -); - -/* - * pget_blf - Poll and Get Fixed-Size Memory Block - */ - -ER pget_blf( - VP *p_blf, - ID mpfid -); - -/* - * tget_blf - Get Fixed-Size Memory Block with Timeout - */ - -ER tget_blf( - VP *p_blf, - ID mpfid, - TMO tmout -); - -/* - * rel_blf - Release Fixed-Size Memory Block - */ - -ER rel_blf( - ID mpfid, - VP blf -); - -/* - * ref_mpf - Reference Fixed-Size Memorypool Status - */ - -ER ref_mpf( - T_RMPF *pk_rmpf, - ID mpfid -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/intr.h b/c/src/exec/itron/include/itronsys/intr.h deleted file mode 100644 index c42987313e..0000000000 --- a/c/src/exec/itron/include/itronsys/intr.h +++ /dev/null @@ -1,106 +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$ - */ - -#ifndef __ITRON_INTERRUPT_h_ -#define __ITRON_INTERRUPT_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Define Interrupt (def_int) Structure - */ - -typedef struct t_dint { - ATR intatr; /* interrupt handler attributes */ - FP inthdr; /* interrupt handler address */ - /* additional information may be included depending on the implementation */ -} T_DINT; - -/* - * Interrupt Functions - */ - -/* - * def_int - Define Interrupt Handler - */ - -ER def_int( - UINT dintno, - T_DINT *pk_dint -); - -/* - * ret_int - Return from Interrupt Handler - */ - -void ret_int( void ); - -/* - * ret_wup - Return and Wakeup Task - */ - -void ret_wup( - ID tskid -); - -/* - * loc_cpu - Lock CPU - */ - -ER loc_cpu( void ); - -/* - * unl_cpu - Unlock CPU - */ - -ER unl_cpu( void ); - -/* - * dis_int - Disable Interrupt - */ - -ER dis_int( - UINT eintno -); - -/* - * ena_int - Enable Interrupt - */ - -ER ena_int( - UINT eintno -); - -/* - * chg_iXX - Change Interrupt Mask(Level or Priority) - */ - -ER chg_iXX( - UINT iXXXX -); - -/* - * ref_iXX - Reference Interrupt Mask(Level or Priority) - */ - -ER ref_iXX( - UINT *p_iXXXX -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/mbox.h b/c/src/exec/itron/include/itronsys/mbox.h deleted file mode 100644 index 7e741d1ba5..0000000000 --- a/c/src/exec/itron/include/itronsys/mbox.h +++ /dev/null @@ -1,138 +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$ - */ - -#ifndef __ITRON_MBOX_h_ -#define __ITRON_MBOX_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Create Mailbox (cre_mbx) Structure - */ - -typedef struct t_cmbx { - VP exinf; /* extended information */ - ATR mbxatr; /* mailbox attributes */ - /* Following is implementation-dependent function */ - INT bufcnt; /* maximum number of messages to let pend */ - /* additional information may be included depending on the implementation */ -} T_CMBX; - -/* - * mbxatr - */ - -#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ -#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ -#define TA_MFIFO 0x00 /* messages are handled by FIFO */ -#define TA_MPRI 0x02 /* messages are handled by priority */ - -typedef struct t_msg { - /* - * A region (header) reserved by the OS may be included first - * depending on the implementation. - * - * NOTE: The first two fields are RTEMS specific. - */ - - INT msgpri; /* priority of each message */ - /* VB msgcont[]; XXX */ - unsigned8 msgcont[1]; -} T_MSG; - -/* - * Reference Mailbox (ref_mbx) Structure - */ - -typedef struct t_rmbx { - VP exinf; /* extended information */ - BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ - T_MSG *pk_msg; /* message to be sent next */ - /* additional information may be included depending on the implementation */ -} T_RMBX; - -/* - * Mailbox Functions - */ - -/* - * cre_mbx - Create Mailbox - */ - -ER cre_mbx( - ID mbxid, - T_CMBX *pk_cmbx -); - -/* - * del_mbx - Delete Mailbox - */ - -ER del_mbx( - ID mbxid -); - -/* - * snd_msg - Send Message to Mailbox - */ - -ER snd_msg( - ID mbxid, - T_MSG *pk_msg -); - -/* - * rcv_msg - Receive Message from Mailbox - */ - -ER rcv_msg( - T_MSG **ppk_msg, - ID mbxid -); - -/* - * prcv_msg - Poll and Receive Message from Mailbox - */ - -ER prcv_msg( - T_MSG **ppk_msg, - ID mbxid -); - -/* - * trcv_msg - Receive Message from Mailbox with Timeout - */ - -ER trcv_msg( - T_MSG **ppk_msg, - ID mbxid, - TMO tmout -); - -/* - * ref_mbx - Reference Mailbox Status - */ - -ER ref_mbx( - T_RMBX *pk_rmbx, - ID mbxid -); - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/msgbuffer.h b/c/src/exec/itron/include/itronsys/msgbuffer.h deleted file mode 100644 index 7b58a63924..0000000000 --- a/c/src/exec/itron/include/itronsys/msgbuffer.h +++ /dev/null @@ -1,160 +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$ - */ - -#ifndef __ITRON_MESSAGEBUFFER_h_ -#define __ITRON_MESSAGEBUFFER_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Create Message Buffer (cre_mbf) Structure - */ - -typedef struct t_cmbf { - VP exinf; /* extended information */ - ATR mbfatr; /* messagebuffer attributes */ - INT bufsz; /* messagebuffer size */ - INT maxmsz; /* maximum size of messages */ - /* additional information may be included depending on the implementation */ -} T_CMBF; - -/* - * mbfatr - */ - -#define TA_TFIFO 0x00 /* tasks waiting to receive messages are handled - by FIFO */ -#define TA_TPRI 0x01 /* tasks waiting to receive messages are handled - by priority */ - -/* - * mbfid - */ - -#define TMBF_OS (-4) /* messagebuffer used for OS error log */ -#define TMBF_DB (-3) /* messagebuffer used for debugging */ - -/* - * Reference Message Buffer (ref_mbf) Structure - */ - -typedef struct t_rmbf { - VP exinf; /* extended information */ - BOOL_ID wtsk; /* indicates whether or not there is a */ - /* task waiting to receive a message */ - BOOL_ID stsk; /* indicates whether or not there is a */ - /* task waiting to send a message */ - INT msgsz; /* size of message to be sent next */ - INT frbufsz; /* size of free buffer */ - /* additional information may be included depending on the implementation */ -} T_RMBF; - -/* - * Message Buffer Functions - */ - -/* - * cre_mbf - Create MessageBuffer - */ - -ER cre_mbf( - ID mbfid, - T_CMBF *pk_cmbf -); - -/* - * del_mbf - Delete MessageBuffer - */ - -ER del_mbf( - ID mbfid -); - -/* - * snd_mbf - Send Message to MessageBuffer - */ - -ER snd_mbf( - ID mbfid, - VP msg, - INT msgsz -); - -/* - * psnd_mbf - Poll and Send Message to MessageBuffer - */ - -ER psnd_mbf( - ID mbfid, - VP msg, - INT msgsz -); - -/* - * tsnd_mbf - Send Message to MessageBuffer with Timeout - */ - -ER tsnd_mbf( - ID mbfid, - VP msg, - INT msgsz, - TMO tmout -); - -/* - * rcv_mbf - Receive Message from MessageBuffer - */ - -ER rcv_mbf( - VP msg, - INT *p_msgsz, - ID mbfid -); - -/* - * prcv_mbf - Poll and Receive Message from MessageBuffer - */ - -ER prcv_mbf( - VP msg, - INT *p_msgsz, - ID mbfid -); - -/* - * trcv_mbf - Receive Message from MessageBuffer with Timeout - */ - -ER trcv_mbf( - VP msg, - INT *p_msgsz, - ID mbfid, - TMO tmout -); - -/* - * ref_mbf - Reference MessageBuffer Status - */ - -ER ref_mbf( - T_RMBF *pk_rmbf, - ID mbfid -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/network.h b/c/src/exec/itron/include/itronsys/network.h deleted file mode 100644 index 394d381eb7..0000000000 --- a/c/src/exec/itron/include/itronsys/network.h +++ /dev/null @@ -1,78 +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$ - */ - -#ifndef __ITRON_NETWORK_h_ -#define __ITRON_NETWORK_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * NODE srcnode, dstnode, nod: - */ - -#define TND_SELF 0 /* specifies the local node */ -#define TND_OTHR (-1) /* specifies default remote node */ - -/* - * Network Functions - */ - -/* - * nrea_dat - Read Data from another Node - */ - -ER nrea_dat( - INT *p_reasz, - VP dstadr, - NODE srcnode, - VP srcadr, - INT datsz -); - -/* - * nwri_dat - Write Data to another Node - */ - -ER nwri_dat( - INT *p_wrisz, - NODE dstnode, - VP dstadr, - VP srcadr, - INT datsz -); - -/* - * nget_nod - Get Local Node Number - */ - -ER nget_nod( - NODE *p_node -); - -/* - * nget_ver - Get Version Information of another Node - */ - -ER nget_ver( - T_VER *pk_ver, - NODE node -); - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/port.h b/c/src/exec/itron/include/itronsys/port.h deleted file mode 100644 index 3999678eaa..0000000000 --- a/c/src/exec/itron/include/itronsys/port.h +++ /dev/null @@ -1,190 +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$ - */ - -#ifndef __ITRON_PORT_h_ -#define __ITRON_PORT_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Create Port (cre_por) Structure - */ - -typedef struct t_cpor { - VP exinf; /* extended information */ - ATR poratr; /* port attributes */ - INT maxcmsz; /* maximum call message size */ - INT maxrmsz; /* maximum reply message size */ - /* additional information may be included depending on the implementation */ -} T_CPOR; - -/* - * poratr - */ - -#define TA_NULL 0 /* specifies no particular attributes */ - -/* - * TA_NULL should be used in place of zeroes to turn off all - * attribute features. - */ - -/* - * Reference Port (ref_por) Structure - */ - -typedef struct t_rpor { - VP exinf; /* extended information */ - BOOL_ID wtsk; /* indicates whether or not there is a task */ - /* waiting to call a rendezvous */ - BOOL_ID atsk; /* indicates whether or not there is a task */ - /* waiting to accept a rendezvous */ - /* additional information may be included depending on the implementation */ -} T_RPOR; - -/* - * Port Functions - */ - -/* - * cre_por - Create Port for Rendezvous - */ - -ER cre_por( - ID porid, - T_CPOR *pk_cpor -); - -/* - * del_por - Delete Port for Rendezvous - */ - -ER del_por( - ID porid -); - -/* - * cal_por - Call Port for Rendezvous Poll - */ - -ER cal_por( - VP msg, - INT *p_rmsgsz, - ID porid, - UINT calptn, - INT cmsgsz -); - -/* - * pcal_por - Poll and Call Port for Rendezvous - */ - -ER pcal_por( - VP msg, - INT *p_rmsgsz, - ID porid, - UINT calptn, - INT cmsgsz -); - -/* - * tcal_por - Call Port for Rendezvous with Timeout - */ - -ER tcal_por( - VP msg, - INT *p_rmsgsz, - ID porid, - UINT calptn, - INT cmsgsz, - TMO tmout -); - -/* - * acp_por - Accept Port for Rendezvous Poll - */ - -ER acp_por( - RNO *p_rdvno, - VP msg, - INT *p_cmsgsz, - ID porid, - UINT acpptn -); - -/* - * pacp_por - Poll and Accept Port for Rendezvous - */ - -ER pacp_por( - RNO *p_rdvno, - VP msg, - INT *p_cmsgsz, - ID porid, - UINT acpptn -); - -/* - * tacp_por - Accept Port for Rendezvous with Timeout - */ - -ER tacp_por( - RNO *p_rdvno, - VP msg, - INT *p_cmsgsz, - ID porid, - UINT acpptn, - TMO tmout -); - -/* - * fwd_por - Forward Rendezvous to Other Port - */ - -ER fwd_por( - ID porid, - UINT calptn, - RNO rdvno, - VP msg, - INT cmsgsz -); - -/* - * rpl_rdv - Reply Rendezvous - */ - -ER rpl_rdv( - RNO rdvno, - VP msg, - INT rmsgsz -); - -/* - * ref_por - Reference Port Status - */ - -ER ref_por( - T_RPOR *pk_rpor, - ID porid -); - - - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/semaphore.h b/c/src/exec/itron/include/itronsys/semaphore.h deleted file mode 100644 index b76b72387d..0000000000 --- a/c/src/exec/itron/include/itronsys/semaphore.h +++ /dev/null @@ -1,121 +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$ - */ - -#ifndef __ITRON_SEMAPHORE_h_ -#define __ITRON_SEMAPHORE_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Create Semaphore (cre_sem) Structure - */ - -typedef struct t_csem { - VP exinf; /* extended information */ - ATR sematr; /* semaphore attributes */ - /* Following is the extended function for [level X]. */ - INT isemcnt; /* initial semaphore count */ - INT maxsem; /* maximum semaphore count */ - /* additional information may be included depending on the implementation */ -} T_CSEM; - -/* - * sematr - Semaphore Attribute Values - */ - -#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ -#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ - -#define _ITRON_SEMAPHORE_UNUSED_ATTRIBUTES ~(TA_TPRI) - -/* - * Reference Semaphore (ref_sem) Structure - */ - -typedef struct t_rsem { - VP exinf; /* extended information */ - BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ - INT semcnt; /* current semaphore count */ - /* additional information may be included depending on the implementation */ -} T_RSEM; - -/* - * Semaphore Functions - */ - -/* - * cre_sem - Create Semaphore - */ - -ER cre_sem( - ID semid, - T_CSEM *pk_csem -); - -/* - * del_sem - Delete Semaphore - */ - -ER del_sem( - ID semid -); - -/* - * sig_sem - Signal Semaphore - */ - -ER sig_sem( - ID semid -); - -/* - * wai_sem - Wait on Semaphore - */ - -ER wai_sem( - ID semid -); - -/* - * preq_sem - Poll and Request Semaphore - */ - -ER preq_sem( - ID semid -); - -/* - * twai_sem - Wait on Semaphore with Timeout - */ - -ER twai_sem( - ID semid, - TMO tmout -); - -/* - * ref_sem - Reference Semaphore Status - */ - -ER ref_sem( - ID semid, - T_RSEM *pk_rsem -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/status.h b/c/src/exec/itron/include/itronsys/status.h deleted file mode 100644 index 42f7226749..0000000000 --- a/c/src/exec/itron/include/itronsys/status.h +++ /dev/null @@ -1,70 +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$ - */ - -#ifndef __ITRON_STATUS_h_ -#define __ITRON_STATUS_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#define E_OK 0 /* Normal completion */ -#define E_SYS (-5) /* System error */ -#define E_NOMEM (-10) /* Insufficient memory */ -#define E_NOSPT (-17) /* Feature not supported */ -#define E_INOSPT (-18) /* Feature not supported by ITRON/FILE */ - /* specification */ -#define E_RSFN (-20) /* Reserved function code number */ -#define E_RSATR (-24) /* Reserved attribute */ -#define E_PAR (-33) /* Parameter error */ -#define E_ID (-35) /* Invalid ID number */ -#define E_NOEXS (-52) /* Object does not exist */ -#define E_OBJ (-63) /* Invalid object state */ -#define E_MACV (-65) /* Memory access disabled or memory access */ - /* violation */ -#define E_OACV (-66) /* Object access violation */ -#define E_CTX (-69) /* Context error */ -#define E_QOVR (-73) /* Queuing or nesting overflow */ -#define E_DLT (-81) /* Object being waited for was deleted */ -#define E_TMOUT (-85) /* Polling failure or timeout exceeded */ -#define E_RLWAI (-86) /* WAIT state was forcibly released */ -#define EN_NOND (-113) /* Target node does not exist or cannot be */ - /* accessed */ -#define EN_OBJNO (-114) /* Specifies an object number which could not be */ - /* accessed on the target node */ -#define EN_PROTO (-115) /* Protocol not supported on target node */ -#define EN_RSFN (-116) /* System call or function not supported on */ - /* target node */ -#define EN_COMM (-117) /* No response from target node */ -#define EN_RLWAI (-118) /* Connection function response wait state was */ - /* forcibly released */ -#define EN_PAR (-119) /* A value outside the range supported by the */ - /* target node and/or transmission packet */ - /* format was specified as a parameter */ -#define EN_RPAR (-120) /* A value outside the range supported by the */ - /* issuing node and/or transmission packet */ - /* format was returned as a return parameter */ -#define EN_CTXID (-121) /* An object on another node was specified to */ - /* a system call issued from a task in dispatch */ - /* disabled state or from a task-independent */ - /* portion */ -#define EN_EXEC (-122) /* System call could not be executed due to */ - /* insufficient resources on the target node */ -#define EN_NOSPT (-123) /* Connection function not supported */ - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/sysmgmt.h b/c/src/exec/itron/include/itronsys/sysmgmt.h deleted file mode 100644 index 0f3c403f82..0000000000 --- a/c/src/exec/itron/include/itronsys/sysmgmt.h +++ /dev/null @@ -1,319 +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$ - */ - -#ifndef __ITRON_SYSTEM_MANAGEMENT_h_ -#define __ITRON_SYSTEM_MANAGEMENT_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Get Version (get_ver) Structure - */ - -typedef struct t_ver { - UH maker; /* vendor */ - UH id; /* format number */ - UH spver; /* specification version */ - UH prver; /* product version */ - UH prno[4]; /* product control information */ - UH cpu; /* CPU information */ - UH var; /* variation descriptor */ -} T_VER; - -/* - * Specific MAKER codes established as of March, 1993 are as follows. - * Due to restrictions on the assignment of CPU codes described below, it is - * necessary to use maker codes in the range 0x000 through 0x00ff for vendors - * developing CPUs. - */ - -/* - * CPU defines XXX need to name the constants - */ - -#if 0 -#define 0x000 /* No version (test systems, etc.) */ -#define 0x001 /* University of Tokyo */ -#define 0x009 /* FUJITSU LIMITED */ -#define 0x00a /* Hitachi, Ltd. */ -#define 0x00b /* Matsushita Electric Industrial Co., Ltd. */ -#define 0x00c /* Mitsubishi Electric Corporation */ -#define 0x00d /* NEC Corporation */ -#define 0x00e /* Oki Electric Industry Co., Ltd. */ -#define 0x00f /* TOSHIBA CORPORATION */ -#endif - -/* - * The above have been assigned in alphabetical order. - */ - -#if 0 -#define 0x010 /* ALPS ELECTRIC CO., LTD. */ -#define 0x011 /* WACOM Co., Ltd. */ -#define 0x012 /* Personal Media Corporation */ -#define 0x101 /* OMRON CORPORATION */ -#define 0x102 /* SEIKOSHA CO., LTD. */ -#define 0x103 /* SYSTEM ALGO CO., LTD. */ -#define 0x104 /* Tokyo Computer Service Co., Ltd. */ -#define 0x105 /* YAMAHA CORPORATION */ -#define 0x106 /* MORSON JAPAN */ -#define 0x107 /* TOSHIBA INFORMATION SYSTEMS (JAPAN) CORP. */ -#define 0x108 /* Miyazaki System Planning Office */ -#define 0x109 /* Three Ace Computer Corporation */ -#endif - -/* - * CPU Codes - * - * Figure 47 shows the format of cpu code. Some processors use the format - * given in Figure 47(1). The format given in Figure 47(2) is used for all - * other proprietary processors. - * - * The code assignment of the CPU1 region in the format given in Figure 47(1) - * is common to ITRON and BTRON specifications. The same number is used in - * the CPU type of the standard object format of BTRON specification - * operating systems implemented on a TRON-specification chip. - * - * When using the format given in Figure 47(2) the code used for MAKER1 is - * assigned by using the lower 8 bits of MAKER described in the previous - * subsection. The code assignment of CPU2 is left up to each maker. - * - * - * - * +---------------+---------------+---------------+---------------+ - * (1) | 0 0 0 0 0 0 0 0 | CPU1 | - * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ - * +---------------+---------------+---------------+---------------+ - * (2) | MAKER1 | CPU2 | - * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ - * - * Figure 47 Format of cpu Returned by get_ver - * - * - * Specific CPU codes established as of March, 1993 are as follows. - */ - -#if 0 -/* - * XXX CONVERT THESE to #defines - */ - - -/* - * Contents of the CPU1 field - */ - -#define (0x0) CPU unspecified, no CPU information given -#define (0x1) TRONCHIP32 shared -#define (0x2) reserved -#define (0x3) reserved -#define (0x4) reserved -#define (0x5) reserved (<> TRON-specification chip) -#define (0x6) reserved (<> TRON-specification chip) -#define (0x7) reserved (TRON-specification chip supporting the - LSID function) -/* CPU vendors are unspecified for codes B'00000000 through B'00000111. */ - -#define (0x8) reserved -#define (0x9) GMICRO/100 -#define (0xa) GMICRO/200 -#define (0xb) GMICRO/300 -#define (0xc) reserved -#define (0xd) TX1 -#define (0xe) TX2 -#define (0xf) reserved - -#define (0x10) reserved -#define (0x11) reserved -#define (0x12) reserved -#define (0x13) O32 -#define (0x14) reserved -#define (0x15) MN10400 -#define (0x16) reserved -#define (0x17) reserved - -#define (0x18) GMICRO/400 -#define (0x19) GMICRO/500 -#define (0x1a) reserved -#define (0x1b-0x3f) - reserved - * For GMICRO extended, TX series extended, and TRONCHIP64 chips. - -#define (0x40) Motorola 68000 -#define (0x41) Motorola 68010 -#define (0x42) Motorola 68020 -#define (0x43) Motorola 68030 -#define (0x44) Motorola 68040 -#define -(0x40-0x4f) -#define Motorola 68000 family -#define (0x50) National Semiconductor NS32032 -#define (0x50-0x5f) - National Semiconductor NS32000 family -#define (0x60) Intel 8086, 8088 -#define (0x61) Intel 80186 -#define (0x62) Intel 80286 -#define (0x63) Intel 80386 -#define (0x64) Intel 80486 -#define (0x60-0x6f) - Intel iAPX86 family - -#define (0x70-0x7f) - NEC V Series - -#define (0x80-0xff) - reserved -#endif - -/* - * Assigning Version Numbers - * - * The version numbers of ITRON and uITRON specifications take the following - * form. - * - * Ver X.YY.ZZ[.WW] - * - * where "X" represents major version number of the ITRON specification to - * distinguish ITRON1, ITRON2 and uITRON 3.0 specifications. Specific - * assignment is as follows. - * - * "X" = 1 ITRON1 specification - * = 2 ITRON2 or uITRON 2.0 specification - * = 3 uITRON 3.0 specification - * - * "YY" is a number used to distinguish versions according to changes and - * additions made to the specification. After the specification is published, - * this number is incremented in order "YY" = 00, 01, 02... according to - * version upgrades. The first digit of "YY" is 'A', 'B' or 'C' for draft - * standard versions and test versions within the TRON Association before the - * specification have been published. - * - * The "X.YY" part of the specification version numbers is returned by spver - * to get_ver system call. The corresponding hexadecimal value is used when - * "YY" includes 'A', 'B' or 'C'. - * - * "ZZ" represents a number used to distinguish versions related to the written - * style of a specification. This number is incremented in order - * "ZZ" = 00, 01, 02... when there have been changes in specification - * configuration, reordering of chapters or corrections of misprints. - * When a further distinction of the written style of specifications is - * desired, ".WW" may be added optionally after "ZZ". WW will be assumed - * to be zero if ".WW" is omitted. - */ - -/* - * Reference System (ref_sys) Structure - */ - -typedef struct t_rsys { - INT sysstat; /* system state */ - /* additional information may be included depending on the implementation */ -} T_RSYS; - -/* - * sysstat - */ - -#define TSS_TSK 0 /* normal state in which dispatching is enabled during - task portion execution */ -#define TSS_DDSP 1 /* state after dis_dsp has been executed during task - portion execution (dispatch disabled) */ -#define TSS_LOC 3 /* state after loc_cpu has been executed during task - portion execution (interrupt and dispatch disabled) - */ -#define TSS_INDP 4 /* state during execution of task-independent portions - (interrupt and timer handlers) */ - -/* - * Reference Configuration (ref_cfg) Structure - */ - -typedef struct t_rcfg { - /* details concerning members are implementation dependent */ -} T_RCFG; - -/* - * Define Service (def_svc) Structure - */ - -typedef struct t_dsvc { - ATR svcatr; /* extended SVC handler attributes */ - FP svchdr; /* extended SVC handler address */ - /* additional information may be included depending on the implementation */ -} T_DSVC; - -/* - * Define Exception (def_exc) Structure - */ - -typedef struct t_dexc { - ATR excatr; /* exception handler attributes */ - FP exchdr; /* exception handler address */ - /* additional information may be included depending on the implementation */ -} T_DEXC; - -/* - * System Management Functions - */ - -/* - * get_ver - Get Version Information - */ - -ER get_ver( - T_VER *pk_ver -); - -/* - * ref_sys - Reference Semaphore Status - */ - -ER ref_sys( - T_RSYS *pk_rsys -); - -/* - * ref_cfg - Reference Configuration Information - */ - -ER ref_cfg( - T_RCFG *pk_rcfg -); - -/* - * def_svc - Define Extended SVC Handler - */ - -ER def_svc( - FN s_fncd, - T_DSVC *pk_dsvc -); - -/* - * def_exc - Define Exception Handler - */ - -ER def_exc( - UINT exckind, - T_DEXC *pk_dexc -); - - - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/task.h b/c/src/exec/itron/include/itronsys/task.h deleted file mode 100644 index d4f7a5e470..0000000000 --- a/c/src/exec/itron/include/itronsys/task.h +++ /dev/null @@ -1,298 +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$ - */ - -#ifndef __ITRON_TASK_h_ -#define __ITRON_TASK_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Create Task (cre_tsk) Structure - */ - -typedef struct t_ctsk { - VP exinf; /* extended information */ - ATR tskatr; /* task attributes */ - FP task; /* task start address */ - PRI itskpri; /* initial task priority */ - INT stksz; /* stack size */ - /* additional information may be included depending on the implementation */ -} T_CTSK; - -/* - * Values for the tskatr field - */ - -#define TA_ASM 0x00 /* program written in assembly language */ -#define TA_HLNG 0x01 /* program written in high-level language */ -#define TA_COP0 0x8000 /* uses coprocessor having ID = 0 */ -#define TA_COP1 0x4000 /* uses coprocessor having ID = 1 */ -#define TA_COP2 0x2000 /* uses coprocessor having ID = 2 */ -#define TA_COP3 0x1000 /* uses coprocessor having ID = 3 */ -#define TA_COP4 0x0800 /* uses coprocessor having ID = 4 */ -#define TA_COP5 0x0400 /* uses coprocessor having ID = 5 */ -#define TA_COP6 0x0200 /* uses coprocessor having ID = 6 */ -#define TA_COP7 0x0100 /* uses coprocessor having ID = 7 */ - -/* - * Values for the tskid field - */ - -#define TSK_SELF 0 /* task specifies itself */ - -/* XXX is this a mistake in ITRON? FALSE was here and in the types list */ -#if 0 - -#define FALSE 0 /* indicates a task-independent portion (return */ - /* parameters only) */ -#endif - -/* - * Values for the tskpri field - */ - -#define TPRI_INI 0 /* specifies the initial priority on */ - /* task startup (chg_pri) */ -#define TPRI_RUN 0 /* specifies the highest priority during */ - /* execution (rot_rdq) */ - - -/* - * Reference Task (ref_tsk) Structure - */ - -typedef struct t_rtsk { - VP exinf; /* extended information */ - PRI tskpri; /* current priority */ - UINT tskstat; /* task state */ - /* - * The following are represent extended features of support - * [level X] (implementation-dependent). - */ - UINT tskwait; /* cause of wait */ - ID wid; /* ID of object being waited for */ - INT wupcnt; /* wakeup request count */ - INT suscnt; /* SUSPEND request count */ - ATR tskatr; /* task attributes */ - FP task; /* task start address */ - PRI itskpri; /* initial task priority */ - INT stksz; /* stack size */ -} T_RTSK; - -/* - * Values for the tskstat field - */ - - -#define TTS_RUN 0x01 /* RUN */ -#define TTS_RDY 0x02 /* READY */ -#define TTS_WAI 0x04 /* WAIT */ -#define TTS_SUS 0x08 /* SUSPEND */ -#define TTS_WAS 0x0C /* WAIT-SUSPEND */ -#define TTS_DMT 0x10 /* DORMANT */ - -/* - * Values for the tskwait field - */ - -#define TTW_SLP 0x0001 /* wait due to slp_tsk or tslp_tsk */ -#define TTW_DLY 0x0002 /* wait due to dly_tsk */ -#define TTW_NOD 0x0008 /* connection function response wait */ -#define TTW_FLG 0x0010 /* wait due to wai_flg or twai_flg */ -#define TTW_SEM 0x0020 /* wait due to wai_sem or twai_sem */ -#define TTW_MBX 0x0040 /* wait due to rcv_msg or trcv_msg */ -#define TTW_SMBF 0x0080 /* wait due to snd_mbf or tsnd_mbf */ -#define TTW_MBF 0x0100 /* wait due to rcv_mbf or trcv_mbf */ -#define TTW_CAL 0x0200 /* wait for rendezvous call */ -#define TTW_ACP 0x0400 /* wait for rendezvous accept */ -#define TTW_RDV 0x0800 /* wait for rendezvous completion */ -#define TTW_MPL 0x1000 /* wait due to get_blk or tget_blk */ -#define TTW_MPF 0x2000 /* wait due to get_blf or tget_blf */ - -/* - * Since the task states given by tskstat and tskwait are expressed - * by bit correspondences, they are convenient when looking for OR - * conditions (such as whether a task is in WAIT or READY state). - */ - -/* - * Task Management Functions - */ - -/* - * cre_tsk - Create Task - */ - -ER cre_tsk( - ID tskid, - T_CTSK *pk_ctsk -); - -/* - * del_tsk - Delete Task - */ - -ER del_tsk( - ID tskid -); - -/* - * sta_tsk - Start Task - */ - -ER sta_tsk( - ID tskid, - INT stacd -); - -/* - * ext_tsk - Exit Issuing Task - */ - -void ext_tsk( void ); - -/* - * exd_tsk - Exit and Delete Task - */ - -void exd_tsk( void ); - -/* - * ter_tsk - Terminate Other Task - */ - -ER ter_tsk( - ID tskid -); - -/* - * dis_dsp - Disable Dispatch - */ - -ER dis_dsp( void ); - -/* - * ena_dsp - Enable Dispatch - */ - -ER ena_dsp( void ); - -/* - * chg_pri - Change Task Priority - */ - -ER chg_pri( - ID tskid, - PRI tskpri -); - -/* - * rot_rdq - Rotate Tasks on the Ready Queue - */ - -ER rot_rdq( - PRI tskpri -); - -/* - * rel_wai - Release Wait of Other Task - */ - -ER rel_wai( - ID tskid -); - -/* - * get_tid - Get Task Identifier - */ - -ER get_tid( - ID *p_tskid -); - -/* - * ref_tsk - Reference Task Status - */ - -ER ref_tsk( - T_RTSK *pk_rtsk, - ID tskid -); - - -/* - * Task-Dependent Synchronization Functions - */ - -/* - * sus_tsk - Suspend Other Task - */ - -ER sus_tsk( - ID tskid -); - -/* - * rsm_tsk - Resume Suspended Task - */ - -ER rsm_tsk( - ID tskid -); - -/* - * frsm_tsk - Forcibly Resume Suspended Task - */ - -ER frsm_tsk( - ID tskid -); - -/* - * slp_tsk - Sleep Task Sleep Task with Timeout - */ - -ER slp_tsk( void ); - -/* - * tslp_tsk - Sleep Task with Timeout - */ - -ER tslp_tsk( - TMO tmout -); - -/* - * wup_tsk - Wakeup Other Task - */ - -ER wup_tsk( - ID tskid -); - -/* - * can_wup - Cancel Wakeup Request - */ - -ER can_wup( - INT *p_wupcnt, - ID tskid -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/time.h b/c/src/exec/itron/include/itronsys/time.h deleted file mode 100644 index 7868e45ff0..0000000000 --- a/c/src/exec/itron/include/itronsys/time.h +++ /dev/null @@ -1,185 +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$ - */ - -#ifndef __ITRON_TIME_h_ -#define __ITRON_TIME_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * System Time Data Type - * - * Member configuration depends on the bit width of the processor and - * on the implementation. A total of 48 bits is recommended. - * - */ - -typedef struct t_systime { - H utime; /* upper 16 bits */ - UW ltime; /* lower 32 bits */ -} SYSTIME, CYCTIME, ALMTIME; - -/* - * XXX Look this up in the spec and figure out where it comes - * XXX from. dly_tim() references it but it was left out - * XXX of the initial cut at the header files. - */ - -typedef int DLYTIME; - -/* - * XXX (def_cyc) Structure - */ - -typedef struct t_dcyc { - VP exinf; /* extended information */ - ATR cycatr; /* cyclic handler attributes */ - FP cychdr; /* cyclic handler address */ - UINT cycact; /* cyclic handler activation */ - CYCTIME cyctim; /* cyclic startup period */ -} T_DCYC; - -/* - * cycact - */ - -#define TCY_OFF 0x00 /* do not invoke cyclic handler */ -#define TCY_ON 0x01 /* invoke cyclic handler */ -#define TCY_INT 0x02 /* initialize cycle count */ - -/* - * Reference Cyclic Handler (ref_cyc) Structure - */ - -typedef struct t_rcyc { - VP exinf; /* extended information */ - CYCTIME lfttim; /* time left before next handler startup */ - UINT cycact; /* cyclic handler activation */ - /* additional information may be included depending on the implementation */ -} T_RCYC; - -/* - * Define Alarm (def_alm) Structure - */ - -typedef struct t_dalm { - VP exinf; /* extended information */ - ATR almatr; /* alarm handler attributes */ - FP almhdr; /* alarm handler address */ - UINT tmmode; /* start time specification mode */ - ALMTIME almtim; /* handler startup time */ -} T_DALM; - -/* - * tmmode - */ - -#define TTM_ABS 0x00 /* specified as an absolute time */ -#define TTM_REL 0x01 /* specified as a relative time */ - -/* - * Reference Alarm (ref_alm) Structure - */ - -typedef struct t_ralm { - VP exinf; /* extended information */ - ALMTIME lfttim; /* time left before next handler startup */ - /* additional information may be included depending on the implementation */ -} T_RALM; - -/* - * Time Management Functions - */ - -/* - * set_tim - Set System Clock - */ - -ER set_tim( - SYSTIME *pk_tim -); - -/* - * get_tim - Get System Clock - */ - -ER get_tim( - SYSTIME *pk_tim -); - -/* - * dly_tsk - Delay Task - */ - -ER dly_tsk( - DLYTIME dlytim -); - -/* - * def_cyc - Define Cyclic Handler - */ - -ER def_cyc( - HNO cycno, - T_DCYC *pk_dcyc -); - -/* - * act_cyc - Activate Cyclic Handler - */ - -ER act_cyc( - HNO cycno, - UINT cycact -); - -/* - * ref_cyc - Reference Cyclic Handler Status - */ - -ER ref_cyc( - T_RCYC *pk_rcyc, - HNO cycno -); - -/* - * def_alm - Define Alarm Handler - */ - -ER def_alm( - HNO almno, - T_DALM *pk_dalm -); - -/* - * ref_alm - Reference Alarm Handler Status - */ - -ER ref_alm( - T_RALM *pk_ralm, - HNO almno -); - -/* - * ret_tmr - Return from Timer Handler - */ - -void ret_tmr( void ); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/types.h b/c/src/exec/itron/include/itronsys/types.h deleted file mode 100644 index 27a701fa47..0000000000 --- a/c/src/exec/itron/include/itronsys/types.h +++ /dev/null @@ -1,121 +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$ - */ - -#ifndef __ITRON_TYPES_h_ -#define __ITRON_TYPES_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* XXX some of these may need to be moved */ -/* - * XXX: These names are too short and conflict with numerous - * off the shell programs including paranoia. - */ - -typedef signed8 B; /* signed 8-bit integer */ -typedef signed16 H; /* signed 16-bit integer */ -typedef signed32 W; /* signed 32-bit integer */ -typedef unsigned8 UB; /* unsigned 8-bit integer */ -typedef unsigned16 UH; /* unsigned 16-bit integer */ -typedef unsigned32 UW; /* unsigned 32-bit integer */ - -typedef unsigned32 VW; /* unpredictable data type (32-bit size) */ -typedef unsigned16 VH; /* unpredictable data type (16-bit size) */ -typedef unsigned8 VB; /* unpredictable data type (8-bit size) */ - -typedef void *VP; /* pointer to an unpredictable data type */ - -typedef void (*FP)(); /* program start address */ - -/* - * 6.4 Data Types - * - * The difference between VB, VH and VW and B, H and W is that only the - * number of bits is known for the former, not the data type of the - * contents. The latter clearly represent integers. - */ - -/* - * Data Types Dependent on ITRON Specification - * - * In order to clarify the meanings of certain parameters, the - * following names are used for data types which appear frequently - * and/or have special meanings. - */ - -typedef signed32 INT; /* Signed integer (bit width of processor) */ -typedef unsigned32 UINT; /* Unsigned integer (bit width of processor) */ -typedef boolean BOOL; /* Boolean value. TRUE (1) or FALSE (0). */ -typedef signed16 FN; /* Function code. Signed integer. Maximum 2 bytes. */ -typedef int ID; /* Object ID number (???id) */ - /* Value range depends on the system. Usually */ - /* a signed integer. Certain ID values may */ - /* represent objects on other nodes when the */ - /* connection function is supported. */ - -typedef unsigned32 BOOL_ID;/* Boolean value or ID number */ - -typedef signed32 HNO; /* Handler number */ -typedef signed32 RNO; /* Rendezvous number */ -typedef signed32 NODE; /* Node Number. Usually a signed integer. */ -typedef signed32 ATR; /* Object or handler attribute. */ - /* An unsigned integer. */ -typedef signed32 ER; /* Error code. A signed integer. */ -typedef unsigned32 PRI; /* Task priority. A signed integer. */ -typedef signed32 TMO; /* Timeout value. A signed integer. */ - /* TMO_POL = 0 indicates polling, */ - /* while TMO_FEVR = -1 indicates wait forever. */ - -/* - * 6.6 Common Constants and Data Structure Packet Formats - */ - -#define NADR (-1) /* invalid address or pointer value */ - -#ifndef TRUE -#define TRUE 1 /* true */ -#endif - -#ifndef FALSE -#define FALSE 0 /* false */ -#endif - -/* - * ATR tskatr, intatr, cycatr, almatr, svcatr, excatr: - * - * TA_ASM indicates that the task or handler is directly started - * at the assembly language level. The TA_ASM attribute has the - * opposite meaning of TA_HLNG. - * - * NOTE: Really in - */ - -#if 0 -#define TA_ASM 0x00 /* program written in assembly language */ -#define TA_HLNG 0x01 /* program written in high-level language */ -#endif - -/* - * TMO tmout: - */ - -#define TMO_POL 0 /* polling */ -#define TMO_FEVR (-1) /* wait forever */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/itronsys/vmempool.h b/c/src/exec/itron/include/itronsys/vmempool.h deleted file mode 100644 index fbb2f1e2b8..0000000000 --- a/c/src/exec/itron/include/itronsys/vmempool.h +++ /dev/null @@ -1,132 +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$ - */ - -#ifndef __ITRON_VARIABLE_MEMORYPOOL_h_ -#define __ITRON_VARIABLE_MEMORYPOOL_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Create Variable Memory Pool (cre_mpl) Structure - */ - -typedef struct t_cmpl { - VP exinf; /* extended information */ - ATR mplatr; /* memorypool attributes */ - INT mplsz; /* memorypool size */ - /* additional information may be included depending on the implementation */ -} T_CMPL; - -/* - * mplatr - */ - -#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ -#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ - -/* - * mplid - */ - -#define TMPL_OS (-4) /* memorypool used by OS */ - -/* - * Reference Variable Memory Pool (ref_mpl) Structure - */ - -typedef struct t_rmpl { - VP exinf; /* extended information */ - BOOL_ID wtsk; /* indicates whether or not there are waiting tasks */ - INT frsz; /* total size of free memory */ - INT maxsz; /* size of largest contiguous memory */ - /* additional information may be included depending on the implementation */ -} T_RMPL; - -/* - * Variable Memory Pool Functions - */ - -/* - * cre_mpl - Create Variable-Size Memorypool - */ - -ER cre_mpl( - ID mplid, - T_CMPL *pk_cmpl -); - -/* - * del_mpl - Delete Variable-Size Memorypool - */ - -ER del_mpl( - ID mplid -); - -/* - * get_blk - Get Variable-Size Memory Block - */ - -ER get_blk( - VP *p_blk, - ID mplid, - INT blksz -); - -/* - * pget_blk - Poll and Get Variable-Size Memory Block - */ - -ER pget_blk( - VP *p_blk, - ID mplid, - INT blksz -); - -/* - * tget_blk - Get Variable-Size Memory Block with Timeout - */ - -ER tget_blk( - VP *p_blk, - ID mplid, - INT blksz, - TMO tmout -); - -/* - * rel_blk - Release Variable-Size Memory Block - */ - -ER rel_blk( - ID mplid, - VP blk -); - -/* - * ref_mpl - Reference Variable-Size Memorypool Status - */ - -ER ref_mpl( - T_RMPL *pk_rmpl, - ID mplid -); - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/.cvsignore b/c/src/exec/itron/include/rtems/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/include/rtems/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/include/rtems/itron/.cvsignore b/c/src/exec/itron/include/rtems/itron/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/include/rtems/itron/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/include/rtems/itron/README b/c/src/exec/itron/include/rtems/itron/README deleted file mode 100644 index 9ac3bf3417..0000000000 --- a/c/src/exec/itron/include/rtems/itron/README +++ /dev/null @@ -1,10 +0,0 @@ -# -# $Id$ -# - -This directory contains the private interface of each manager. -These files should only be included from the from the -implementation of each manager. - -The public header file for each ITRON manager is in -../../../tronsys. \ No newline at end of file diff --git a/c/src/exec/itron/include/rtems/itron/config.h b/c/src/exec/itron/include/rtems/itron/config.h deleted file mode 100644 index 9b7b84709d..0000000000 --- a/c/src/exec/itron/include/rtems/itron/config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* config.h - * - * This include file contains the table of user defined configuration - * parameters specific for the ITRON API. - * - * 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_ITRON_CONFIGURATION_h -#define __RTEMS_ITRON_CONFIGURATION_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX - * - * The following records define the Configuration Table. The - * information contained in this table is required in all - * RTEMS systems, whether single or multiprocessor. This - * table primarily defines the following: - * - * + required number of each object type - */ - -/* - * For now, we are only allowing the user to specify the entry point - * and stack size for ITRON initialization threads. - */ - -typedef struct { - ID id; - T_CTSK attributes; -} itron_initialization_tasks_table; - -typedef struct { - int maximum_tasks; - int maximum_semaphores; - int maximum_eventflags; - int maximum_mailboxes; - int maximum_message_buffers; - int maximum_ports; - int maximum_memory_pools; - int maximum_fixed_memory_pools; - int number_of_initialization_tasks; - itron_initialization_tasks_table *User_initialization_tasks_table; -} itron_api_configuration_table; - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/exec/itron/include/rtems/itron/eventflags.h b/c/src/exec/itron/include/rtems/itron/eventflags.h deleted file mode 100644 index 1c709be752..0000000000 --- a/c/src/exec/itron/include/rtems/itron/eventflags.h +++ /dev/null @@ -1,61 +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$ - */ - -#ifndef __RTEMS_ITRON_EVENTFLAGS_h_ -#define __RTEMS_ITRON_EVENTFLAGS_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* - * The following defines the control block used to manage each event flag. - */ - -typedef struct { - ITRON_Objects_Control Object; - unsigned32 XXX_more_stuff_goes_here; -} ITRON_Eventflags_Control; - -/* - * The following defines the information control block used to manage - * this class of objects. - */ - -ITRON_EXTERN Objects_Information _ITRON_Eventflags_Information; - -/* - * _ITRON_Eventflags_Manager_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this manager. - */ - -void _ITRON_Eventflags_Manager_initialization( - unsigned32 maximum_eventflags -); - -/* - * XXX insert private stuff here - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/fmempool.h b/c/src/exec/itron/include/rtems/itron/fmempool.h deleted file mode 100644 index 221d376d1e..0000000000 --- a/c/src/exec/itron/include/rtems/itron/fmempool.h +++ /dev/null @@ -1,62 +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$ - */ - -#ifndef __RTEMS_ITRON_FIXED_MEMORYPOOL_h_ -#define __RTEMS_ITRON_FIXED_MEMORYPOOL_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* - * The following defines the control block used to manage each - * fixed memory pool. - */ - -typedef struct { - ITRON_Objects_Control Object; - unsigned32 XXX_more_stuff_goes_here; -} ITRON_Fixed_memory_pool_Control; - -/* - * The following defines the information control block used to manage - * this class of objects. - */ - -ITRON_EXTERN Objects_Information _ITRON_Fixed_memory_pool_Information; - -/* - * _ITRON_Fixed_memory_pool_Manager_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this manager. - */ - -void _ITRON_Fixed_memory_pool_Manager_initialization( - unsigned32 maximum_fixed_memory_pools -); - -/* - * XXX insert private stuff here - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/intr.h b/c/src/exec/itron/include/rtems/itron/intr.h deleted file mode 100644 index 514b9198fe..0000000000 --- a/c/src/exec/itron/include/rtems/itron/intr.h +++ /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$ - */ - -#ifndef __RTEMS_ITRON_INTERRUPT_h_ -#define __RTEMS_ITRON_INTERRUPT_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert private stuff here - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/itronapi.h b/c/src/exec/itron/include/rtems/itron/itronapi.h deleted file mode 100644 index 775813d2f4..0000000000 --- a/c/src/exec/itron/include/rtems/itron/itronapi.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * ITRON API 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. - * - * $Id$ - */ - -#ifndef __ITRON_API_h -#define __ITRON_API_h - -#include - -/* - * _ITRON_API_Initialize - * - * Initialize the ITRON API. - */ - -void _ITRON_API_Initialize( - rtems_configuration_table *configuration_table -); - -#endif -/* end of include file */ diff --git a/c/src/exec/itron/include/rtems/itron/mbox.h b/c/src/exec/itron/include/rtems/itron/mbox.h deleted file mode 100644 index 8f240ee8ce..0000000000 --- a/c/src/exec/itron/include/rtems/itron/mbox.h +++ /dev/null @@ -1,73 +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$ - */ - -#ifndef __RTEMS_ITRON_MBOX_h_ -#define __RTEMS_ITRON_MBOX_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/* - * The following defines the control block used to manage each mailbox. - */ - -typedef struct { - ITRON_Objects_Control Object; - unsigned32 count; - boolean do_message_priority; - CORE_message_queue_Control message_queue; -} ITRON_Mailbox_Control; - -/* - * The following defines the information control block used to manage - * this class of objects. - */ - -ITRON_EXTERN Objects_Information _ITRON_Mailbox_Information; - -/* - * _ITRON_Mailbox_Manager_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this manager. - */ - -void _ITRON_Mailbox_Manager_initialization( - unsigned32 maximum_mailboxes -); - -/* - * _ITRON_Mailbox_Translate_core_message_queue_return_code - * - * DESCRIPTION: - * - * This routine translates a core message queue object status - * into the appropriate ITRON status code. - */ - -ER _ITRON_Mailbox_Translate_core_message_queue_return_code( - CORE_message_queue_Status status -); - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/msgbuffer.h b/c/src/exec/itron/include/rtems/itron/msgbuffer.h deleted file mode 100644 index 4b3192af79..0000000000 --- a/c/src/exec/itron/include/rtems/itron/msgbuffer.h +++ /dev/null @@ -1,72 +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$ - */ - -#ifndef __RTEMS_ITRON_MESSAGEBUFFER_h_ -#define __RTEMS_ITRON_MESSAGEBUFFER_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/* - * The following defines the control block used to manage each - * message buffer. - */ - -typedef struct { - ITRON_Objects_Control Object; - boolean is_priority_blocking; - CORE_message_queue_Control message_queue; -} ITRON_Message_buffer_Control; - -/* - * The following defines the information control block used to manage - * this class of objects. - */ - -ITRON_EXTERN Objects_Information _ITRON_Message_buffer_Information; - -/* - * _ITRON_Message_buffer_Manager_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this manager. - */ - -void _ITRON_Message_buffer_Manager_initialization( - unsigned32 maximum_message_buffers -); - -/* - * _ITRON_Message_buffer_Translate_core_message_buffer_return_code - * - * DESCRIPTION: - * - * This routine translates a core message buffer object status - * into the appropriate ITRON status code. - */ - -ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code( - CORE_message_queue_Status status -); - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/exec/itron/include/rtems/itron/network.h b/c/src/exec/itron/include/rtems/itron/network.h deleted file mode 100644 index 6889cf41fa..0000000000 --- a/c/src/exec/itron/include/rtems/itron/network.h +++ /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$ - */ - -#ifndef __RTEMS_ITRON_NETWORK_h_ -#define __RTEMS_ITRON_NETWORK_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert private stuff here - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/object.h b/c/src/exec/itron/include/rtems/itron/object.h deleted file mode 100644 index 1a7f0c8d68..0000000000 --- a/c/src/exec/itron/include/rtems/itron/object.h +++ /dev/null @@ -1,120 +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$ - */ - -#ifndef __RTEMS_ITRON_OBJECT_h_ -#define __RTEMS_ITRON_OBJECT_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef Objects_Control ITRON_Objects_Control; - -/* - * Maximum length of an ITRON object name - * - * NOTE: Since ITRON objects do not have names, then then length is 0. - */ - -#define ITRON_MAXIMUM_NAME_LENGTH 0 - -/* - * _ITRON_Objects_Open - * - * Make this ITRON object visible to the system. - * - * NOTE: This macro hides the fact that ITRON objects don't have names. - */ - -#define _ITRON_Objects_Open( _the_information, _the_object ) \ - _Objects_Open( (_the_information), (_the_object), NULL ) - -/* - * _ITRON_Objects_Close - * - * Make this ITRON object invisible from the system. Usually used as - * the first step of deleting an object. - */ - -#define _ITRON_Objects_Close( _the_information, _the_object ) \ - _Objects_Close( (_the_information), (_the_object) ) - -/* - * _ITRON_Objects_Allocate_by_index - * - * Allocate the ITRON object specified by "_id". The ITRON id is the - * index portion of the traditional RTEMS ID. The Classic and POSIX - * APIs do not require that a specific object be allocated. - */ - -#define _ITRON_Objects_Allocate_by_index( _the_information, _id, _sizeof ) \ - _Objects_Allocate_by_index( (_the_information), (_id), (_sizeof) ) - -/* - * _ITRON_Objects_Clarify_allocation_id_error - * - * This function is invoked when an object allocation ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Objects_Clarify_allocation_id_error( _the_information, _id ) \ - (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \ - ((_id) <= 0) ? E_ID : /* bogus index of 0 - -3 */ \ - ((_id) <= (_the_information)->maximum) ? E_OBJ : /* object is in use */ \ - E_ID) /* simply a bad id */ - -/* - * _ITRON_Objects_Clarify_get_id_error - * - * This function is invoked when an object get ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Objects_Clarify_get_id_error( _the_information, _id ) \ - (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \ - ((_id) <= 0) ? E_ID : /* bogus index of 0 - -3 */ \ - ((_id) <= (_the_information)->maximum) ? E_NOEXS : /* does not exist */ \ - E_ID) /* simply a bad id */ - - -/* - * _ITRON_Objects_Free - * - * Free this ITRON object to the pool of inactive objects. This - * operation is the same as for the Classic and POSIX APIs. - */ - -#define _ITRON_Objects_Free( _the_information, _the_object ) \ - _Objects_Free( (_the_information), (_the_object) ) - - -/* - * _ITRON_Objects_Get - * - * Obtain (get) the pointer to the control block for the object - * specified by "id". The ITRON id passed in here is simply - * the "index" portion of the traditional RTEMS ID. This - * requires that this operation be slightly different - * from the object get used by the Classic and POSIX APIs. - */ - -#define _ITRON_Objects_Get( _the_information, _id, _the_object ) \ - _Objects_Get_by_index( (_the_information), (_id), (_the_object) ) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/port.h b/c/src/exec/itron/include/rtems/itron/port.h deleted file mode 100644 index f8e17c630f..0000000000 --- a/c/src/exec/itron/include/rtems/itron/port.h +++ /dev/null @@ -1,61 +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$ - */ - -#ifndef __RTEMS_ITRON_PORT_h_ -#define __RTEMS_ITRON_PORT_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* - * The following defines the control block used to manage each port. - */ - -typedef struct { - ITRON_Objects_Control Object; - unsigned32 XXX_more_stuff_goes_here; -} ITRON_Port_Control; - -/* - * The following defines the information control block used to manage - * this class of objects. - */ - -ITRON_EXTERN Objects_Information _ITRON_Port_Information; - -/* - * _ITRON_Port_Manager_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this manager. - */ - -void _ITRON_Port_Manager_initialization( - unsigned32 maximum_ports -); - -/* - * XXX insert private stuff here - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/semaphore.h b/c/src/exec/itron/include/rtems/itron/semaphore.h deleted file mode 100644 index f9c327bba4..0000000000 --- a/c/src/exec/itron/include/rtems/itron/semaphore.h +++ /dev/null @@ -1,59 +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$ - */ - -#ifndef __RTEMS_ITRON_SEMAPHORE_h_ -#define __RTEMS_ITRON_SEMAPHORE_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/* - * The following defines the control block used to manage each semaphore. - */ - -typedef struct { - ITRON_Objects_Control Object; - boolean is_priority_blocking; - CORE_semaphore_Control semaphore; -} ITRON_Semaphore_Control; - -/* - * The following defines the information control block used to manage - * this class of objects. - */ - -ITRON_EXTERN Objects_Information _ITRON_Semaphore_Information; - -/* - * _ITRON_Semaphore_Manager_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this manager. - */ - -void _ITRON_Semaphore_Manager_initialization( - unsigned32 maximum_semaphores -); - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/sysmgmt.h b/c/src/exec/itron/include/rtems/itron/sysmgmt.h deleted file mode 100644 index f6cea9a693..0000000000 --- a/c/src/exec/itron/include/rtems/itron/sysmgmt.h +++ /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$ - */ - -#ifndef __RTEMS_ITRON_TIME_h_ -#define __RTEMS_ITRON_TIME_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert private stuff here - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/task.h b/c/src/exec/itron/include/rtems/itron/task.h deleted file mode 100644 index 3d8d0aa8f5..0000000000 --- a/c/src/exec/itron/include/rtems/itron/task.h +++ /dev/null @@ -1,102 +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$ - */ - -#ifndef __RTEMS_ITRON_TASK_h_ -#define __RTEMS_ITRON_TASK_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -/* - * This macro evaluates to TRUE if there should be a "context error." - * This is defined as a blocking directive being issed from - * task-independent portions or a task in dispatch disabled state. - * - * NOTE: Dispatching is disabled in interrupts so this should cover - * both cases. - */ - -#define _ITRON_Is_in_non_task_state() \ - (_Thread_Dispatch_disable_level != 0) - -/* - * This is the API specific information required by each thread for - * the ITRON API to function correctly. - */ - - -typedef struct { - unsigned32 unused; /* no use for the API extension */ - /* structure for ITRON identified yet */ -} ITRON_API_Control; - -/* - * The following defines the information control block used to - * manage this class of objects. - */ - -ITRON_EXTERN Objects_Information _ITRON_Task_Information; - -/* - * These are used to manage the user initialization tasks. - */ - -ITRON_EXTERN itron_initialization_tasks_table - *_ITRON_Task_User_initialization_tasks; -ITRON_EXTERN unsigned32 _ITRON_Task_Number_of_initialization_tasks; - - -/* - * _ITRON_Task_Manager_initialization - * - * This routine initializes the ITRON Task Manager. - */ - -void _ITRON_Task_Manager_initialization( - unsigned32 maximum_tasks, - unsigned32 number_of_initialization_tasks, - itron_initialization_tasks_table *user_tasks -); - -/* - * - * _ITRON_Delete_task - */ - -ER _ITRON_Delete_task( - Thread_Control *the_thread -); - -/* XXX remove the need for this. Enable dispatch should not be hidden */ - -#define _ITRON_return_errorno( _errno ) \ -do { \ - _Thread_Enable_dispatch(); \ - return _errno; \ -} while (0); - - -#ifndef __RTEMS_APPLICATION__ -#include -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/time.h b/c/src/exec/itron/include/rtems/itron/time.h deleted file mode 100644 index f13bd2d981..0000000000 --- a/c/src/exec/itron/include/rtems/itron/time.h +++ /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$ - */ - -#ifndef __RTEMS_ITRON_TIME_h_ -#define __RTEMS_ITRON_TIME_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert private stuff here - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/include/rtems/itron/vmempool.h b/c/src/exec/itron/include/rtems/itron/vmempool.h deleted file mode 100644 index 35db087da8..0000000000 --- a/c/src/exec/itron/include/rtems/itron/vmempool.h +++ /dev/null @@ -1,62 +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$ - */ - -#ifndef __RTEMS_ITRON_VARIABLE_MEMORYPOOL_h_ -#define __RTEMS_ITRON_VARIABLE_MEMORYPOOL_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* - * The following defines the control block used to manage each variable - * memory pool. - */ - -typedef struct { - ITRON_Objects_Control Object; - unsigned32 XXX_more_stuff_goes_here; -} ITRON_Variable_memory_pool_Control; - -/* - * The following defines the information control block used to manage - * this class of objects. - */ - -ITRON_EXTERN Objects_Information _ITRON_Variable_memory_pool_Information; - -/* - * _ITRON_Variable_memory_pool_Manager_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this manager. - */ - -void _ITRON_Variable_memory_pool_Manager_initialization( - unsigned32 maximum_variable_memory_pools -); - -/* - * XXX insert private stuff here - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/.cvsignore b/c/src/exec/itron/inline/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/inline/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/inline/Makefile.am b/c/src/exec/itron/inline/Makefile.am deleted file mode 100644 index c0d667c927..0000000000 --- a/c/src/exec/itron/inline/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -## -## $Id$ -## - - -include_rtems_itrondir = $(includedir)/rtems/itron - -$(PROJECT_INCLUDE)/rtems/itron: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/%: % - $(INSTALL_DATA) $< $@ - -if INLINE -include_rtems_itron_HEADERS = rtems/itron/eventflags.inl \ - rtems/itron/fmempool.inl rtems/itron/intr.inl rtems/itron/mbox.inl \ - rtems/itron/msgbuffer.inl rtems/itron/network.inl rtems/itron/port.inl \ - rtems/itron/semaphore.inl rtems/itron/sysmgmt.inl rtems/itron/task.inl \ - rtems/itron/time.inl rtems/itron/vmempool.inl - -PREINSTALL_FILES = $(PROJECT_INCLUDE)/rtems/itron \ - $(include_rtems_itron_HEADERS:%=$(PROJECT_INCLUDE)/%) -endif - -all-local: $(PREINSTALL_FILES) - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/itron/inline/rtems/.cvsignore b/c/src/exec/itron/inline/rtems/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/inline/rtems/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/inline/rtems/itron/.cvsignore b/c/src/exec/itron/inline/rtems/itron/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/inline/rtems/itron/eventflags.inl b/c/src/exec/itron/inline/rtems/itron/eventflags.inl deleted file mode 100644 index b4d8416714..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/eventflags.inl +++ /dev/null @@ -1,151 +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$ - */ - -#ifndef __ITRON_EVENTFLAGS_inl_ -#define __ITRON_EVENTFLAGS_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Eventflags_Allocate - * - * DESCRIPTION: - * - * This routine allocates the eventflags associated with the specified - * eventflags ID from the pool of inactive eventflagss. - * - * Input parameters: - * flgid - id of eventflags to allocate - * status - pointer to status variable - * - * Output parameters: - * returns - pointer to the eventflags control block - * *status - status - */ - -RTEMS_INLINE_ROUTINE ITRON_Eventflags_Control *_ITRON_Eventflags_Allocate( - ID flgid -) -{ - return (ITRON_Eventflags_Control *)_ITRON_Objects_Allocate_by_index( - &_ITRON_Eventflags_Information, - flgid, - sizeof(ITRON_Eventflags_Control) - ); -} - -/* - * _ITRON_Eventflags_Clarify_allocation_id_error - * - * This function is invoked when an object allocation ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Eventflags_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Eventflags_Information, (_id) ) - -/* - * _ITRON_Eventflags_Clarify_get_id_error - * - * This function is invoked when an object get ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Eventflags_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Eventflags_Information, (_id) ) - -/* - * _ITRON_Eventflags_Free - * - * DESCRIPTION: - * - * This routine frees a eventflags control block to the - * inactive chain of free eventflags control blocks. - * - * Input parameters: - * the_eventflags - pointer to eventflags control block - * - * Output parameters: NONE - */ - -RTEMS_INLINE_ROUTINE void _ITRON_Eventflags_Free ( - ITRON_Eventflags_Control *the_eventflags -) -{ - _ITRON_Objects_Free( &_ITRON_Eventflags_Information, &the_eventflags->Object ); -} - -/*PAGE - * - * _ITRON_Eventflags_Get - * - * DESCRIPTION: - * - * This function maps eventflags IDs to eventflags control blocks. - * If ID corresponds to a local eventflags, then it returns - * the_eventflags control pointer which maps to ID and location - * is set to OBJECTS_LOCAL. if the eventflags ID is global and - * resides on a remote node, then location is set to OBJECTS_REMOTE, - * and the_eventflags is undefined. Otherwise, location is set - * to OBJECTS_ERROR and the_eventflags is undefined. - * - * Input parameters: - * id - ITRON eventflags ID. - * the_location - pointer to a location variable - * - * Output parameters: - * *the_location - location of the object - */ - -RTEMS_INLINE_ROUTINE ITRON_Eventflags_Control *_ITRON_Eventflags_Get ( - ID id, - Objects_Locations *location -) -{ - return (ITRON_Eventflags_Control *) - _ITRON_Objects_Get( &_ITRON_Eventflags_Information, id, location ); -} - -/*PAGE - * - * _ITRON_Eventflags_Is_null - * - * This function returns TRUE if the_eventflags is NULL and FALSE otherwise. - * - * Input parameters: - * the_eventflags - pointer to eventflags control block - * - * Output parameters: - * TRUE - if the_eventflags is NULL - * FALSE - otherwise - */ - -RTEMS_INLINE_ROUTINE boolean _ITRON_Eventflags_Is_null ( - ITRON_Eventflags_Control *the_eventflags -) -{ - return ( the_eventflags == NULL ); -} - -/* - * XXX insert inline routines here - */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/fmempool.inl b/c/src/exec/itron/inline/rtems/itron/fmempool.inl deleted file mode 100644 index 9709edfd95..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/fmempool.inl +++ /dev/null @@ -1,158 +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$ - */ - -#ifndef __ITRON_FIXED_MEMORY_POOL_inl_ -#define __ITRON_FIXED_MEMORY_POOL_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Fixed_memory_pool_Allocate - * - * DESCRIPTION: - * - * This routine allocates the fixed_memory_pool associated with the specified - * fixed_memory_pool ID from the pool of inactive fixed_memory_pools. - * - * Input parameters: - * mpfid - id of fixed_memory_pool to allocate - * status - pointer to status variable - * - * Output parameters: - * returns - pointer to the fixed_memory_pool control block - * *status - status - */ - -RTEMS_INLINE_ROUTINE ITRON_Fixed_memory_pool_Control - *_ITRON_Fixed_memory_pool_Allocate( - ID mpfid -) -{ - return (ITRON_Fixed_memory_pool_Control *)_ITRON_Objects_Allocate_by_index( - &_ITRON_Fixed_memory_pool_Information, - mpfid, - sizeof(ITRON_Fixed_memory_pool_Control) - ); -} - -/* - * _ITRON_Fixed_memory_pool_Clarify_allocation_id_error - * - * This function is invoked when an object allocation ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Fixed_memory_pool_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Fixed_memory_pool_Information, (_id) ) - -/* - * _ITRON_Fixed_memory_pool_Clarify_get_id_error - * - * This function is invoked when an object get ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Fixed_memory_pool_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( \ - &_ITRON_Fixed_memory_pool_Information, (_id) ) - -/* - * _ITRON_Fixed_memory_pool_Free - * - * DESCRIPTION: - * - * This routine frees a fixed_memory_pool control block to the - * inactive chain of free fixed_memory_pool control blocks. - * - * Input parameters: - * the_fixed_memory_pool - pointer to fixed_memory_pool control block - * - * Output parameters: NONE - */ - -RTEMS_INLINE_ROUTINE void _ITRON_Fixed_memory_pool_Free ( - ITRON_Fixed_memory_pool_Control *the_fixed_memory_pool -) -{ - _ITRON_Objects_Free( - &_ITRON_Fixed_memory_pool_Information, - &the_fixed_memory_pool->Object - ); -} - -/*PAGE - * - * _ITRON_Fixed_memory_pool_Get - * - * DESCRIPTION: - * - * This function maps fixed memory pool IDs to control blocks. - * If ID corresponds to a local fixed memory pool, then it returns - * the_fixed memory pool control pointer which maps to ID and location - * is set to OBJECTS_LOCAL. if the fixed memory pool ID is global and - * resides on a remote node, then location is set to OBJECTS_REMOTE, - * and the fixed memory pool is undefined. Otherwise, location is set - * to OBJECTS_ERROR and the fixed memory pool is undefined. - * - * Input parameters: - * id - ITRON fixed memory pool ID. - * the_location - pointer to a location variable - * - * Output parameters: - * *the_location - location of the object - */ - -RTEMS_INLINE_ROUTINE ITRON_Fixed_memory_pool_Control - *_ITRON_Fixed_memory_pool_Get ( - ID id, - Objects_Locations *location -) -{ - return (ITRON_Fixed_memory_pool_Control *) - _ITRON_Objects_Get( &_ITRON_Fixed_memory_pool_Information, id, location ); -} - -/*PAGE - * - * _ITRON_Fixed_memory_pool_Is_null - * - * This function returns TRUE if the_fixed_memory_pool is NULL - * and FALSE otherwise. - * - * Input parameters: - * the_fixed_memory_pool - pointer to fixed_memory_pool control block - * - * Output parameters: - * TRUE - if the_fixed_memory_pool is NULL - * FALSE - otherwise - */ - -RTEMS_INLINE_ROUTINE boolean _ITRON_Fixed_memory_pool_Is_null ( - ITRON_Fixed_memory_pool_Control *the_fixed_memory_pool -) -{ - return ( the_fixed_memory_pool == NULL ); -} - -/* - * XXX insert inline routines here - */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/intr.inl b/c/src/exec/itron/inline/rtems/itron/intr.inl deleted file mode 100644 index 93c44eff00..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/intr.inl +++ /dev/null @@ -1,30 +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$ - */ - -#ifndef __ITRON_INTERRUPT_inl_ -#define __ITRON_INTERRUPT_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert inline routines here - */ - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/mbox.inl b/c/src/exec/itron/inline/rtems/itron/mbox.inl deleted file mode 100644 index fa2f96848d..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/mbox.inl +++ /dev/null @@ -1,151 +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$ - */ - -#ifndef __ITRON_MAILBOX_inl_ -#define __ITRON_MAILBOX_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Mailbox_Allocate - * - * DESCRIPTION: - * - * This routine allocates the mailbox associated with the specified - * mailbox ID from the pool of inactive mailboxs. - * - * Input parameters: - * mbxid - id of mailbox to allocate - * status - pointer to status variable - * - * Output parameters: - * returns - pointer to the mailbox control block - * *status - status - */ - -RTEMS_INLINE_ROUTINE ITRON_Mailbox_Control *_ITRON_Mailbox_Allocate( - ID mbxid -) -{ - return (ITRON_Mailbox_Control *)_ITRON_Objects_Allocate_by_index( - &_ITRON_Mailbox_Information, - mbxid, - sizeof(ITRON_Mailbox_Control) - ); -} - -/* - * _ITRON_Mailbox_Clarify_allocation_id_error - * - * This function is invoked when an object allocation ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Mailbox_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Mailbox_Information, (_id) ) - -/* - * _ITRON_Mailbox_Clarify_get_id_error - * - * This function is invoked when an object get ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Mailbox_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Mailbox_Information, (_id) ) - -/* - * _ITRON_Mailbox_Free - * - * DESCRIPTION: - * - * This routine frees a mailbox control block to the - * inactive chain of free mailbox control blocks. - * - * Input parameters: - * the_mailbox - pointer to mailbox control block - * - * Output parameters: NONE - */ - -RTEMS_INLINE_ROUTINE void _ITRON_Mailbox_Free ( - ITRON_Mailbox_Control *the_mailbox -) -{ - _ITRON_Objects_Free( &_ITRON_Mailbox_Information, &the_mailbox->Object ); -} - -/*PAGE - * - * _ITRON_Mailbox_Get - * - * DESCRIPTION: - * - * This function maps mailbox IDs to mailbox control blocks. - * If ID corresponds to a local mailbox, then it returns - * the_mailbox control pointer which maps to ID and location - * is set to OBJECTS_LOCAL. if the mailbox ID is global and - * resides on a remote node, then location is set to OBJECTS_REMOTE, - * and the_mailbox is undefined. Otherwise, location is set - * to OBJECTS_ERROR and the_mailbox is undefined. - * - * Input parameters: - * id - ITRON mailbox ID. - * the_location - pointer to a location variable - * - * Output parameters: - * *the_location - location of the object - */ - -RTEMS_INLINE_ROUTINE ITRON_Mailbox_Control *_ITRON_Mailbox_Get ( - ID id, - Objects_Locations *location -) -{ - return (ITRON_Mailbox_Control *) - _ITRON_Objects_Get( &_ITRON_Mailbox_Information, id, location ); -} - -/*PAGE - * - * _ITRON_Mailbox_Is_null - * - * This function returns TRUE if the_mailbox is NULL and FALSE otherwise. - * - * Input parameters: - * the_mailbox - pointer to mailbox control block - * - * Output parameters: - * TRUE - if the_mailbox is NULL - * FALSE - otherwise - */ - -RTEMS_INLINE_ROUTINE boolean _ITRON_Mailbox_Is_null ( - ITRON_Mailbox_Control *the_mailbox -) -{ - return ( the_mailbox == NULL ); -} - -/* - * XXX insert inline routines here - */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/msgbuffer.inl b/c/src/exec/itron/inline/rtems/itron/msgbuffer.inl deleted file mode 100644 index a8ac6e2aac..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/msgbuffer.inl +++ /dev/null @@ -1,156 +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$ - */ - -#ifndef __ITRON_MESSAGE_BUFFER_inl_ -#define __ITRON_MESSAGE_BUFFER_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Message_buffer_Allocate - * - * DESCRIPTION: - * - * This routine allocates the message buffer associated with the specified - * message buffer ID from the pool of inactive message buffers. - * - * Input parameters: - * mbfid - id of message buffer to allocate - * status - pointer to status variable - * - * Output parameters: - * returns - pointer to the message buffer control block - * *status - status - */ - -RTEMS_INLINE_ROUTINE ITRON_Message_buffer_Control - *_ITRON_Message_buffer_Allocate( - ID mbfid -) -{ - return (ITRON_Message_buffer_Control *)_ITRON_Objects_Allocate_by_index( - &_ITRON_Message_buffer_Information, - mbfid, - sizeof(ITRON_Message_buffer_Control) - ); -} - -/* - * _ITRON_Message_buffer_Clarify_allocation_id_error - * - * This function is invoked when an object allocation ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Message_buffer_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Message_buffer_Information, (_id) ) - -/* - * _ITRON_Message_buffer_Clarify_get_id_error - * - * This function is invoked when an object get ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Message_buffer_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Message_buffer_Information, (_id) ) - -/* - * _ITRON_Message_buffer_Free - * - * DESCRIPTION: - * - * This routine frees a message buffer control block to the - * inactive chain of free message buffer control blocks. - * - * Input parameters: - * the_message_buffer - pointer to message_buffer control block - * - * Output parameters: NONE - */ - -RTEMS_INLINE_ROUTINE void _ITRON_Message_buffer_Free ( - ITRON_Message_buffer_Control *the_message_buffer -) -{ - _ITRON_Objects_Free( - &_ITRON_Message_buffer_Information, - &the_message_buffer->Object - ); -} - -/*PAGE - * - * _ITRON_Message_buffer_Get - * - * DESCRIPTION: - * - * This function maps message buffer IDs to message buffer control blocks. - * If ID corresponds to a local message buffer, then it returns - * the message buffer control pointer which maps to ID and location - * is set to OBJECTS_LOCAL. if the message buffer ID is global and - * resides on a remote node, then location is set to OBJECTS_REMOTE, - * and the message buffer is undefined. Otherwise, location is set - * to OBJECTS_ERROR and the message buffer is undefined. - * - * Input parameters: - * id - ITRON message_buffer ID. - * the_location - pointer to a location variable - * - * Output parameters: - * *the_location - location of the object - */ - -RTEMS_INLINE_ROUTINE ITRON_Message_buffer_Control *_ITRON_Message_buffer_Get ( - ID id, - Objects_Locations *location -) -{ - return (ITRON_Message_buffer_Control *) - _ITRON_Objects_Get( &_ITRON_Message_buffer_Information, id, location ); -} - -/*PAGE - * - * _ITRON_Message_buffer_Is_null - * - * This function returns TRUE if the_message_buffer is NULL - * and FALSE otherwise. - * - * Input parameters: - * the_message_buffer - pointer to message buffer control block - * - * Output parameters: - * TRUE - if the_message_buffer is NULL - * FALSE - otherwise - */ - -RTEMS_INLINE_ROUTINE boolean _ITRON_Message_buffer_Is_null ( - ITRON_Message_buffer_Control *the_message_buffer -) -{ - return ( the_message_buffer == NULL ); -} - -/* - * XXX insert inline routines here - */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/network.inl b/c/src/exec/itron/inline/rtems/itron/network.inl deleted file mode 100644 index dd833bb079..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/network.inl +++ /dev/null @@ -1,30 +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$ - */ - -#ifndef __ITRON_NETWORK_inl_ -#define __ITRON_NETWORK_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert inline routines here - */ - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/port.inl b/c/src/exec/itron/inline/rtems/itron/port.inl deleted file mode 100644 index 4593b38ca0..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/port.inl +++ /dev/null @@ -1,151 +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$ - */ - -#ifndef __ITRON_PORT_inl_ -#define __ITRON_PORT_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Port_Allocate - * - * DESCRIPTION: - * - * This routine allocates the port associated with the specified - * port ID from the pool of inactive ports. - * - * Input parameters: - * porid - id of port to allocate - * status - pointer to status variable - * - * Output parameters: - * returns - pointer to the port control block - * *status - status - */ - -RTEMS_INLINE_ROUTINE ITRON_Port_Control *_ITRON_Port_Allocate( - ID porid -) -{ - return (ITRON_Port_Control *)_ITRON_Objects_Allocate_by_index( - &_ITRON_Port_Information, - porid, - sizeof(ITRON_Port_Control) - ); -} - -/* - * _ITRON_Port_Clarify_allocation_id_error - * - * This function is invoked when an object allocation ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Port_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Port_Information, (_id) ) - -/* - * _ITRON_Port_Clarify_get_id_error - * - * This function is invoked when an object get ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Port_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Port_Information, (_id) ) - -/* - * _ITRON_Port_Free - * - * DESCRIPTION: - * - * This routine frees a port control block to the - * inactive chain of free port control blocks. - * - * Input parameters: - * the_port - pointer to port control block - * - * Output parameters: NONE - */ - -RTEMS_INLINE_ROUTINE void _ITRON_Port_Free ( - ITRON_Port_Control *the_port -) -{ - _ITRON_Objects_Free( &_ITRON_Port_Information, &the_port->Object ); -} - -/*PAGE - * - * _ITRON_Port_Get - * - * DESCRIPTION: - * - * This function maps port IDs to port control blocks. - * If ID corresponds to a local port, then it returns - * the_port control pointer which maps to ID and location - * is set to OBJECTS_LOCAL. if the port ID is global and - * resides on a remote node, then location is set to OBJECTS_REMOTE, - * and the_port is undefined. Otherwise, location is set - * to OBJECTS_ERROR and the_port is undefined. - * - * Input parameters: - * id - ITRON port ID. - * the_location - pointer to a location variable - * - * Output parameters: - * *the_location - location of the object - */ - -RTEMS_INLINE_ROUTINE ITRON_Port_Control *_ITRON_Port_Get ( - ID id, - Objects_Locations *location -) -{ - return (ITRON_Port_Control *) - _ITRON_Objects_Get( &_ITRON_Port_Information, id, location ); -} - -/*PAGE - * - * _ITRON_Port_Is_null - * - * This function returns TRUE if the_port is NULL and FALSE otherwise. - * - * Input parameters: - * the_port - pointer to port control block - * - * Output parameters: - * TRUE - if the_port is NULL - * FALSE - otherwise - */ - -RTEMS_INLINE_ROUTINE boolean _ITRON_Port_Is_null ( - ITRON_Port_Control *the_port -) -{ - return ( the_port == NULL ); -} - -/* - * XXX insert inline routines here - */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/semaphore.inl b/c/src/exec/itron/inline/rtems/itron/semaphore.inl deleted file mode 100644 index 0fb234bb6b..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/semaphore.inl +++ /dev/null @@ -1,183 +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$ - */ - -#ifndef __ITRON_SEMAPHORE_inl_ -#define __ITRON_SEMAPHORE_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Semaphore_Allocate - * - * DESCRIPTION: - * - * This routine allocates the semaphore associated with the specified - * semaphore ID from the pool of inactive semaphores. - * - * Input parameters: - * semid - id of semaphore to allocate - * status - pointer to status variable - * - * Output parameters: - * returns - pointer to the semaphore control block - * *status - status - */ - -RTEMS_INLINE_ROUTINE ITRON_Semaphore_Control *_ITRON_Semaphore_Allocate( - ID semid -) -{ - return (ITRON_Semaphore_Control *)_ITRON_Objects_Allocate_by_index( - &_ITRON_Semaphore_Information, - semid, - sizeof(ITRON_Semaphore_Control) - ); -} - -/* - * _ITRON_Semaphore_Clarify_allocation_id_error - * - * This function is invoked when an object allocation ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Semaphore_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Semaphore_Information, (_id) ) - -/* - * _ITRON_Semaphore_Clarify_get_id_error - * - * This function is invoked when an object get ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Semaphore_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Semaphore_Information, (_id) ) - -/* - * _ITRON_Semaphore_Free - * - * DESCRIPTION: - * - * This routine frees a semaphore control block to the - * inactive chain of free semaphore control blocks. - * - * Input parameters: - * the_semaphore - pointer to semaphore control block - * - * Output parameters: NONE - */ - -RTEMS_INLINE_ROUTINE void _ITRON_Semaphore_Free ( - ITRON_Semaphore_Control *the_semaphore -) -{ - _ITRON_Objects_Free( &_ITRON_Semaphore_Information, &the_semaphore->Object ); -} - -/*PAGE - * - * _ITRON_Semaphore_Get - * - * DESCRIPTION: - * - * This function maps semaphore IDs to semaphore control blocks. - * If ID corresponds to a local semaphore, then it returns - * the_semaphore control pointer which maps to ID and location - * is set to OBJECTS_LOCAL. if the semaphore ID is global and - * resides on a remote node, then location is set to OBJECTS_REMOTE, - * and the_semaphore is undefined. Otherwise, location is set - * to OBJECTS_ERROR and the_semaphore is undefined. - * - * Input parameters: - * id - ITRON semaphore ID. - * the_location - pointer to a location variable - * - * Output parameters: - * *the_location - location of the object - */ - -RTEMS_INLINE_ROUTINE ITRON_Semaphore_Control *_ITRON_Semaphore_Get ( - ID id, - Objects_Locations *location -) -{ - return (ITRON_Semaphore_Control *) - _ITRON_Objects_Get( &_ITRON_Semaphore_Information, id, location ); -} - -/*PAGE - * - * _ITRON_Semaphore_Is_null - * - * This function returns TRUE if the_semaphore is NULL and FALSE otherwise. - * - * Input parameters: - * the_semaphore - pointer to semaphore control block - * - * Output parameters: - * TRUE - if the_semaphore is NULL - * FALSE - otherwise - */ - -RTEMS_INLINE_ROUTINE boolean _ITRON_Semaphore_Is_null ( - ITRON_Semaphore_Control *the_semaphore -) -{ - return ( the_semaphore == NULL ); -} - -/* - * _ITRON_Semaphore_Translate_core_semaphore_return_code - * - * This function returns a ITRON status code based on the semaphore - * status code specified. - * - * Input parameters: - * the_semaphore_status - semaphore status code to translate - * - * Output parameters: - * ITRON status code - translated ITRON status code - * - */ - -RTEMS_INLINE_ROUTINE ER _ITRON_Semaphore_Translate_core_semaphore_return_code ( - unsigned32 the_semaphore_status -) -{ -/* XXX need to be able to return "E_RLWAI" */ - switch ( the_semaphore_status ) { - case CORE_SEMAPHORE_STATUS_SUCCESSFUL: - return E_OK; - case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT: - return E_TMOUT; - case CORE_SEMAPHORE_WAS_DELETED: - return E_DLT; - case CORE_SEMAPHORE_TIMEOUT: - return E_TMOUT; - case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED: - return E_QOVR; - case THREAD_STATUS_PROXY_BLOCKING: - return THREAD_STATUS_PROXY_BLOCKING; - } - return E_OK; /* unreached - only to remove warnings */ -} - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/sysmgmt.inl b/c/src/exec/itron/inline/rtems/itron/sysmgmt.inl deleted file mode 100644 index 183232a785..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/sysmgmt.inl +++ /dev/null @@ -1,30 +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$ - */ - -#ifndef __ITRON_TIME_inl_ -#define __ITRON_TIME_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert inline routines here - */ - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/task.inl b/c/src/exec/itron/inline/rtems/itron/task.inl deleted file mode 100644 index 37056e5d09..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/task.inl +++ /dev/null @@ -1,181 +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$ - */ - -#ifndef __ITRON_TASK_inl_ -#define __ITRON_TASK_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Task_Allocate - * - * DESCRIPTION: - * - * This routine allocates the task associated with the specified - * task ID from the pool of inactive tasks. - * - * Input parameters: - * tskid - id of task to allocate - * status - pointer to status variable - * - * Output parameters: - * returns - pointer to the task control block - * *status - status - */ - -RTEMS_INLINE_ROUTINE Thread_Control *_ITRON_Task_Allocate( - ID tskid -) -{ - return (Thread_Control *)_ITRON_Objects_Allocate_by_index( - &_ITRON_Task_Information, - tskid, - sizeof(Thread_Control) - ); -} - -/* - * _ITRON_Task_Clarify_allocation_id_error - * - * This function is invoked when an object allocation ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Task_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Task_Information, (_id) ) - -/* - * _ITRON_Task_Clarify_get_id_error - * - * This function is invoked when an object get ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Task_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Task_Information, (_id) ) - -/* - * _ITRON_Task_Free - * - * DESCRIPTION: - * - * This routine frees a task control block to the - * inactive chain of free task control blocks. - * - * Input parameters: - * the_task - pointer to task control block - * - * Output parameters: NONE - */ - -RTEMS_INLINE_ROUTINE void _ITRON_Task_Free ( - Thread_Control *the_task -) -{ - _ITRON_Objects_Free( &_ITRON_Task_Information, &the_task->Object ); -} - -/*PAGE - * - * _ITRON_Task_Get - * - * DESCRIPTION: - * - * This function maps task IDs to task control blocks. - * If ID corresponds to a local task, then it returns - * the_task control pointer which maps to ID and location - * is set to OBJECTS_LOCAL. if the task ID is global and - * resides on a remote node, then location is set to OBJECTS_REMOTE, - * and the_task is undefined. Otherwise, location is set - * to OBJECTS_ERROR and the_task is undefined. - * - * Input parameters: - * id - ITRON task ID. - * the_location - pointer to a location variable - * - * Output parameters: - * *the_location - location of the object - */ - -RTEMS_INLINE_ROUTINE Thread_Control *_ITRON_Task_Get ( - ID id, - Objects_Locations *location -) -{ - if ( id == 0 ) { - _Thread_Disable_dispatch(); - *location = OBJECTS_LOCAL; - return _Thread_Executing; - } - - return (Thread_Control *) - _ITRON_Objects_Get( &_ITRON_Task_Information, id, location ); -} - -/*PAGE - * - * _ITRON_Task_Is_null - * - * This function returns TRUE if the_task is NULL and FALSE otherwise. - * - * Input parameters: - * the_task - pointer to task control block - * - * Output parameters: - * TRUE - if the_task is NULL - * FALSE - otherwise - */ - -RTEMS_INLINE_ROUTINE boolean _ITRON_Task_Is_null ( - Thread_Control *the_task -) -{ - return ( the_task == NULL ); -} - -/* - * XXX insert inline routines here - */ - -/*PAGE - * - * _ITRON_tasks_Priority_to_Core - */ - -RTEMS_INLINE_ROUTINE _ITRON_Task_Priority_to_Core( - PRI ITRON_priority -) -{ - return (Priority_Control) ITRON_priority; -} - -/*PAGE - * - * _ITRON_tasks_Core_to_Priority - */ - -RTEMS_INLINE_ROUTINE _ITRON_Task_Core_to_Priority( - Priority_Control core_priority -) -{ - return (PRI) core_priority; -} - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/exec/itron/inline/rtems/itron/time.inl b/c/src/exec/itron/inline/rtems/itron/time.inl deleted file mode 100644 index 183232a785..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/time.inl +++ /dev/null @@ -1,30 +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$ - */ - -#ifndef __ITRON_TIME_inl_ -#define __ITRON_TIME_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert inline routines here - */ - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/inline/rtems/itron/vmempool.inl b/c/src/exec/itron/inline/rtems/itron/vmempool.inl deleted file mode 100644 index d1d18ef351..0000000000 --- a/c/src/exec/itron/inline/rtems/itron/vmempool.inl +++ /dev/null @@ -1,161 +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$ - */ - -#ifndef __ITRON_VARIABLE_MEMORY_POOL_inl_ -#define __ITRON_VARIABLE_MEMORY_POOL_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Variable_memory_pool_Allocate - * - * DESCRIPTION: - * - * This routine allocates the variable memory pool associated with - * the specified variable memory pool ID from the pool of inactive - * variable memory pools. - * - * Input parameters: - * mplid - id of variable memory pool to allocate - * status - pointer to status variable - * - * Output parameters: - * returns - pointer to the variable memory pool control block - * *status - status - */ - -RTEMS_INLINE_ROUTINE ITRON_Variable_memory_pool_Control - *_ITRON_Variable_memory_pool_Allocate( - ID mplid -) -{ - return (ITRON_Variable_memory_pool_Control *)_ITRON_Objects_Allocate_by_index( - &_ITRON_Variable_memory_pool_Information, - mplid, - sizeof(ITRON_Variable_memory_pool_Control) - ); -} - -/* - * _ITRON_Variable_memory_pool_Clarify_allocation_id_error - * - * This function is invoked when an object allocation ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Variable_memory_pool_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Variable_memory_pool_Information, (_id) ) - -/* - * _ITRON_Variable_memory_pool_Clarify_get_id_error - * - * This function is invoked when an object get ID error - * occurs to determine the specific ITRON error code to return. - */ - -#define _ITRON_Variable_memory_pool_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Variable_memory_pool_Information, (_id) ) - -/* - * _ITRON_Variable_memory_pool_Free - * - * DESCRIPTION: - * - * This routine frees a variable memory pool control block to the - * inactive chain of free variable memory pool control blocks. - * - * Input parameters: - * the_variable_memory_pool - pointer to variable memory pool control block - * - * Output parameters: NONE - */ - -RTEMS_INLINE_ROUTINE void _ITRON_Variable_memory_pool_Free ( - ITRON_Variable_memory_pool_Control *the_variable_memory_pool -) -{ - _ITRON_Objects_Free( - &_ITRON_Variable_memory_pool_Information, - &the_variable_memory_pool->Object - ); -} - -/*PAGE - * - * _ITRON_Variable_memory_pool_Get - * - * DESCRIPTION: - * - * This function maps variable memory pool IDs to variable memory pool - * control blocks. If ID corresponds to a local variable memory pool, - * then it returns the variable memory pool control pointer which maps - * to ID and location is set to OBJECTS_LOCAL. if the variable memory - * pool ID is global and resides on a remote node, then location is set - * to OBJECTS_REMOTE, and the variable memory pool is undefined. Otherwise, - * location is set to OBJECTS ERROR and the variable memory pool is undefined. - * - * Input parameters: - * id - ITRON variable memory pool ID. - * the_location - pointer to a location variable - * - * Output parameters: - * *the_location - location of the object - */ - -RTEMS_INLINE_ROUTINE ITRON_Variable_memory_pool_Control - *_ITRON_Variable_memory_pool_Get ( - ID id, - Objects_Locations *location -) -{ - return (ITRON_Variable_memory_pool_Control *) _ITRON_Objects_Get( - &_ITRON_Variable_memory_pool_Information, - id, - location - ); -} - -/*PAGE - * - * _ITRON_Variable_memory_pool_Is_null - * - * This function returns TRUE if the_variable_memory_pool is NULL - * and FALSE otherwise. - * - * Input parameters: - * the_variable_memory_pool - pointer to variable memory pool control block - * - * Output parameters: - * TRUE - if the_variable_memory_pool is NULL - * FALSE - otherwise - */ - -RTEMS_INLINE_ROUTINE boolean _ITRON_Variable_memory_pool_Is_null ( - ITRON_Variable_memory_pool_Control *the_variable_memory_pool -) -{ - return ( the_variable_memory_pool == NULL ); -} - -/* - * XXX insert inline routines here - */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/.cvsignore b/c/src/exec/itron/macros/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/macros/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/macros/Makefile.am b/c/src/exec/itron/macros/Makefile.am deleted file mode 100644 index 954b38e39c..0000000000 --- a/c/src/exec/itron/macros/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -## -## $Id$ -## - - -include_rtems_itrondir = $(includedir)/rtems/itron - -$(PROJECT_INCLUDE)/rtems/itron: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/%: % - $(INSTALL_DATA) $< $@ - -if MACROS -include_rtems_itron_HEADERS = rtems/itron/eventflags.inl \ - rtems/itron/fmempool.inl rtems/itron/intr.inl rtems/itron/mbox.inl \ - rtems/itron/msgbuffer.inl rtems/itron/network.inl rtems/itron/port.inl \ - rtems/itron/semaphore.inl rtems/itron/sysmgmt.inl rtems/itron/task.inl \ - rtems/itron/time.inl rtems/itron/vmempool.inl - -PREINSTALL_FILES = $(PROJECT_INCLUDE)/rtems/itron \ - $(include_rtems_itron_HEADERS:%=$(PROJECT_INCLUDE)/%) -endif - -all-local: $(PREINSTALL_FILES) - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/itron/macros/rtems/.cvsignore b/c/src/exec/itron/macros/rtems/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/macros/rtems/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/macros/rtems/itron/.cvsignore b/c/src/exec/itron/macros/rtems/itron/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/itron/macros/rtems/itron/eventflags.inl b/c/src/exec/itron/macros/rtems/itron/eventflags.inl deleted file mode 100644 index 73e6ded0b1..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/eventflags.inl +++ /dev/null @@ -1,76 +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$ - */ - -#ifndef __ITRON_EVENTFLAGS_inl_ -#define __ITRON_EVENTFLAGS_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Eventflags_Allocate - */ - -#define _ITRON_Eventflags_Allocate( _flgid ) \ - (ITRON_Eventflags_Control *)_ITRON_Objects_Allocate_by_index( \ - &_ITRON_Eventflags_Information, \ - (_flgid), \ - sizeof(ITRON_Eventflags_Control) \ - ) - -/* - * _ITRON_Eventflags_Clarify_allocation_id_error - */ - -#define _ITRON_Eventflags_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Eventflags_Information, (_id) ) - -/* - * _ITRON_Eventflags_Clarify_get_id_error - */ - -#define _ITRON_Eventflags_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Eventflags_Information, (_id) ) - -/* - * _ITRON_Eventflags_Free - */ - -#define _ITRON_Eventflags_Free( _the_eventflags ) \ - _ITRON_Objects_Free( &_ITRON_Eventflags_Information, \ - &(_the_eventflags)->Object ) - - -/* - * _ITRON_Eventflags_Get - */ - -#define _ITRON_Eventflags_Get( _id, _location ) \ - (ITRON_Eventflags_Control *) \ - _ITRON_Objects_Get( &_ITRON_Eventflags_Information, (_id), (_location) ) - -/*PAGE - * - * _ITRON_Eventflags_Is_null - */ - -#define _ITRON_Eventflags_Is_null( _the_eventflags ) \ - ( (_the_eventflags) == NULL ); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/fmempool.inl b/c/src/exec/itron/macros/rtems/itron/fmempool.inl deleted file mode 100644 index 5d1f6db314..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/fmempool.inl +++ /dev/null @@ -1,78 +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$ - */ - -#ifndef __ITRON_FIXED_MEMORY_POOL_inl_ -#define __ITRON_FIXED_MEMORY_POOL_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Fixed_memory_pool_Allocate - */ - -#define _ITRON_Fixed_memory_pool_Allocate( _mpfid ) \ - (ITRON_Fixed_memory_pool_Control *)_ITRON_Objects_Allocate_by_index( \ - &_ITRON_Fixed_memory_pool_Information, \ - (_mpfid), \ - sizeof(ITRON_Fixed_memory_pool_Control) \ - ) - -/* - * _ITRON_Fixed_memory_pool_Clarify_allocation_id_error - */ - -#define _ITRON_Fixed_memory_pool_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Fixed_memory_pool_Information, (_id) ) - -/* - * _ITRON_Fixed_memory_pool_Clarify_get_id_error - */ - -#define _ITRON_Fixed_memory_pool_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( \ - &_ITRON_Fixed_memory_pool_Information, (_id) ) - -/* - * _ITRON_Fixed_memory_pool_Free - */ - -#define _ITRON_Fixed_memory_pool_Free( _the_fixed_memory_pool ) \ - _ITRON_Objects_Free( \ - &_ITRON_Fixed_memory_pool_Information, \ - &(_the_fixed_memory_pool)->Object \ - ) - -/* - * _ITRON_Fixed_memory_pool_Get - */ - -#define _ITRON_Fixed_memory_pool_Get( _id, _location ) \ - (ITRON_Fixed_memory_pool_Control *) \ - _ITRON_Objects_Get( &_ITRON_Fixed_memory_pool_Information, \ - (_id), (_location) ) - -/* - * _ITRON_Fixed_memory_pool_Is_null - */ - -#define _ITRON_Fixed_memory_pool_Is_null( _the_fixed_memory_pool ) \ - ( (_the_fixed_memory_pool) == NULL ) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/intr.inl b/c/src/exec/itron/macros/rtems/itron/intr.inl deleted file mode 100644 index 93c44eff00..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/intr.inl +++ /dev/null @@ -1,30 +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$ - */ - -#ifndef __ITRON_INTERRUPT_inl_ -#define __ITRON_INTERRUPT_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert inline routines here - */ - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/mbox.inl b/c/src/exec/itron/macros/rtems/itron/mbox.inl deleted file mode 100644 index 739cd46f88..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/mbox.inl +++ /dev/null @@ -1,75 +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$ - */ - -#ifndef __ITRON_MAILBOX_inl_ -#define __ITRON_MAILBOX_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Mailbox_Allocate - */ - -#define _ITRON_Mailbox_Allocate( _mbxid ) \ - (ITRON_Mailbox_Control *)_ITRON_Objects_Allocate_by_index( \ - &_ITRON_Mailbox_Information, \ - (_mbxid), \ - sizeof(ITRON_Mailbox_Control) \ - ) - -/* - * _ITRON_Mailbox_Clarify_allocation_id_error - */ - -#define _ITRON_Mailbox_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Mailbox_Information, (_id) ) - -/* - * _ITRON_Mailbox_Clarify_get_id_error - */ - -#define _ITRON_Mailbox_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Mailbox_Information, (_id) ) - -/* - * _ITRON_Mailbox_Free - */ - -#define _ITRON_Mailbox_Free( _the_mailbox ) \ - _ITRON_Objects_Free( &_ITRON_Mailbox_Information, &(_the_mailbox)->Object ) - -/*PAGE - * - * _ITRON_Mailbox_Get - */ - -#define _ITRON_Mailbox_Get( _id, _location ) \ - (ITRON_Mailbox_Control *) \ - _ITRON_Objects_Get( &_ITRON_Mailbox_Information, (_id), (_location) ) - -/*PAGE - * - * _ITRON_Mailbox_Is_null - */ - -#define _ITRON_Mailbox_Is_null( _the_mailbox ) \ - ( (_the_mailbox) == NULL ) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/msgbuffer.inl b/c/src/exec/itron/macros/rtems/itron/msgbuffer.inl deleted file mode 100644 index be33b7d107..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/msgbuffer.inl +++ /dev/null @@ -1,78 +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$ - */ - -#ifndef __ITRON_MESSAGE_BUFFER_inl_ -#define __ITRON_MESSAGE_BUFFER_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Message_buffer_Allocate - */ - -#define _ITRON_Message_buffer_Allocate( _mbfid ) \ - (ITRON_Message_buffer_Control *)_ITRON_Objects_Allocate_by_index( \ - &_ITRON_Message_buffer_Information, \ - (_mbfid), \ - sizeof(ITRON_Message_buffer_Control) \ - ) - -/* - * _ITRON_Message_buffer_Clarify_allocation_id_error - */ - -#define _ITRON_Message_buffer_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Message_buffer_Information, (_id) ) - -/* - * _ITRON_Message_buffer_Clarify_get_id_error - */ - -#define _ITRON_Message_buffer_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Message_buffer_Information, (_id) ) - -/* - * _ITRON_Message_buffer_Free - */ - -#define _ITRON_Message_buffer_Free( _the_message_buffer ) \ - _ITRON_Objects_Free( \ - &_ITRON_Message_buffer_Information, \ - &(_the_message_buffer)->Object \ - ) - -/*PAGE - * - * _ITRON_Message_buffer_Get - */ - -#define _ITRON_Message_buffer_Get( _id, _location ) \ - (ITRON_Message_buffer_Control *) \ - _ITRON_Objects_Get( &_ITRON_Message_buffer_Information, (_id), (_location) ) - -/*PAGE - * - * _ITRON_Message_buffer_Is_null - */ - -#define _ITRON_Message_buffer_Is_null( _the_message_buffer ) \ - ( (_the_message_buffer) == NULL ) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/network.inl b/c/src/exec/itron/macros/rtems/itron/network.inl deleted file mode 100644 index dd833bb079..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/network.inl +++ /dev/null @@ -1,30 +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$ - */ - -#ifndef __ITRON_NETWORK_inl_ -#define __ITRON_NETWORK_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert inline routines here - */ - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/port.inl b/c/src/exec/itron/macros/rtems/itron/port.inl deleted file mode 100644 index 0f402fef3c..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/port.inl +++ /dev/null @@ -1,75 +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$ - */ - -#ifndef __ITRON_PORT_inl_ -#define __ITRON_PORT_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Port_Allocate - */ - -#define _ITRON_Port_Allocate( _porid ) \ - (ITRON_Port_Control *)_ITRON_Objects_Allocate_by_index( \ - &_ITRON_Port_Information, \ - (_porid), \ - sizeof(ITRON_Port_Control) \ - ) - -/* - * _ITRON_Port_Clarify_allocation_id_error - */ - -#define _ITRON_Port_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Port_Information, (_id) ) - -/* - * _ITRON_Port_Clarify_get_id_error - */ - -#define _ITRON_Port_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Port_Information, (_id) ) - -/* - * _ITRON_Port_Free - */ - -#define _ITRON_Port_Free( _the_port ) \ - _ITRON_Objects_Free( &_ITRON_Port_Information, &(_the_port)->Object ) - -/*PAGE - * - * _ITRON_Port_Get - */ - -#define _ITRON_Port_Get( _id, _location ) \ - (ITRON_Port_Control *) \ - _ITRON_Objects_Get( &_ITRON_Port_Information, (_id), (_location) ) - -/*PAGE - * - * _ITRON_Port_Is_null - */ - -#define _ITRON_Port_Is_null( _the_port ) \ - ( (_the_port) == NULL ) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/semaphore.inl b/c/src/exec/itron/macros/rtems/itron/semaphore.inl deleted file mode 100644 index ec435e1648..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/semaphore.inl +++ /dev/null @@ -1,102 +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$ - */ - -#ifndef __ITRON_SEMAPHORE_inl_ -#define __ITRON_SEMAPHORE_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Semaphore_Allocate - */ - -#define _ITRON_Semaphore_Allocate( _semid ) \ - (ITRON_Semaphore_Control *)_ITRON_Objects_Allocate_by_index( \ - &_ITRON_Semaphore_Information, \ - (_semid), \ - sizeof(ITRON_Semaphore_Control) \ - ) - -/* - * _ITRON_Semaphore_Clarify_allocation_id_error - */ - -#define _ITRON_Semaphore_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Semaphore_Information, (_id) ) - -/* - * _ITRON_Semaphore_Clarify_get_id_error - */ - -#define _ITRON_Semaphore_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Semaphore_Information, (_id) ) - -/* - * _ITRON_Semaphore_Free - */ - -#define _ITRON_Semaphore_Free( _the_semaphore ) \ - _ITRON_Objects_Free( &_ITRON_Semaphore_Information, &(_the_semaphore)->Object ) - -/*PAGE - * - * _ITRON_Semaphore_Get - */ - -#define _ITRON_Semaphore_Get( _id, _location ) \ - (ITRON_Semaphore_Control *) \ - _ITRON_Objects_Get( &_ITRON_Semaphore_Information, (_id), (_location) ) - -/*PAGE - * - * _ITRON_Semaphore_Is_null - */ - -#define _ITRON_Semaphore_Is_null( _the_semaphore ) \ - ( (_the_semaphore) == NULL ) - -/* - * _ITRON_Semaphore_Translate_core_semaphore_return_code - */ - -/* XXX fix me */ -static ER _ITRON_Semaphore_Translate_core_semaphore_return_code ( - unsigned32 the_semaphore_status -) -{ -/* XXX need to be able to return "E_RLWAI" */ - switch ( the_semaphore_status ) { - case CORE_SEMAPHORE_STATUS_SUCCESSFUL: - return E_OK; - case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT: - return E_TMOUT; - case CORE_SEMAPHORE_WAS_DELETED: - return E_DLT; - case CORE_SEMAPHORE_TIMEOUT: - return E_TMOUT; - case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED: - return E_QOVR; - case THREAD_STATUS_PROXY_BLOCKING: - return THREAD_STATUS_PROXY_BLOCKING; - } - return E_OK; /* unreached - only to remove warnings */ -} - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/sysmgmt.inl b/c/src/exec/itron/macros/rtems/itron/sysmgmt.inl deleted file mode 100644 index 183232a785..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/sysmgmt.inl +++ /dev/null @@ -1,30 +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$ - */ - -#ifndef __ITRON_TIME_inl_ -#define __ITRON_TIME_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert inline routines here - */ - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/task.inl b/c/src/exec/itron/macros/rtems/itron/task.inl deleted file mode 100644 index 807a02fc6f..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/task.inl +++ /dev/null @@ -1,102 +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$ - */ - -#ifndef __ITRON_TASK_inl_ -#define __ITRON_TASK_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Task_Allocate - */ - -#define _ITRON_Task_Allocate( _tskid ) \ - (Thread_Control *)_ITRON_Objects_Allocate_by_index( \ - &_ITRON_Task_Information, \ - (_tskid), \ - sizeof(Thread_Control) \ - ) - -/* - * _ITRON_Task_Clarify_allocation_id_error - */ - -#define _ITRON_Task_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Task_Information, (_id) ) - -/* - * _ITRON_Task_Clarify_get_id_error - */ - -#define _ITRON_Task_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Task_Information, (_id) ) - -/* - * _ITRON_Task_Free - */ - -#define _ITRON_Task_Free( _the_task ) \ - _ITRON_Objects_Free( &_ITRON_Task_Information, &(_the_task)->Object ) - -/*PAGE - * - * _ITRON_Task_Get - */ - -/* XXX fix me */ -static Thread_Control *_ITRON_Task_Get ( - ID id, - Objects_Locations *location -) -{ - if ( id == 0 ) { - _Thread_Disable_dispatch(); - *location = OBJECTS_LOCAL; - return _Thread_Executing; - } - - return (Thread_Control *) - _ITRON_Objects_Get( &_ITRON_Task_Information, id, location ); -} - -/*PAGE - * - * _ITRON_Task_Is_null - */ - -#define _ITRON_Task_Is_null( _the_task ) \ - ( (_the_task) == NULL ) - -/*PAGE - * - * _ITRON_tasks_Priority_to_Core - */ - -#define _ITRON_Task_Priority_to_Core( _ITRON_priority ) \ - ((Priority_Control) (_ITRON_priority)) - -/*PAGE - * - * _ITRON_tasks_Core_to_Priority - */ - -#define _ITRON_Task_Core_to_Priority( _core_priority ) \ - ((PRI) (_core_priority)) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/exec/itron/macros/rtems/itron/time.inl b/c/src/exec/itron/macros/rtems/itron/time.inl deleted file mode 100644 index 183232a785..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/time.inl +++ /dev/null @@ -1,30 +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$ - */ - -#ifndef __ITRON_TIME_inl_ -#define __ITRON_TIME_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * XXX insert inline routines here - */ - - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/macros/rtems/itron/vmempool.inl b/c/src/exec/itron/macros/rtems/itron/vmempool.inl deleted file mode 100644 index e235e477ed..0000000000 --- a/c/src/exec/itron/macros/rtems/itron/vmempool.inl +++ /dev/null @@ -1,81 +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$ - */ - -#ifndef __ITRON_VARIABLE_MEMORY_POOL_inl_ -#define __ITRON_VARIABLE_MEMORY_POOL_inl_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * _ITRON_Variable_memory_pool_Allocate - */ - -#define _ITRON_Variable_memory_pool_Allocate( _mplid ) \ - (ITRON_Variable_memory_pool_Control *)_ITRON_Objects_Allocate_by_index( \ - &_ITRON_Variable_memory_pool_Information, \ - (_mplid), \ - sizeof(ITRON_Variable_memory_pool_Control) \ - ) - -/* - * _ITRON_Variable_memory_pool_Clarify_allocation_id_error - */ - -#define _ITRON_Variable_memory_pool_Clarify_allocation_id_error( _id ) \ - _ITRON_Objects_Clarify_allocation_id_error( \ - &_ITRON_Variable_memory_pool_Information, (_id) ) - -/* - * _ITRON_Variable_memory_pool_Clarify_get_id_error - */ - -#define _ITRON_Variable_memory_pool_Clarify_get_id_error( _id ) \ - _ITRON_Objects_Clarify_get_id_error( &_ITRON_Variable_memory_pool_Information, (_id) ) - -/* - * _ITRON_Variable_memory_pool_Free - */ - -#define _ITRON_Variable_memory_pool_Free( _the_variable_memory_pool ) \ - _ITRON_Objects_Free( \ - &_ITRON_Variable_memory_pool_Information, \ - &(_the_variable_memory_pool)->Object \ - ) - -/*PAGE - * - * _ITRON_Variable_memory_pool_Get - */ - -#define _ITRON_Variable_memory_pool_Get( _id, _location ) \ - (ITRON_Variable_memory_pool_Control *) _ITRON_Objects_Get( \ - &_ITRON_Variable_memory_pool_Information, \ - (_id), \ - (_location) \ - ) - -/*PAGE - * - * _ITRON_Variable_memory_pool_Is_null - */ - -#define _ITRON_Variable_memory_pool_Is_null( _the_variable_memory_pool ) \ - ( (_the_variable_memory_pool) == NULL ) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ - diff --git a/c/src/exec/itron/src/.cvsignore b/c/src/exec/itron/src/.cvsignore deleted file mode 100644 index 9188ae45da..0000000000 --- a/c/src/exec/itron/src/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -stamp-h -stamp-h.in -config.h -config.h.in diff --git a/c/src/exec/itron/src/Makefile.am b/c/src/exec/itron/src/Makefile.am deleted file mode 100644 index 0c8ca41d51..0000000000 --- a/c/src/exec/itron/src/Makefile.am +++ /dev/null @@ -1,66 +0,0 @@ -## -## $Id$ -## - -LIB=$(ARCH)/libitron.a - -INCLUDES = -I. - -TASK_C_FILES = task.c cre_tsk.c del_tsk.c sta_tsk.c ext_tsk.c exd_tsk.c \ - ter_tsk.c dis_dsp.c ena_dsp.c chg_pri.c rot_rdq.c rel_wai.c get_tid.c \ - ref_tsk.c - -TASKSYNC_C_FILES = sus_tsk.c rsm_tsk.c frsm_tsk.c slp_tsk.c tslp_tsk.c \ - wup_tsk.c can_wup.c - -SEMAPHORE_C_FILES = itronsem.c cre_sem.c del_sem.c preq_sem.c ref_sem.c \ - sig_sem.c twai_sem.c wai_sem.c - -EVENTFLAGS_C_FILES = eventflags.c - -MAILBOX_C_FILES = mbox.c - -MSGBUFFER_C_FILES = msgbuffer.c msgbuffertranslatereturncode.c cre_mbf.c \ - del_mbf.c prcv_mbf.c psnd_mbf.c rcv_mbf.c ref_mbf.c snd_mbf.c trcv_mbf.c \ - tsnd_mbf.c - -RENDEZVOUS_C_FILES = port.c - -INTERRUPT_C_FILES = itronintr.c - -VARIABLE_MEMORY_POOL_C_FILES = vmempool.c - -FIXED_MEMORY_POOL_C_FILES = fmempool.c - -TIME_C_FILES = itrontime.c - -CONFIGURATION_C_FILES = sysmgmt.c - -NETWORK_C_FILES = network.c - -C_FILES = $(TASK_C_FILES) $(TASKSYNC_C_FILES) $(SEMAPHORE_C_FILES) \ - $(EVENTFLAGS_C_FILES) $(MAILBOX_C_FILES) $(MSGBUFFER_C_FILES) \ - $(RENDEZVOUS_C_FILES) $(INTERRUPT_C_FILES) \ - $(VARIABLE_MEMORY_POOL_C_FILES) $(FIXED_MEMORY_POOL_C_FILES) \ - $(TIME_C_FILES) -C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) - -OBJS = $(C_O_FILES) - -include $(top_srcdir)/../automake/multilib.am -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/lib.am - -AM_CPPFLAGS += -D__RTEMS_INSIDE__ - -all-local: ${ARCH} ${LIB} - -$(LIB): ${OBJS} - $(make-library) - -UNUSED_C_FILES = cre_mbx.c del_mbx.c mboxtranslatereturncode.c network.c \ - prcv_mbx.c rcv_mbx.c ref_mbx.c snd_mbx.c sysmgmt.c trcv_mbx.c - -EXTRA_DIST = $(C_FILES) $(UNUSED_C_FILES) - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/itron/src/TODO b/c/src/exec/itron/src/TODO deleted file mode 100644 index 8b87f58c8a..0000000000 --- a/c/src/exec/itron/src/TODO +++ /dev/null @@ -1,13 +0,0 @@ -# -# $Id$ -# - -The overall status including a major item todo list is in the Status -chapter of the RTEMS ITRON API User's Guide. This file contains very -short things that need to be addressed. - -+ unlimited object not support for allocate by index. Support either - needs to be added for this type of object or the manager initialization - code needs to consider it a fatal error to configure the object class - in this mode. - diff --git a/c/src/exec/itron/src/can_wup.c b/c/src/exec/itron/src/can_wup.c deleted file mode 100644 index 57fb24f8d0..0000000000 --- a/c/src/exec/itron/src/can_wup.c +++ /dev/null @@ -1,53 +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 - -#include -#include -#include -#include -#include - -#include - -/* - * can_wup - Cancel Wakeup Request - */ - -ER can_wup( - INT *p_wupcnt, - ID tskid -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - /* - * XXX - FILL ME IN. - */ - break; - } - - _ITRON_return_errorno( E_OK ); -} - diff --git a/c/src/exec/itron/src/chg_pri.c b/c/src/exec/itron/src/chg_pri.c deleted file mode 100644 index 9e0641c118..0000000000 --- a/c/src/exec/itron/src/chg_pri.c +++ /dev/null @@ -1,70 +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 - -#include -#include -#include -#include -#include - -#include - -/* - * chg_pri - Change Task Priority - */ - -ER chg_pri( - ID tskid, - PRI tskpri -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - Priority_Control new_priority; - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - if (_States_Is_dormant( the_thread->current_state )) - _ITRON_return_errorno( E_OBJ ); - - if (( tskpri <= 0 ) || ( tskpri >= 256 )) - _ITRON_return_errorno( E_PAR ); - - new_priority = _ITRON_Task_Priority_to_Core( tskpri ); - the_thread->real_priority = new_priority; - - /* - * The priority should not be changed until later if priority - * inheratance has occured. - */ - - if ( the_thread->resource_count == 0 || - the_thread->current_priority > new_priority ) - _Thread_Change_priority( the_thread, new_priority, FALSE ); - - break; - } - - _ITRON_return_errorno( E_OK ); -} - - diff --git a/c/src/exec/itron/src/cre_mbf.c b/c/src/exec/itron/src/cre_mbf.c deleted file mode 100644 index 18b40c1520..0000000000 --- a/c/src/exec/itron/src/cre_mbf.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * cre_mbf - Create MessageBuffer - */ - -ER cre_mbf( - ID mbfid, - T_CMBF *pk_cmbf -) -{ - CORE_message_queue_Attributes the_msgq_attributes; - ITRON_Message_buffer_Control *the_message_buffer; - - /* - * Bad pointer to the attributes structure - */ - - if ( !pk_cmbf ) - return E_PAR; - - /* - * Bits were set that were note defined. - */ - - if (pk_cmbf->mbfatr & ~(TA_TPRI)) - return E_RSATR; - - if (pk_cmbf->bufsz < 0 || pk_cmbf->maxmsz < 0) - return E_PAR; - - if (pk_cmbf->bufsz < pk_cmbf->maxmsz) - return E_PAR; - - _Thread_Disable_dispatch(); /* prevents deletion */ - - the_message_buffer = _ITRON_Message_buffer_Allocate(mbfid); - if ( !the_message_buffer ) { - _Thread_Enable_dispatch(); - return _ITRON_Message_buffer_Clarify_allocation_id_error(mbfid); - } - - if ( pk_cmbf->mbfatr & TA_TPRI ) - the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY; - else - the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO; - - _CORE_message_queue_Initialize( - &the_message_buffer->message_queue, - &the_msgq_attributes, - pk_cmbf->bufsz / pk_cmbf->maxmsz, - pk_cmbf->maxmsz - ); - - _ITRON_Objects_Open( &_ITRON_Message_buffer_Information, - &the_message_buffer->Object ); - - /* - * If multiprocessing were supported, this is where we would announce - * the existence of the semaphore to the rest of the system. - */ - -#if defined(RTEMS_MULTIPROCESSING) -#endif - - _Thread_Enable_dispatch(); - - return E_OK; -} diff --git a/c/src/exec/itron/src/cre_mbx.c b/c/src/exec/itron/src/cre_mbx.c deleted file mode 100644 index ed586512f5..0000000000 --- a/c/src/exec/itron/src/cre_mbx.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * ITRON 3.0 Mailbox Manager - * - * 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 - -/* - * cre_mbx - Create Mailbox - * - * Creates a Mailbox according to the following spec: - * - * ------Parameters------------------------- - * ID mbxid MailboxID - * T_CMBX *pk_cmbx Packet to Create Mailbox - * ----------------------------------------- - * -*pk_cmbx members*- - * VP exinf ExtendedInformation - * ATR mbxatr MailboxAttributes - * (the use of the following information - * is implementation dependent) - * INT bufcnt BufferMessageCount - * (CPU and/or implementation-dependent information - * may also be included) - * - * ----Return Parameters-------------------- - * ER ercd ErrorCode - * ----------------------------------------- - * - * - * ----C Language Interface----------------- - * ER ercd = cre_mbx ( ID mbxid, T_CMBX *pk_cmbx ) ; - * ----------------------------------------- - * - */ - -ER cre_mbx( - ID mbxid, - T_CMBX *pk_cmbx -) -{ - register ITRON_Mailbox_Control *the_mailbox; - CORE_message_queue_Attributes the_mailbox_attributes; - - if ( !pk_cmbx ) - return E_PAR; - - if ((pk_cmbx->mbxatr & (TA_TPRI | TA_MPRI)) != 0 ) - return E_RSATR; - - _Thread_Disable_dispatch(); /* protects object pointer */ - - the_mailbox = _ITRON_Mailbox_Allocate( mbxid ); - if ( !the_mailbox ) { - _Thread_Enable_dispatch(); - return _ITRON_Mailbox_Clarify_allocation_id_error( mbxid ); - } - - the_mailbox->count = pk_cmbx->bufcnt; - if (pk_cmbx->mbxatr & TA_MPRI) - the_mailbox->do_message_priority = TRUE; - else - the_mailbox->do_message_priority = FALSE; - - if (pk_cmbx->mbxatr & TA_TPRI) - the_mailbox_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY; - else - the_mailbox_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO; - - if ( !_CORE_message_queue_Initialize( - &the_mailbox->message_queue, - OBJECTS_ITRON_MAILBOXES, - &the_mailbox_attributes, - the_mailbox->count, - sizeof(T_MSG *), - NULL ) ) { /* Multiprocessing not supported */ - _ITRON_Mailbox_Free(the_mailbox); - _ITRON_return_errorno( E_OBJ ); - } - - _ITRON_Objects_Open( &_ITRON_Mailbox_Information, &the_mailbox->Object ); - - /* - * If multiprocessing were supported, this is where we would announce - * the existence of the semaphore to the rest of the system. - */ - -#if defined(RTEMS_MULTIPROCESSING) -#endif - - _ITRON_return_errorno( E_OK ); -} diff --git a/c/src/exec/itron/src/cre_sem.c b/c/src/exec/itron/src/cre_sem.c deleted file mode 100644 index 44671a3921..0000000000 --- a/c/src/exec/itron/src/cre_sem.c +++ /dev/null @@ -1,98 +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 - -#include -#include -#include - -/* - * cre_sem - Create Semaphore - * - * This function implements the ITRON 3.0 cre_sem() service. - */ - -ER cre_sem( - ID semid, - T_CSEM *pk_csem -) -{ - CORE_semaphore_Attributes the_semaphore_attributes; - ITRON_Semaphore_Control *the_semaphore; - - /* - * Bad pointer to the attributes structure - */ - - if ( !pk_csem ) - return E_PAR; - - /* - * Bits were set that were note defined. - */ - - if ( pk_csem->sematr & _ITRON_SEMAPHORE_UNUSED_ATTRIBUTES ) - return E_RSATR; - - /* - * Initial semaphore count exceeds the maximum. - */ - - if ( pk_csem->isemcnt > pk_csem->maxsem ) - return E_PAR; - - /* - * This error is not in the specification but this condition - * does not make sense. - */ - - if ( pk_csem->maxsem == 0 ) - return E_PAR; - - _Thread_Disable_dispatch(); /* prevents deletion */ - - the_semaphore = _ITRON_Semaphore_Allocate( semid ); - if ( !the_semaphore ) { - _Thread_Enable_dispatch(); - return _ITRON_Semaphore_Clarify_allocation_id_error( semid ); - } - - if ( pk_csem->sematr & TA_TPRI ) - the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_PRIORITY; - else - the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO; - - the_semaphore_attributes.maximum_count = pk_csem->maxsem; - - _CORE_semaphore_Initialize( - &the_semaphore->semaphore, - &the_semaphore_attributes, - pk_csem->isemcnt - ); - - _ITRON_Objects_Open( &_ITRON_Semaphore_Information, &the_semaphore->Object ); - - /* - * If multiprocessing were supported, this is where we would announce - * the existence of the semaphore to the rest of the system. - */ - -#if defined(RTEMS_MULTIPROCESSING) -#endif - - _Thread_Enable_dispatch(); - return E_OK; -} diff --git a/c/src/exec/itron/src/cre_tsk.c b/c/src/exec/itron/src/cre_tsk.c deleted file mode 100644 index 892722e766..0000000000 --- a/c/src/exec/itron/src/cre_tsk.c +++ /dev/null @@ -1,124 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * cre_tsk - Create Task - */ - -ER cre_tsk( - ID tskid, - T_CTSK *pk_ctsk -) -{ - register Thread_Control *the_thread; - boolean status; - Priority_Control core_priority; - - /* - * Validate Parameters. - */ - - if ( pk_ctsk == NULL ) - return E_PAR; - - if ((pk_ctsk->tskatr != TA_ASM ) && - (pk_ctsk->tskatr != TA_HLNG) && - (pk_ctsk->tskatr != TA_COP0) && - (pk_ctsk->tskatr != TA_COP1) && - (pk_ctsk->tskatr != TA_COP2) && - (pk_ctsk->tskatr != TA_COP3) && - (pk_ctsk->tskatr != TA_COP4) && - (pk_ctsk->tskatr != TA_COP5) && - (pk_ctsk->tskatr != TA_COP6) && - (pk_ctsk->tskatr != TA_COP7)) - return E_RSATR; - - if (( pk_ctsk->itskpri <= 0 ) || ( pk_ctsk->itskpri >= 256 )) - return E_PAR; - if ( pk_ctsk->task == NULL ) - return E_PAR; - if ( pk_ctsk->stksz < 0 ) - return E_PAR; - - /* - * Disable dispatching. - */ - - _Thread_Disable_dispatch(); - - /* - * allocate the thread. - */ - - the_thread = _ITRON_Task_Allocate( tskid ); - if ( !the_thread ) - _ITRON_return_errorno( _ITRON_Task_Clarify_allocation_id_error( tskid ) ); - - /* - * Initialize the core thread for this task. - */ - - core_priority = _ITRON_Task_Priority_to_Core( pk_ctsk->itskpri ); - status = _Thread_Initialize( - &_ITRON_Task_Information, - the_thread, - NULL, - pk_ctsk->stksz, -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - TRUE, /* XXX - All tasks FP (if the HW supports it) for now */ -#else - FALSE, -#endif - core_priority, - TRUE, /* preemptible */ - THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE, - NULL, /* no budget algorithm callout */ - 0, - NULL - ); - - if ( !status ) { - _ITRON_Task_Free( the_thread ); - _ITRON_return_errorno( E_NOMEM ); - } - - /* - * This insures we evaluate the process-wide signals pending when we - * first run. - * - * NOTE: Since the thread starts with all unblocked, this is necessary. - */ - - the_thread->do_post_task_switch_extension = TRUE; - - the_thread->Start.entry_point = (Thread_Entry) pk_ctsk->task; - - _ITRON_return_errorno( E_OK ); -} - - - - diff --git a/c/src/exec/itron/src/del_mbf.c b/c/src/exec/itron/src/del_mbf.c deleted file mode 100644 index 4f89cf8f8c..0000000000 --- a/c/src/exec/itron/src/del_mbf.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * del_mbf - Delete MessageBuffer - */ - -ER del_mbf( - ID mbfid -) -{ - ITRON_Message_buffer_Control *the_message_buffer; - Objects_Locations location; - - the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location); - switch (location) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: /* Multiprocessing not supported */ - return _ITRON_Message_buffer_Clarify_get_id_error(mbfid); - - case OBJECTS_LOCAL: - _CORE_message_queue_Flush(&the_message_buffer->message_queue); - _ITRON_Objects_Close( &_ITRON_Message_buffer_Information, - &the_message_buffer->Object); - _ITRON_Message_buffer_Free(the_message_buffer); - - /* - * If multiprocessing were supported, this is where we would announce - * the existence of the semaphore to the rest of the system. - */ - -#if defined(RTEMS_MULTIPROCESSING) -#endif - _Thread_Enable_dispatch(); - return E_OK; - } - - return E_OK; -} diff --git a/c/src/exec/itron/src/del_mbx.c b/c/src/exec/itron/src/del_mbx.c deleted file mode 100644 index e448336502..0000000000 --- a/c/src/exec/itron/src/del_mbx.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ITRON 3.0 Mailbox Manager - * - * 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 - -/* - * del_mbx - Delete Mailbox - * - * - * ------Parameters-------------- - * ID mbxid The Mailbox's ID - * ------------------------------ - * - * -----Return Parameters------- - * ER ercd Itron Error Code - * ----------------------------- - * - * -----C Language Interface---- - * ER ercd = del_mbx(ID mbxid); - * ----------------------------- - * - */ - -ER del_mbx( - ID mbxid -) -{ - register ITRON_Mailbox_Control *the_mailbox; - Objects_Locations location; - - the_mailbox= _ITRON_Mailbox_Get( mbxid, &location ); - switch ( location ) { - case OBJECTS_ERROR: - case OBJECTS_REMOTE: - return _ITRON_Mailbox_Clarify_get_id_error( mbxid ); - - case OBJECTS_LOCAL: - _Objects_Close( &_ITRON_Mailbox_Information, &the_mailbox->Object ); - - _CORE_message_queue_Close( - &the_mailbox->message_queue, - NULL, /* Multiprocessing not supported */ - CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED - ); - - _ITRON_Mailbox_Free(the_mailbox); - break; - } - - _ITRON_return_errorno( E_OK ); -} diff --git a/c/src/exec/itron/src/del_sem.c b/c/src/exec/itron/src/del_sem.c deleted file mode 100644 index 4d507bd8bd..0000000000 --- a/c/src/exec/itron/src/del_sem.c +++ /dev/null @@ -1,68 +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 - -#include -#include -#include - -/* - * del_sem - Delete Semaphore - * - * This function implements the ITRON 3.0 del_sem() service. - */ - -ER del_sem( - ID semid -) -{ - ITRON_Semaphore_Control *the_semaphore; - Objects_Locations location; - - the_semaphore = _ITRON_Semaphore_Get( semid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: /* Multiprocessing not supported */ - case OBJECTS_ERROR: - return _ITRON_Semaphore_Clarify_get_id_error( semid ); - - case OBJECTS_LOCAL: - _CORE_semaphore_Flush( - &the_semaphore->semaphore, - NULL, /* Multiprocessing not supported */ - CORE_SEMAPHORE_WAS_DELETED - ); - - _ITRON_Objects_Close( - &_ITRON_Semaphore_Information, - &the_semaphore->Object - ); - - _ITRON_Semaphore_Free( the_semaphore ); - - /* - * If multiprocessing were supported, this is where we would announce - * the destruction of the semaphore to the rest of the system. - */ - -#if defined(RTEMS_MULTIPROCESSING) -#endif - - _Thread_Enable_dispatch(); - return E_OK; - - } - return E_OK; -} diff --git a/c/src/exec/itron/src/del_tsk.c b/c/src/exec/itron/src/del_tsk.c deleted file mode 100644 index 4b4a5b45c0..0000000000 --- a/c/src/exec/itron/src/del_tsk.c +++ /dev/null @@ -1,59 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * del_tsk - Delete Task - */ - -ER del_tsk( - ID tskid -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - ER result = E_OK; /* to avoid warning */ - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - - if ( _Thread_Is_executing( the_thread ) ) - _ITRON_return_errorno( E_OBJ ); - - if ( !_States_Is_dormant( the_thread->current_state ) ) - _ITRON_return_errorno( E_OBJ ); - - result = _ITRON_Delete_task( the_thread ); - break; - } - - _ITRON_return_errorno( result ); -} - diff --git a/c/src/exec/itron/src/dis_dsp.c b/c/src/exec/itron/src/dis_dsp.c deleted file mode 100644 index 3c83e8788a..0000000000 --- a/c/src/exec/itron/src/dis_dsp.c +++ /dev/null @@ -1,42 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * dis_dsp - Disable Dispatch - */ - -ER dis_dsp( void ) -{ - /* - * Disable dispatch for protection - */ - - _Thread_Disable_dispatch(); - - return E_OK; -} - - diff --git a/c/src/exec/itron/src/ena_dsp.c b/c/src/exec/itron/src/ena_dsp.c deleted file mode 100644 index d4abd4f0c4..0000000000 --- a/c/src/exec/itron/src/ena_dsp.c +++ /dev/null @@ -1,37 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * ena_dsp - Enable Dispatch - */ - -ER ena_dsp( void ) -{ - _Thread_Enable_dispatch(); - - return E_OK; -} - diff --git a/c/src/exec/itron/src/eventflags.c b/c/src/exec/itron/src/eventflags.c deleted file mode 100644 index 86296fca5d..0000000000 --- a/c/src/exec/itron/src/eventflags.c +++ /dev/null @@ -1,160 +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 - -#include - -/* - * _ITRON_Eventflags_Manager_initialization - * - * This routine initializes all event flags manager related data structures. - * - * Input parameters: - * maximum_eventflags - maximum configured eventflags - * - * Output parameters: NONE - */ - -void _ITRON_Eventflags_Manager_initialization( - unsigned32 maximum_eventflags -) -{ - _Objects_Initialize_information( - &_ITRON_Eventflags_Information, /* object information table */ - OBJECTS_ITRON_API, /* object API */ - OBJECTS_ITRON_EVENTFLAGS, /* object class */ - maximum_eventflags, /* maximum objects of this class */ - sizeof( ITRON_Eventflags_Control ), - /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - ITRON_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - FALSE, /* TRUE if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif - ); - - /* - * Register the MP Process Packet routine. - * - * NOTE: No MP Support YET in RTEMS ITRON implementation. - */ - -} - -/* - * cre_flg - Create Eventflag - */ - -ER cre_flg( - ID flgid, - T_CFLG *pk_cflg -) -{ - return E_OK; -} - -/* - * del_flg - Delete Eventflag - */ - -ER del_flg( - ID flgid -) -{ - return E_OK; -} - -/* - * set_flg - Set Eventflag - */ - -ER set_flg( - ID flgid, - UINT setptn -) -{ - return E_OK; -} - -/* - * clr_flg - Clear Eventflag - */ - -ER clr_flg( - ID flgid, - UINT clrptn -) -{ - return E_OK; -} - -/* - * wai_flg - Wait on Eventflag - */ - -ER wai_flg( - UINT *p_flgptn, - ID flgid, - UINT waiptn, - UINT wfmode -) -{ - return E_OK; -} - -/* - * pol_flg - Wait for Eventflag(Polling) - */ - -ER pol_flg( - UINT *p_flgptn, - ID flgid, - UINT waiptn, - UINT wfmode -) -{ - return E_OK; -} - -/* - * twai_flg - Wait on Eventflag with Timeout - */ - -ER twai_flg( - UINT *p_flgptn, - ID flgid, - UINT waiptn, - UINT wfmode, - TMO tmout -) -{ - return E_OK; -} - -/* - * ref_flg - Reference Eventflag Status - */ - -ER ref_flg( - T_RFLG *pk_rflg, - ID flgid -) -{ - return E_OK; -} - diff --git a/c/src/exec/itron/src/exd_tsk.c b/c/src/exec/itron/src/exd_tsk.c deleted file mode 100644 index 2d6432da13..0000000000 --- a/c/src/exec/itron/src/exd_tsk.c +++ /dev/null @@ -1,47 +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 -#include - -#include -#include -#include -#include -#include - -#include - -/* - * exd_tsk - Exit and Delete Task - */ - -void exd_tsk( void ) -{ - Objects_Information *the_information; - - _Thread_Disable_dispatch(); - - the_information = _Objects_Get_information( _Thread_Executing->Object.id ); - - /* This should never happen if _Thread_Get() works right */ - assert( the_information ); - - _Thread_Set_state( _Thread_Executing, STATES_DORMANT ); - _ITRON_Delete_task( _Thread_Executing ); - - _Thread_Enable_dispatch(); -} - diff --git a/c/src/exec/itron/src/ext_tsk.c b/c/src/exec/itron/src/ext_tsk.c deleted file mode 100644 index b9e4b6f4da..0000000000 --- a/c/src/exec/itron/src/ext_tsk.c +++ /dev/null @@ -1,46 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * ext_tsk - Exit Issuing Task - */ - -void ext_tsk( void ) -{ - /* - * Figure out what to do if this happens. - * We can not return regardless - if ( _ITRON_Is_in_non_task_state() ) - return E_CTX; - */ - - _Thread_Disable_dispatch(); - - _Thread_Set_state( _Thread_Executing, STATES_DORMANT ); - _Thread_Reset( _Thread_Executing, NULL, 0 ); - - _Thread_Enable_dispatch(); -} diff --git a/c/src/exec/itron/src/fmempool.c b/c/src/exec/itron/src/fmempool.c deleted file mode 100644 index 0058a2a090..0000000000 --- a/c/src/exec/itron/src/fmempool.c +++ /dev/null @@ -1,143 +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 - -#include - -/* - * _ITRON_Fixed_memory_pool_Manager_initialization - * - * This routine initializes all fixed memory pool manager related - * data structures. - * - * Input parameters: - * maximum_fixed_memory_pools - maximum configured fixed memory pools - * - * Output parameters: NONE - */ - -void _ITRON_Fixed_memory_pool_Manager_initialization( - unsigned32 maximum_fixed_memory_pools -) -{ - _Objects_Initialize_information( - &_ITRON_Fixed_memory_pool_Information, /* object information table */ - OBJECTS_ITRON_API, /* object API */ - OBJECTS_ITRON_FIXED_MEMORY_POOLS, /* object class */ - maximum_fixed_memory_pools, /* maximum objects of this class */ - sizeof( ITRON_Fixed_memory_pool_Control ), - /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - ITRON_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - FALSE, /* TRUE if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif - ); - - /* - * Register the MP Process Packet routine. - * - * NOTE: No MP Support YET in RTEMS ITRON implementation. - */ - -} - -/* - * cre_mpf - Create Fixed-Size Memorypool - */ - -ER cre_mpf( - ID mpfid, - T_CMPF *pk_cmpf -) -{ - return E_OK; -} - -/* - * del_mpf - Delete Fixed-Size Memorypool - */ - -ER del_mpf( - ID mpfid -) -{ - return E_OK; -} - -/* - * get_blf - Get Fixed-Size Memory Block - */ - -ER get_blf( - VP *p_blf, - ID mpfid -) -{ - return E_OK; -} - -/* - * pget_blf - Poll and Get Fixed-Size Memory Block - */ - -ER pget_blf( - VP *p_blf, - ID mpfid -) -{ - return E_OK; -} - -/* - * tget_blf - Get Fixed-Size Memory Block with Timeout - */ - -ER tget_blf( - VP *p_blf, - ID mpfid, - TMO tmout -) -{ - return E_OK; -} - -/* - * rel_blf - Release Fixed-Size Memory Block - */ - -ER rel_blf( - ID mpfid, - VP blf -) -{ - return E_OK; -} - -/* - * ref_mpf - Reference Fixed-Size Memorypool Status - */ - -ER ref_mpf( - T_RMPF *pk_rmpf, - ID mpfid -) -{ - return E_OK; -} - diff --git a/c/src/exec/itron/src/frsm_tsk.c b/c/src/exec/itron/src/frsm_tsk.c deleted file mode 100644 index c77238afc1..0000000000 --- a/c/src/exec/itron/src/frsm_tsk.c +++ /dev/null @@ -1,62 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * frsm_tsk - Forcibly Resume Suspended Task - */ - -ER frsm_tsk( - ID tskid -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - if ( _Thread_Is_executing( the_thread ) ) - _ITRON_return_errorno( E_OBJ ); - - if (_States_Is_dormant( the_thread->current_state )) - _ITRON_return_errorno( E_OBJ ); - - if ( ! _States_Is_suspended(the_thread->current_state) ) - _ITRON_return_errorno( E_OK ); - - _Thread_Resume( the_thread, TRUE ); - break; - } - - _ITRON_return_errorno( E_OK ); - -} - - diff --git a/c/src/exec/itron/src/get_tid.c b/c/src/exec/itron/src/get_tid.c deleted file mode 100644 index a082291714..0000000000 --- a/c/src/exec/itron/src/get_tid.c +++ /dev/null @@ -1,42 +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 - -#include -#include -#include -#include -#include - -#include - -/* - * get_tid - Get Task Identifier - */ - -ER get_tid( - ID *p_tskid -) -{ - /* - * This does not support multiprocessing. The id handling will have - * to be enhanced to support multiprocessing. - */ - - *p_tskid = _Objects_Get_index( _Thread_Executing->Object.id ); - return E_OK; -} - diff --git a/c/src/exec/itron/src/itronintr.c b/c/src/exec/itron/src/itronintr.c deleted file mode 100644 index 7aaa57fe8f..0000000000 --- a/c/src/exec/itron/src/itronintr.c +++ /dev/null @@ -1,111 +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 - -#include - -/* - * def_int - Define Interrupt Handler - */ - -ER def_int( - UINT dintno, - T_DINT *pk_dint -) -{ - return E_OK; -} - -/* - * ret_int - Return from Interrupt Handler - */ - -void ret_int( void ) -{ -} - -/* - * ret_wup - Return and Wakeup Task - */ - -void ret_wup( - ID tskid -) -{ -} - -/* - * loc_cpu - Lock CPU - */ - -ER loc_cpu( void ) -{ - return E_OK; -} - -/* - * unl_cpu - Unlock CPU - */ - -ER unl_cpu( void ) -{ - return E_OK; -} - -/* - * dis_int - Disable Interrupt - */ - -ER dis_int( - UINT eintno -) -{ - return E_OK; -} - -/* - * ena_int - Enable Interrupt - */ - -ER ena_int( - UINT eintno -) -{ - return E_OK; -} - -/* - * chg_iXX - Change Interrupt Mask(Level or Priority) - */ - -ER chg_iXX( - UINT iXXXX -) -{ - return E_OK; -} - -/* - * ref_iXX - Reference Interrupt Mask(Level or Priority) - */ - -ER ref_iXX( - UINT *p_iXXXX -) -{ - return E_OK; -} - diff --git a/c/src/exec/itron/src/itronsem.c b/c/src/exec/itron/src/itronsem.c deleted file mode 100644 index adb3637b83..0000000000 --- a/c/src/exec/itron/src/itronsem.c +++ /dev/null @@ -1,61 +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 - -#include -#include -#include - -/* - * _ITRON_Semaphore_Manager_initialization - * - * DESCRIPTION: - * - * This routine initializes all semaphore manager related data structures. - * - * Input parameters: - * maximum_semaphores - maximum configured semaphores - * - * Output parameters: NONE - */ - -void _ITRON_Semaphore_Manager_initialization( - unsigned32 maximum_semaphores -) -{ - _Objects_Initialize_information( - &_ITRON_Semaphore_Information, /* object information table */ - OBJECTS_ITRON_API, /* object API */ - OBJECTS_ITRON_SEMAPHORES, /* object class */ - maximum_semaphores, /* maximum objects of this class */ - sizeof( ITRON_Semaphore_Control ), /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - ITRON_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - FALSE, /* TRUE if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif - ); - - /* - * Register the MP Process Packet routine. - * - * NOTE: No MP Support YET in RTEMS ITRON implementation. - */ - -} - diff --git a/c/src/exec/itron/src/itrontime.c b/c/src/exec/itron/src/itrontime.c deleted file mode 100644 index fda7f9e030..0000000000 --- a/c/src/exec/itron/src/itrontime.c +++ /dev/null @@ -1,248 +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 - -#include -#include - -#include - -/* - * set_tim - Set System Clock - */ - -void converTime(SYSTIME ms, TOD_Control *time) -{ - int millisecond; - -/* XXX need to dereference structure */ -#if 0 - milisecond = ms % 1000; - tempSecond = ms / 1000; -#else - millisecond = 0; -#endif -} - - -/* - * set_tim - Set System Clock - */ - -ER set_tim( - SYSTIME *pk_tim -) -{ - Watchdog_Interval temp; /* an integer in seconds after conversion from SYSTIME */ - TOD_Control the_tod; - -/* convert *pk_tim which is 48 bits integer in binary into an ordinary - integer in milliseconds */ - -/* XXX */ temp = 0; - if(temp > 0) { - _Thread_Disable_dispatch(); - _TOD_Set(&the_tod, temp); - _Thread_Enable_dispatch(); - if(_TOD_Validate(&the_tod)){ - return E_OK; - } - } - return E_SYS; -} - -/* - * get_tim - Get System Clock - */ - -ER get_tim( - SYSTIME *pk_tim -) -{ - return E_OK; -} - -/* - * dly_tsk - Delay Task - */ - -ER dly_tsk( - DLYTIME dlytim -) -{ - Watchdog_Interval ticks; - - ticks = TOD_MILLISECONDS_TO_TICKS(dlytim); - - _Thread_Disable_dispatch(); - if ( ticks == 0 ) { - _Thread_Yield_processor(); - } else { - _Thread_Set_state( _Thread_Executing, STATES_DELAYING ); - _Watchdog_Initialize( - &_Thread_Executing->Timer, - _Thread_Delay_ended, - _Thread_Executing->Object.id, - NULL - ); - _Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks ); - } - _Thread_Enable_dispatch(); - return E_OK; -} - -/* - * def_cyc - Define Cyclic Handler - */ - -ER def_cyc( - HNO cycno, - T_DCYC *pk_dcyc -) -{ - Watchdog_Control *object; -#if 0 - Watchdog_Interval timeInterval; -#endif - -/* XXX */ object = 0; - if ( pk_dcyc->cycatr != TA_HLNG) - return E_RSATR; -#if 0 - timeInterval = pk_dcyc->cyctim / 1000; - object->delta_interval = timeInterval; -#endif - _Watchdog_Initialize( - object, - pk_dcyc->cychdr, - cycno, - pk_dcyc->exinf); - _Watchdog_Deactivate(object); - - return E_OK; -} - -/* - * act_cyc - Activate Cyclic Handler - */ - -ER act_cyc( - HNO cycno, - UINT cycact -) -{ - Watchdog_Control *object; - - if(cycact != TCY_OFF || cycact != TCY_ON) - return E_PAR; - -#if 0 - if( object->Object_ID != cycno) - return E_NOEXS; -#endif - - _Watchdog_Activate(object); - - return E_OK; -} - -/* - * ref_cyc - Reference Cyclic Handler Status - */ - -ER ref_cyc( - T_RCYC *pk_rcyc, - HNO cycno -) -{ -#if 0 - int timeElapse_since_actCyclic; -#endif - T_DCYC *pk_dcyc; -#if 0 - Watchdog_Control *object; -#endif - -/* XXX */ pk_dcyc = 0; - -/* XXX will to use a "get" routine to map from id to object pointer */ -/* XXX and the object pointer should be of type specific to this manager */ -#if 0 - if( object->Object_ID == cycno)) -#else - if ( 1 ) -#endif - { - pk_rcyc->exinf = pk_dcyc->exinf; - pk_rcyc->cycact = pk_dcyc->cycact; -#if 0 - pk_rcyc->lfttim = pk_dcyc->cyctim - timeElapse_since_actCyclic; -#endif - - return E_OK; - } - else - return E_NOEXS; -} - -/* - * def_alm - Define Alarm Handler - */ - -ER def_alm( - HNO almno, - T_DALM *pk_dalm -) -{ -#if 0 - Objects_Control *objectAlrm; - Watchdog_Interval timeInterval; - - timeInterval = pk_dalm->almtim / 1000; - (void) _Watchdog_Remove(&objectAlrm); - _Watchdog_Initialize( - objectAlrm, - pk_dalm->almhdr, - almno, - pk_dalm->exinf); - _Watchdong_Insert_seconds(objectAlrm,timeInterval); - _Thread_Enable_dispatch(); -#endif - - return E_OK; -} - -/* - * ref_alm - Reference Alarm Handler Status - */ - -ER ref_alm( - T_RALM *pk_ralm, - HNO almno -) -{ - - return E_OK; -} - -/* - * ret_tmr - Return from Timer Handler - */ - -void ret_tmr( void ) -{ -} - diff --git a/c/src/exec/itron/src/mbox.c b/c/src/exec/itron/src/mbox.c deleted file mode 100644 index 7990a11976..0000000000 --- a/c/src/exec/itron/src/mbox.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * ITRON 3.0 Mailbox Manager - * - * 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 - -/* - * _ITRON_Mailbox_Manager_initialization - * - * This routine initializes all mailboxes manager related data structures. - * - * Input parameters: - * maximum_mailboxes - maximum configured mailboxes - * - * Output parameters: NONE - */ - -void _ITRON_Mailbox_Manager_initialization( - unsigned32 maximum_mailboxes -) -{ - _Objects_Initialize_information( - &_ITRON_Mailbox_Information, /* object information table */ - OBJECTS_ITRON_API, /* object API */ - OBJECTS_ITRON_MAILBOXES, /* object class */ - maximum_mailboxes, /* maximum objects of this class */ - sizeof( ITRON_Mailbox_Control ), /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - ITRON_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - FALSE, /* TRUE if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif - ); - - /* - * Register the MP Process Packet routine. - * - * NOTE: No MP Support YET in RTEMS ITRON implementation. - */ - -} diff --git a/c/src/exec/itron/src/mboxtranslatereturncode.c b/c/src/exec/itron/src/mboxtranslatereturncode.c deleted file mode 100644 index 6931d3b2b5..0000000000 --- a/c/src/exec/itron/src/mboxtranslatereturncode.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ITRON 3.0 Mailbox Manager - * - * 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 - -/* - * _ITRON_Mailbox_Translate_core_message_queue_return_code - * - * This routine translates a core message queue object status - * into the appropriate ITRON status code. - */ - -ER _ITRON_Mailbox_Translate_core_message_queue_return_code( - CORE_message_queue_Status status -) -{ - switch (status) { - case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL: - return E_OK; - case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY: - return E_TMOUT; - case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE: - return E_PAR; - case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT: - return E_TMOUT; - case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT: - return E_TMOUT; - default: - return E_ID; - } -} diff --git a/c/src/exec/itron/src/msgbuffer.c b/c/src/exec/itron/src/msgbuffer.c deleted file mode 100644 index df49314ec6..0000000000 --- a/c/src/exec/itron/src/msgbuffer.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * _ITRON_Message_buffer_Manager_initialization - * - * This routine initializes all message buffer manager related data - * structures. - * - * Input parameters: - * maximum_message_buffers - maximum configured message buffers - * - * Output parameters: NONE - */ - -void _ITRON_Message_buffer_Manager_initialization( - unsigned32 maximum_message_buffers -) -{ - _Objects_Initialize_information( - &_ITRON_Message_buffer_Information, /* object information table */ - OBJECTS_ITRON_API, /* object API */ - OBJECTS_ITRON_MESSAGE_BUFFERS, /* object class */ - maximum_message_buffers, /* maximum objects of this class */ - sizeof( ITRON_Message_buffer_Control ), - /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - ITRON_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - FALSE, /* TRUE if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif - ); - - /* - * Register the MP Process Packet routine. - * - * NOTE: No MP Support YET in RTEMS ITRON implementation. - */ -} - diff --git a/c/src/exec/itron/src/msgbuffertranslatereturncode.c b/c/src/exec/itron/src/msgbuffertranslatereturncode.c deleted file mode 100644 index bfb82007c0..0000000000 --- a/c/src/exec/itron/src/msgbuffertranslatereturncode.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * _ITRON_Message_buffer_Translate_core_message_buffer_return_code - * - * This routine translates a core message buffer object status - * into the appropriate ITRON status code. - */ - -ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code( - CORE_message_queue_Status status -) -{ - switch (status) { - case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL: - return E_OK; - case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY: - return E_TMOUT; - case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE: - return E_PAR; - case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT: - return E_TMOUT; - case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT: - return E_TMOUT; - default: - return E_ID; - } -} diff --git a/c/src/exec/itron/src/network.c b/c/src/exec/itron/src/network.c deleted file mode 100644 index e359dd4933..0000000000 --- a/c/src/exec/itron/src/network.c +++ /dev/null @@ -1,72 +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 - -#include - -/* - * nrea_dat - Read Data from another Node - */ - -ER nrea_dat( - INT *p_reasz, - VP dstadr, - NODE srcnode, - VP srcadr, - INT datsz -) -{ - return E_OK; -} - -/* - * nwri_dat - Write Data to another Node - */ - -ER nwri_dat( - INT *p_wrisz, - NODE dstnode, - VP dstadr, - VP srcadr, - INT datsz -) -{ - return E_OK; -} - -/* - * nget_nod - Get Local Node Number - */ - -ER nget_nod( - NODE *p_node -) -{ - return E_OK; -} - -/* - * nget_ver - Get Version Information of another Node - */ - -ER nget_ver( - T_VER *pk_ver, - NODE node -) -{ - return E_OK; -} - diff --git a/c/src/exec/itron/src/port.c b/c/src/exec/itron/src/port.c deleted file mode 100644 index 4377368d22..0000000000 --- a/c/src/exec/itron/src/port.c +++ /dev/null @@ -1,212 +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 - -#include - -/* - * _ITRON_Port_Manager_initialization - * - * This routine initializes all ports manager related data structures. - * - * Input parameters: - * maximum_ports - maximum configured ports - * - * Output parameters: NONE - */ - -void _ITRON_Port_Manager_initialization( - unsigned32 maximum_ports -) -{ - _Objects_Initialize_information( - &_ITRON_Port_Information, /* object information table */ - OBJECTS_ITRON_API, /* object API */ - OBJECTS_ITRON_PORTS, /* object class */ - maximum_ports, /* maximum objects of this class */ - sizeof( ITRON_Port_Control ), /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - ITRON_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - FALSE, /* TRUE if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif - ); - - /* - * Register the MP Process Packet routine. - * - * NOTE: No MP Support YET in RTEMS ITRON implementation. - */ - -} - -/* - * cre_por - Create Port for Rendezvous - */ - -ER cre_por( - ID porid, - T_CPOR *pk_cpor -) -{ - return E_OK; -} - -/* - * del_por - Delete Port for Rendezvous - */ - -ER del_por( - ID porid -) -{ - return E_OK; -} - -/* - * cal_por - Call Port for Rendezvous Poll - */ - -ER cal_por( - VP msg, - INT *p_rmsgsz, - ID porid, - UINT calptn, - INT cmsgsz -) -{ - return E_OK; -} - -/* - * pcal_por - Poll and Call Port for Rendezvous - */ - -ER pcal_por( - VP msg, - INT *p_rmsgsz, - ID porid, - UINT calptn, - INT cmsgsz -) -{ - return E_OK; -} - -/* - * tcal_por - Call Port for Rendezvous with Timeout - */ - -ER tcal_por( - VP msg, - INT *p_rmsgsz, - ID porid, - UINT calptn, - INT cmsgsz, - TMO tmout -) -{ - return E_OK; -} - -/* - * acp_por - Accept Port for Rendezvous Poll - */ - -ER acp_por( - RNO *p_rdvno, - VP msg, - INT *p_cmsgsz, - ID porid, - UINT acpptn -) -{ - return E_OK; -} - -/* - * pacp_por - Poll and Accept Port for Rendezvous - */ - -ER pacp_por( - RNO *p_rdvno, - VP msg, - INT *p_cmsgsz, - ID porid, - UINT acpptn -) -{ - return E_OK; -} - -/* - * tacp_por - Accept Port for Rendezvous with Timeout - */ - -ER tacp_por( - RNO *p_rdvno, - VP msg, - INT *p_cmsgsz, - ID porid, - UINT acpptn, - TMO tmout -) -{ - return E_OK; -} - -/* - * fwd_por - Forward Rendezvous to Other Port - */ - -ER fwd_por( - ID porid, - UINT calptn, - RNO rdvno, - VP msg, - INT cmsgsz -) -{ - return E_OK; -} - -/* - * rpl_rdv - Reply Rendezvous - */ - -ER rpl_rdv( - RNO rdvno, - VP msg, - INT rmsgsz -) -{ - return E_OK; -} - -/* - * ref_por - Reference Port Status - */ - -ER ref_por( - T_RPOR *pk_rpor, - ID porid -) -{ - return E_OK; -} - diff --git a/c/src/exec/itron/src/prcv_mbf.c b/c/src/exec/itron/src/prcv_mbf.c deleted file mode 100644 index 5376e23e41..0000000000 --- a/c/src/exec/itron/src/prcv_mbf.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * prcv_mbf - Poll and Receive Message from MessageBuffer - */ - -ER prcv_mbf( - VP msg, - INT *p_msgsz, - ID mbfid -) -{ - return trcv_mbf(msg, p_msgsz, mbfid, TMO_POL); -} diff --git a/c/src/exec/itron/src/prcv_mbx.c b/c/src/exec/itron/src/prcv_mbx.c deleted file mode 100644 index b7c6b6b841..0000000000 --- a/c/src/exec/itron/src/prcv_mbx.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ITRON 3.0 Mailbox Manager - * - * 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 - -/* - * prcv_msg - Poll and Receive Message from Mailbox - */ - -ER prcv_msg( - T_MSG **ppk_msg, - ID mbxid -) -{ - return trcv_msg( ppk_msg, mbxid, TMO_POL ); -} diff --git a/c/src/exec/itron/src/preq_sem.c b/c/src/exec/itron/src/preq_sem.c deleted file mode 100644 index db1473cb51..0000000000 --- a/c/src/exec/itron/src/preq_sem.c +++ /dev/null @@ -1,33 +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 - -#include -#include -#include - -/* - * preq_sem - Poll and Request Semaphore - * - * This function implements the ITRON 3.0 preq_sem() service. - */ - -ER preq_sem( - ID semid -) -{ - return twai_sem( semid, TMO_POL ); -} diff --git a/c/src/exec/itron/src/psnd_mbf.c b/c/src/exec/itron/src/psnd_mbf.c deleted file mode 100644 index e86e2ff244..0000000000 --- a/c/src/exec/itron/src/psnd_mbf.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * psnd_mbf - Poll and Send Message to MessageBuffer - */ - -ER psnd_mbf( - ID mbfid, - VP msg, - INT msgsz -) -{ - return tsnd_mbf( mbfid, msg, msgsz, TMO_POL ); -} diff --git a/c/src/exec/itron/src/rcv_mbf.c b/c/src/exec/itron/src/rcv_mbf.c deleted file mode 100644 index 05dc57ba02..0000000000 --- a/c/src/exec/itron/src/rcv_mbf.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * rcv_mbf - Receive Message from MessageBuffer - */ - -ER rcv_mbf( - VP msg, - INT *p_msgsz, - ID mbfid -) -{ - return trcv_mbf(msg, p_msgsz, mbfid, TMO_FEVR); -} diff --git a/c/src/exec/itron/src/rcv_mbx.c b/c/src/exec/itron/src/rcv_mbx.c deleted file mode 100644 index ae5a4f613a..0000000000 --- a/c/src/exec/itron/src/rcv_mbx.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ITRON 3.0 Mailbox Manager - * - * 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 - -/* - * rcv_msg - Receive Message from Mailbox - */ - -ER rcv_msg( - T_MSG **ppk_msg, - ID mbxid -) -{ - return trcv_msg( ppk_msg, mbxid, TMO_FEVR ); -} diff --git a/c/src/exec/itron/src/ref_mbf.c b/c/src/exec/itron/src/ref_mbf.c deleted file mode 100644 index 113870c0d6..0000000000 --- a/c/src/exec/itron/src/ref_mbf.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * ref_mbf - Reference Message Buffer Status - */ - -ER ref_mbf( - T_RMBF *pk_rmbf, - ID mbfid -) -{ - ITRON_Message_buffer_Control *the_message_buffer; - Objects_Locations location; - CORE_message_queue_Control *the_core_msgq; - - if ( !pk_rmbf ) - return E_PAR; /* XXX check this error code */ - - the_message_buffer = _ITRON_Message_buffer_Get( mbfid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: /* Multiprocessing not supported */ - case OBJECTS_ERROR: - return _ITRON_Message_buffer_Clarify_get_id_error( mbfid ); - - case OBJECTS_LOCAL: - the_core_msgq = &the_message_buffer->message_queue; - - /* - * Fill in the size of message to be sent - */ - - if (the_core_msgq->number_of_pending_messages == 0) { - pk_rmbf->msgsz = 0; - } else { - pk_rmbf->msgsz = ((CORE_message_queue_Buffer_control *) - the_core_msgq->Pending_messages.first)->Contents.size; - } - - /* - * Fill in the size of free buffer - */ - - pk_rmbf->frbufsz = - (the_core_msgq->maximum_pending_messages - - the_core_msgq->number_of_pending_messages) * - the_core_msgq->maximum_message_size; - - - /* - * Fill in whether or not there is a waiting task - */ - - if ( !_Thread_queue_First(&the_core_msgq->Wait_queue ) ) - pk_rmbf->wtsk = FALSE; - else - pk_rmbf->wtsk = TRUE; - - pk_rmbf->stsk = FALSE; - _Thread_Enable_dispatch(); - return E_OK; - } - return E_OK; -} diff --git a/c/src/exec/itron/src/ref_mbx.c b/c/src/exec/itron/src/ref_mbx.c deleted file mode 100644 index 6ae4e597bd..0000000000 --- a/c/src/exec/itron/src/ref_mbx.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * ITRON 3.0 Mailbox Manager - * - * 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 - -/* - * ref_mbx - Reference Mailbox Status - */ - -ER ref_mbx( - T_RMBX *pk_rmbx, - ID mbxid -) -{ - register ITRON_Mailbox_Control *the_mailbox; - Objects_Locations location; - Chain_Control *pending; - - if ( !pk_rmbx ) - return E_PAR; - - the_mailbox = _ITRON_Mailbox_Get( mbxid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Mailbox_Clarify_get_id_error( mbxid ); - - case OBJECTS_LOCAL: - - pending = &the_mailbox->message_queue.Pending_messages; - if ( _Chain_Is_empty( pending ) ) - pk_rmbx->pk_msg = NULL; - else - pk_rmbx->pk_msg = (T_MSG *) pending->first; - - /* - * Fill in whether or not there is a waiting task - */ - - if ( !_Thread_queue_First( &the_mailbox->message_queue.Wait_queue ) ) - pk_rmbx->wtsk = FALSE; - else - pk_rmbx->wtsk = TRUE; - - break; - } - _ITRON_return_errorno( E_OK ); -} - diff --git a/c/src/exec/itron/src/ref_sem.c b/c/src/exec/itron/src/ref_sem.c deleted file mode 100644 index b10625615b..0000000000 --- a/c/src/exec/itron/src/ref_sem.c +++ /dev/null @@ -1,66 +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 - -#include -#include -#include - -/* - * ref_sem - Reference Semaphore Status - * - * This function implements the ITRON 3.0 ref_sem() service. - */ - -ER ref_sem( - ID semid, - T_RSEM *pk_rsem -) -{ - ITRON_Semaphore_Control *the_semaphore; - Objects_Locations location; - - if ( !pk_rsem ) - return E_PAR; /* XXX check this error code */ - - the_semaphore = _ITRON_Semaphore_Get( semid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: /* Multiprocessing not supported */ - case OBJECTS_ERROR: - return _ITRON_Semaphore_Clarify_get_id_error( semid ); - - case OBJECTS_LOCAL: - /* - * Fill in the current semaphore count - */ - - pk_rsem->semcnt = _CORE_semaphore_Get_count( &the_semaphore->semaphore ); - - /* - * Fill in whether or not there is a waiting task - */ - - if ( !_Thread_queue_First( &the_semaphore->semaphore.Wait_queue ) ) - pk_rsem->wtsk = FALSE; - else - pk_rsem->wtsk = TRUE; - - _Thread_Enable_dispatch(); - return E_OK; - } - return E_OK; -} - diff --git a/c/src/exec/itron/src/ref_tsk.c b/c/src/exec/itron/src/ref_tsk.c deleted file mode 100644 index ec28c4f45e..0000000000 --- a/c/src/exec/itron/src/ref_tsk.c +++ /dev/null @@ -1,103 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * ref_tsk - Reference Task Status - */ - -ER ref_tsk( - T_RTSK *pk_rtsk, - ID tskid -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - Priority_Control core_priority; - - if (!pk_rtsk) - return E_PAR; - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - - if ( location != OBJECTS_LOCAL ) - return _ITRON_Task_Clarify_get_id_error( tskid ); - - /* - * The following are extended functions [level X ]. - * XXX - tskwait, wid, wupcnt, and tskatr are presently not implemented. - */ - - pk_rtsk->tskwait = 0; - pk_rtsk->wid = 0; - pk_rtsk->wupcnt = 0; - pk_rtsk->suscnt = the_thread->suspend_count; - pk_rtsk->tskatr = 0; /* XXX - Not correctly implemented */ - pk_rtsk->task = (FP) the_thread->Start.entry_point; - core_priority = the_thread->Start.initial_priority; - pk_rtsk->itskpri = _ITRON_Task_Core_to_Priority( core_priority ); - pk_rtsk->stksz = the_thread->Start.Initial_stack.size; - - /* - * The following are required. - */ - - pk_rtsk->exinf = NULL; /* extended information */ - pk_rtsk->tskpri = - _ITRON_Task_Core_to_Priority(the_thread->current_priority); - - /* - * Mask in the tskstat information - * Convert the task state XXX double check this - */ - - pk_rtsk->tskstat = 0; - if ( the_thread == _Thread_Executing ) - pk_rtsk->tskstat |= TTS_RUN; - if ( _States_Is_ready(the_thread->current_state) ) - pk_rtsk->tskstat |= TTS_RDY; - if ( _States_Is_dormant( the_thread->current_state) ) - pk_rtsk->tskstat |= TTS_DMT; - if ( _States_Is_suspended(the_thread->current_state) ) - pk_rtsk->tskstat |= TTS_SUS; - if ( _States_Is_blocked(the_thread->current_state) ) - pk_rtsk->tskstat |= TTS_WAI; - - break; - } - - _ITRON_return_errorno( E_OK ); - -} - - - - diff --git a/c/src/exec/itron/src/rel_wai.c b/c/src/exec/itron/src/rel_wai.c deleted file mode 100644 index 6c7b47dbf4..0000000000 --- a/c/src/exec/itron/src/rel_wai.c +++ /dev/null @@ -1,55 +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 - -#include -#include -#include -#include -#include - -#include - -/* - * rel_wai - Release Wait of Other Task - */ - -ER rel_wai( - ID tskid -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - /* - * XXX - FILL ME IN. - */ - - break; - } - - _ITRON_return_errorno( E_OK ); -} - - - diff --git a/c/src/exec/itron/src/rot_rdq.c b/c/src/exec/itron/src/rot_rdq.c deleted file mode 100644 index 56a992d558..0000000000 --- a/c/src/exec/itron/src/rot_rdq.c +++ /dev/null @@ -1,57 +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 - -#include -#include -#include -#include -#include - -#include - -/* - * rot_rdq - Rotate Tasks on the Ready Queue - */ - -ER rot_rdq( - PRI tskpri -) -{ - PRI priority; - - - if (( tskpri <= 0 ) || ( tskpri >= 256 )) - return E_PAR; - - _Thread_Disable_dispatch(); - - /* - * Yield of processor will rotate the queue for this processor. - */ - - priority = _ITRON_Task_Core_to_Priority(_Thread_Executing->current_priority); - if ( priority == tskpri ) - _Thread_Yield_processor(); - else { - _Thread_Rotate_Ready_Queue( _ITRON_Task_Core_to_Priority( tskpri ) ); - } - _Thread_Enable_dispatch(); - - return E_OK; -} - - diff --git a/c/src/exec/itron/src/rsm_tsk.c b/c/src/exec/itron/src/rsm_tsk.c deleted file mode 100644 index 2c4946f6a4..0000000000 --- a/c/src/exec/itron/src/rsm_tsk.c +++ /dev/null @@ -1,61 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * rsm_tsk - Resume Suspended Task - */ - -ER rsm_tsk( - ID tskid -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - - if ( _Thread_Is_executing( the_thread ) ) - _ITRON_return_errorno( E_OBJ ); - - if ( _States_Is_dormant( the_thread->current_state )) - _ITRON_return_errorno( E_OBJ ); - - if ( ! _States_Is_suspended(the_thread->current_state) ) - _ITRON_return_errorno( E_OK ); - - _Thread_Resume( the_thread, FALSE ); - break; - } - - _ITRON_return_errorno( E_OK ); -} - diff --git a/c/src/exec/itron/src/sig_sem.c b/c/src/exec/itron/src/sig_sem.c deleted file mode 100644 index 90bf6d36c1..0000000000 --- a/c/src/exec/itron/src/sig_sem.c +++ /dev/null @@ -1,56 +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 - -#include -#include -#include - -/* - * sig_sem - Signal Semaphore - * - * This function implements the ITRON 3.0 sig_sem() service. - */ - -ER sig_sem( - ID semid -) -{ - ITRON_Semaphore_Control *the_semaphore; - Objects_Locations location; - CORE_semaphore_Status status; - - the_semaphore = _ITRON_Semaphore_Get( semid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: /* Multiprocessing not supported */ - case OBJECTS_ERROR: - return _ITRON_Semaphore_Clarify_get_id_error( semid ); - - case OBJECTS_LOCAL: - /* - * XXX maxsemcnt - */ - - status = _CORE_semaphore_Surrender( - &the_semaphore->semaphore, - the_semaphore->Object.id, - NULL /* Multiprocessing not supported */ - ); - _Thread_Enable_dispatch(); - return _ITRON_Semaphore_Translate_core_semaphore_return_code( status ); - } - return E_OK; -} diff --git a/c/src/exec/itron/src/slp_tsk.c b/c/src/exec/itron/src/slp_tsk.c deleted file mode 100644 index 0e22f34a80..0000000000 --- a/c/src/exec/itron/src/slp_tsk.c +++ /dev/null @@ -1,35 +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 - -#include -#include -#include -#include -#include - -#include - - - -/* - * slp_tsk - Sleep Task - */ - -ER slp_tsk( void ) -{ - return E_OK; -} diff --git a/c/src/exec/itron/src/snd_mbf.c b/c/src/exec/itron/src/snd_mbf.c deleted file mode 100644 index 08142ab15b..0000000000 --- a/c/src/exec/itron/src/snd_mbf.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * snd_mbf - Send Message to MessageBuffer - */ - -ER snd_mbf( - ID mbfid, - VP msg, - INT msgsz -) -{ - return tsnd_mbf( mbfid, msg, msgsz, TMO_FEVR ); -} diff --git a/c/src/exec/itron/src/snd_mbx.c b/c/src/exec/itron/src/snd_mbx.c deleted file mode 100644 index 588eb8585c..0000000000 --- a/c/src/exec/itron/src/snd_mbx.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * ITRON 3.0 Mailbox Manager - * - * 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 - -/* - * snd_msg - Send Message to Mailbox - */ - -ER snd_msg( - ID mbxid, - T_MSG *pk_msg -) -{ - register ITRON_Mailbox_Control *the_mailbox; - Objects_Locations location; - unsigned32 message_priority; - void *message_contents; - CORE_message_queue_Status msg_status; - - if ( !pk_msg ) - return E_PAR; - - the_mailbox = _ITRON_Mailbox_Get( mbxid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Mailbox_Clarify_get_id_error( mbxid ); - - case OBJECTS_LOCAL: - if ( the_mailbox->do_message_priority ) - message_priority = pk_msg->msgpri; - else - message_priority = CORE_MESSAGE_QUEUE_SEND_REQUEST; - - message_contents = pk_msg; - msg_status = _CORE_message_queue_Submit( - &the_mailbox->message_queue, - &message_contents, - sizeof(T_MSG *), - the_mailbox->Object.id, - NULL, /* multiprocessing not supported */ - message_priority, - FALSE, /* do not allow sender to block */ - 0 /* no timeout */ - ); - break; - } - - _ITRON_return_errorno( - _ITRON_Mailbox_Translate_core_message_queue_return_code( msg_status ) - ); -} diff --git a/c/src/exec/itron/src/sta_tsk.c b/c/src/exec/itron/src/sta_tsk.c deleted file mode 100644 index 5675eca9b2..0000000000 --- a/c/src/exec/itron/src/sta_tsk.c +++ /dev/null @@ -1,73 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * sta_tsk - Start Task - */ - -ER sta_tsk( - ID tskid, - INT stacd -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - boolean status; - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - - if ( !_States_Is_dormant( the_thread->current_state ) ) - _ITRON_return_errorno( E_OBJ ); - - status = _Thread_Start( - the_thread, - THREAD_START_NUMERIC, /* XXX should be able to say we have no arg */ - the_thread->Start.entry_point, - 0, /* XXX supercore forces us to have an arg */ - 0 /* unused */ - ); - - /* - * This error can not happen entry_point is checked in create. - if ( !status ) - _ITRON_return_errorno( E_OBJ ); - */ - - break; - } - - _ITRON_return_errorno( E_OK ); -} - - - - diff --git a/c/src/exec/itron/src/sus_tsk.c b/c/src/exec/itron/src/sus_tsk.c deleted file mode 100644 index b40be824ea..0000000000 --- a/c/src/exec/itron/src/sus_tsk.c +++ /dev/null @@ -1,69 +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 -#include - -#include -#include -#include -#include -#include - -#include - - -/* - * Task-Dependent Synchronization Functions - */ - -/* - * sus_tsk - Suspend Other Task - */ - -ER sus_tsk( - ID tskid -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - - if ( _Thread_Is_executing( the_thread ) ) - _ITRON_return_errorno( E_OBJ ); - - if (the_thread->suspend_count == INT_MAX ) - _ITRON_return_errorno( E_QOVR ); - - _Thread_Suspend( the_thread ); - break; - } - - _ITRON_return_errorno( E_OK ); -} - - - - - - - diff --git a/c/src/exec/itron/src/sysmgmt.c b/c/src/exec/itron/src/sysmgmt.c deleted file mode 100644 index 14e31c965a..0000000000 --- a/c/src/exec/itron/src/sysmgmt.c +++ /dev/null @@ -1,76 +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 - -#include - -/* - * get_ver - Get Version Information - */ - -ER get_ver( - T_VER *pk_ver -) -{ - return E_OK; -} - -/* - * ref_sys - Reference System Status - */ - -ER ref_sys( - T_RSYS *pk_rsys -) -{ - return E_OK; -} - -/* - * ref_cfg - Reference Configuration Information - */ - -ER ref_cfg( - T_RCFG *pk_rcfg -) -{ - return E_OK; -} - -/* - * def_svc - Define Extended SVC Handler - */ - -ER def_svc( - FN s_fncd, - T_DSVC *pk_dsvc -) -{ - return E_OK; -} - -/* - * def_exc - Define Exception Handler - */ - -ER def_exc( - UINT exckind, - T_DEXC *pk_dexc -) -{ - return E_OK; -} - diff --git a/c/src/exec/itron/src/task.c b/c/src/exec/itron/src/task.c deleted file mode 100644 index 75c845288e..0000000000 --- a/c/src/exec/itron/src/task.c +++ /dev/null @@ -1,227 +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 - -#include -#include -#include -#include -#include - -#include - -/* - * _ITRON_Task_Create_extension - * - * This routine is an extension routine that is invoked as part - * of creating any type of task or thread in the system. If the - * task is created via another API, then this routine is invoked - * and this API given the opportunity to initialize its extension - * area. - */ - -boolean _ITRON_Task_Create_extension( - Thread_Control *executing, - Thread_Control *created -) -{ - ITRON_API_Control *api; - - api = _Workspace_Allocate( sizeof( ITRON_API_Control ) ); - - if ( !api ) - return FALSE; - - created->API_Extensions[ THREAD_API_ITRON ] = api; - - /* - * Initialize the ITRON API extension - */ - - return TRUE; -} - -/* - * _ITRON_Task_Delete_extension - * - * This extension routine is invoked when a task is deleted. - */ - -User_extensions_routine _ITRON_Task_Delete_extension( - Thread_Control *executing, - Thread_Control *deleted -) -{ - (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_ITRON ] ); - - deleted->API_Extensions[ THREAD_API_ITRON ] = NULL; -} - -/* - * _ITRON_Task_Initialize_user_tasks - * - * This routine creates and starts all configured user - * initialzation threads. - */ - -void _ITRON_Task_Initialize_user_tasks( void ) -{ - unsigned32 index; - unsigned32 maximum; - ER return_value; - itron_initialization_tasks_table *user_tasks; - - /* - * NOTE: This is slightly different from the Ada implementation. - */ - - user_tasks = _ITRON_Task_User_initialization_tasks; - maximum = _ITRON_Task_Number_of_initialization_tasks; - - if ( !user_tasks || maximum == 0 ) - return; - - for ( index=0 ; index < maximum ; index++ ) { - - return_value = cre_tsk( - user_tasks[ index ].id, - &user_tasks[ index ].attributes - ); - - if ( return_value != E_OK ) - _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, TRUE, return_value ); - - return_value = sta_tsk( user_tasks[ index ].id, 0 ); - - if ( return_value != E_OK ) - _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, TRUE, return_value ); - - } -} - -/*PAGE - * - * _ITRON_Delete_task - */ - -ER _ITRON_Delete_task( - Thread_Control *the_thread -) -{ - Objects_Information *the_information; - - the_information = _Objects_Get_information( the_thread->Object.id ); - if ( !the_information ) { - return E_OBJ; /* XXX - should never happen */ - } - - _Thread_Close( the_information, the_thread ); - - _ITRON_Task_Free( the_thread ); - - return E_OK; -} - -/* - * At this point in time, the ITRON API does not need any other - * extensions. See the POSIX and RTEMS API extensions for - * examples of how they can be used. - */ - -/* - * Extension Tables - */ - -API_extensions_Control _ITRON_Task_API_extensions = { - { NULL, NULL }, - NULL, /* predriver */ - _ITRON_Task_Initialize_user_tasks, /* postdriver */ - NULL /* post switch */ -}; - -User_extensions_Control _ITRON_Task_User_extensions = { - { NULL, NULL }, - { { NULL, NULL }, NULL }, - { _ITRON_Task_Create_extension, /* create */ - NULL, /* start */ - NULL, /* restart */ - _ITRON_Task_Delete_extension, /* delete */ - NULL, /* switch */ - NULL, /* begin */ - NULL, /* exitted */ - NULL /* fatal */ - } -}; - -/* - * _ITRON_Task_Manager_initialization - * - * This routine initializes all Task Manager related data structures. - * - * Input parameters: - * maximum_tasks - number of tasks to initialize - * - * Output parameters: NONE - */ - -void _ITRON_Task_Manager_initialization( - unsigned32 maximum_tasks, - unsigned32 number_of_initialization_tasks, - itron_initialization_tasks_table *user_tasks -) -{ - - _ITRON_Task_Number_of_initialization_tasks = number_of_initialization_tasks; - _ITRON_Task_User_initialization_tasks = user_tasks; - - /* - * There may not be any ITRON_initialization tasks configured. - */ - -#if 0 - if ( user_tasks == NULL || number_of_initialization_tasks == 0 ) - _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, TRUE, -1 ); -#endif - - _Objects_Initialize_information( - &_ITRON_Task_Information, /* object information table */ - OBJECTS_ITRON_API, /* object API */ - OBJECTS_ITRON_TASKS, /* object class */ - maximum_tasks, /* maximum objects of this class */ - sizeof( Thread_Control ), /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - ITRON_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - FALSE, /* TRUE if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif - ); - - /* - * Add all the extensions for this API - */ - - _User_extensions_Add_API_set( &_ITRON_Task_User_extensions ); - - _API_extensions_Add( &_ITRON_Task_API_extensions ); - - /* - * XXX MP not supported - * Register the MP Process Packet routine. - */ - -} diff --git a/c/src/exec/itron/src/ter_tsk.c b/c/src/exec/itron/src/ter_tsk.c deleted file mode 100644 index dc0e6d3c5f..0000000000 --- a/c/src/exec/itron/src/ter_tsk.c +++ /dev/null @@ -1,65 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * ter_tsk - Terminate Other Task - Set State to DORMANT - */ - -ER ter_tsk( - ID tskid -) -{ - register Thread_Control *the_thread; - Objects_Locations location; - - the_thread = _ITRON_Task_Get( tskid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Task_Clarify_get_id_error( tskid ); - - case OBJECTS_LOCAL: - - if ( _Thread_Is_executing( the_thread ) ) - _ITRON_return_errorno( E_OBJ ); - - if ( _States_Is_dormant( the_thread->current_state ) ) - _ITRON_return_errorno( E_OBJ ); - - _Thread_Restart( the_thread, NULL, 0 ); - _Thread_Set_state( the_thread, STATES_DORMANT ); - break; - } - - _ITRON_return_errorno( E_OK ); -} - - - - - - - diff --git a/c/src/exec/itron/src/trcv_mbf.c b/c/src/exec/itron/src/trcv_mbf.c deleted file mode 100644 index a83b8379bd..0000000000 --- a/c/src/exec/itron/src/trcv_mbf.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 - -/* - * trcv_mbf - Receive Message from MessageBuffer with Timeout - */ - -ER trcv_mbf( - VP msg, - INT *p_msgsz, - ID mbfid, - TMO tmout -) -{ - ITRON_Message_buffer_Control *the_message_buffer; - Objects_Locations location; - CORE_message_queue_Status status; - boolean wait; - Watchdog_Interval interval; - - interval = 0; - if (tmout == TMO_POL) { - wait = FALSE; - } else { - wait = TRUE; - if (tmout != TMO_FEVR) - interval = TOD_MILLISECONDS_TO_TICKS(tmout); - } - - if (wait && _ITRON_Is_in_non_task_state() ) - return E_CTX; - - if (!p_msgsz || !msg || tmout <= -2) - return E_PAR; - - the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location); - switch (location) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: /* Multiprocessing not supported */ - return _ITRON_Message_buffer_Clarify_get_id_error(mbfid); - - case OBJECTS_LOCAL: - _CORE_message_queue_Seize( - &the_message_buffer->message_queue, - the_message_buffer->Object.id, - msg, - p_msgsz, - wait, - interval - ); - _Thread_Enable_dispatch(); - status = (CORE_message_queue_Status)_Thread_Executing->Wait.return_code; - return - _ITRON_Message_buffer_Translate_core_message_buffer_return_code(status); - } - - /* - * If multiprocessing were supported, this is where we would announce - * the existence of the semaphore to the rest of the system. - */ - -#if defined(RTEMS_MULTIPROCESSING) -#endif - return E_OK; -} diff --git a/c/src/exec/itron/src/trcv_mbx.c b/c/src/exec/itron/src/trcv_mbx.c deleted file mode 100644 index 0b54db03f7..0000000000 --- a/c/src/exec/itron/src/trcv_mbx.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * ITRON 3.0 Mailbox Manager - * - * 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 - -/* - * trcv_msg - Receive Message from Mailbox with Timeout - */ - -ER trcv_msg( - T_MSG **ppk_msg, - ID mbxid, - TMO tmout -) -{ - register ITRON_Mailbox_Control *the_mailbox; - Watchdog_Interval interval; - boolean wait; - Objects_Locations location; - unsigned32 size; - - if (!ppk_msg) - return E_PAR; - - interval = 0; - if ( tmout == TMO_POL ) { - wait = FALSE; - } else { - wait = TRUE; - if ( tmout != TMO_FEVR ) - interval = TOD_MILLISECONDS_TO_TICKS(tmout); - } - - if ( wait && _ITRON_Is_in_non_task_state() ) - return E_CTX; - - the_mailbox = _ITRON_Mailbox_Get( mbxid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: - return _ITRON_Mailbox_Clarify_get_id_error( mbxid ); - - case OBJECTS_LOCAL: - - _CORE_message_queue_Seize( - &the_mailbox->message_queue, - the_mailbox->Object.id, - ppk_msg, - &size, - wait, - interval - ); - break; - } - - _ITRON_return_errorno( - _ITRON_Mailbox_Translate_core_message_queue_return_code( - _Thread_Executing->Wait.return_code ) ); -} diff --git a/c/src/exec/itron/src/tslp_tsk.c b/c/src/exec/itron/src/tslp_tsk.c deleted file mode 100644 index ab297b0f6b..0000000000 --- a/c/src/exec/itron/src/tslp_tsk.c +++ /dev/null @@ -1,38 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * tslp_tsk - Sleep Task with Timeout - */ - -ER tslp_tsk( - TMO tmout -) -{ - return E_OK; -} - - diff --git a/c/src/exec/itron/src/tsnd_mbf.c b/c/src/exec/itron/src/tsnd_mbf.c deleted file mode 100644 index 91a91f87d2..0000000000 --- a/c/src/exec/itron/src/tsnd_mbf.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * ITRON Message Buffer Manager - * - * 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 /* only for blocking */ - -/* - * tsnd_mbf - Send Message to MessageBuffer with Timeout - */ - -ER tsnd_mbf( - ID mbfid, - VP msg, - INT msgsz, - TMO tmout -) -{ - ITRON_Message_buffer_Control *the_message_buffer; - Objects_Locations location; - Watchdog_Interval interval; - boolean wait; - CORE_message_queue_Status msg_status; - - if (msgsz <= 0 || !msg) - return E_PAR; - - interval = 0; - if ( tmout == TMO_POL ) { - wait = FALSE; - } else { - wait = TRUE; - if ( tmout != TMO_FEVR ) - interval = TOD_MILLISECONDS_TO_TICKS(tmout); - } - - if ( wait && _ITRON_Is_in_non_task_state() ) - return E_CTX; - - the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location); - switch (location) { - case OBJECTS_REMOTE: - case OBJECTS_ERROR: /* Multiprocessing not supported */ - return _ITRON_Message_buffer_Clarify_get_id_error(mbfid); - - case OBJECTS_LOCAL: - /* XXX Submit needs to take into account blocking */ - msg_status = _CORE_message_queue_Submit( - &the_message_buffer->message_queue, - msg, - msgsz, - the_message_buffer->Object.id, - NULL, - CORE_MESSAGE_QUEUE_SEND_REQUEST, - wait, /* sender may block */ - interval /* timeout interval */ - ); - _Thread_Enable_dispatch(); - return _ITRON_Message_buffer_Translate_core_message_buffer_return_code( - msg_status - ); - } - - /* - * If multiprocessing were supported, this is where we would announce - * the existence of the semaphore to the rest of the system. - */ - -#if defined(RTEMS_MULTIPROCESSING) -#endif - - return E_OK; -} diff --git a/c/src/exec/itron/src/twai_sem.c b/c/src/exec/itron/src/twai_sem.c deleted file mode 100644 index 27122b7970..0000000000 --- a/c/src/exec/itron/src/twai_sem.c +++ /dev/null @@ -1,69 +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 - -#include -#include -#include - -/* - * twai_sem - Wait on Semaphore with Timeout - * - * This function implements the ITRON 3.0 twai_sem() service. - */ - -ER twai_sem( - ID semid, - TMO tmout -) -{ - ITRON_Semaphore_Control *the_semaphore; - Objects_Locations location; - Watchdog_Interval interval; - boolean wait; - CORE_semaphore_Status status; - - interval = 0; - if ( tmout == TMO_POL ) { - wait = FALSE; - } else { - wait = TRUE; - if ( tmout != TMO_FEVR ) - interval = TOD_MILLISECONDS_TO_TICKS(tmout); - } - - if ( wait && _ITRON_Is_in_non_task_state() ) - return E_CTX; - - the_semaphore = _ITRON_Semaphore_Get( semid, &location ); - switch ( location ) { - case OBJECTS_REMOTE: /* Multiprocessing not supported */ - case OBJECTS_ERROR: - return _ITRON_Semaphore_Clarify_get_id_error( semid ); - - case OBJECTS_LOCAL: - _CORE_semaphore_Seize( - &the_semaphore->semaphore, - the_semaphore->Object.id, - wait, /* wait for a timeout */ - interval /* timeout value */ - ); - _Thread_Enable_dispatch(); - status = (CORE_semaphore_Status) _Thread_Executing->Wait.return_code; - return _ITRON_Semaphore_Translate_core_semaphore_return_code( status ); - } - return E_OK; -} diff --git a/c/src/exec/itron/src/vmempool.c b/c/src/exec/itron/src/vmempool.c deleted file mode 100644 index b1bd8cae7f..0000000000 --- a/c/src/exec/itron/src/vmempool.c +++ /dev/null @@ -1,146 +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 - -#include - -/* - * _ITRON_Variable_memory_pool_Manager_initialization - * - * This routine initializes all variable memory pool manager related - * data structures. - * - * Input parameters: - * maximum_variable_memory_pools - maximum configured variable memory pools - * - * Output parameters: NONE - */ - -void _ITRON_Variable_memory_pool_Manager_initialization( - unsigned32 maximum_variable_memory_pools -) -{ - _Objects_Initialize_information( - &_ITRON_Variable_memory_pool_Information, /* object information table */ - OBJECTS_ITRON_API, /* object API */ - OBJECTS_ITRON_VARIABLE_MEMORY_POOLS, /* object class */ - maximum_variable_memory_pools, /* maximum objects of this class */ - sizeof( ITRON_Variable_memory_pool_Control ), - /* size of this object's control block */ - FALSE, /* TRUE if names for this object are strings */ - ITRON_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - FALSE, /* TRUE if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif - ); - - /* - * Register the MP Process Packet routine. - * - * NOTE: No MP Support YET in RTEMS ITRON implementation. - */ - -} - -/* - * cre_mpl - Create Variable-Size Memorypool - */ - -ER cre_mpl( - ID mplid, - T_CMPL *pk_cmpl -) -{ - return E_OK; -} - -/* - * del_mpl - Delete Variable-Size Memorypool - */ - -ER del_mpl( - ID mplid -) -{ - return E_OK; -} - -/* - * get_blk - Get Variable-Size Memory Block - */ - -ER get_blk( - VP *p_blk, - ID mplid, - INT blksz -) -{ - return E_OK; -} - -/* - * pget_blk - Poll and Get Variable-Size Memory Block - */ - -ER pget_blk( - VP *p_blk, - ID mplid, - INT blksz -) -{ - return E_OK; -} - -/* - * tget_blk - Get Variable-Size Memory Block with Timeout - */ - -ER tget_blk( - VP *p_blk, - ID mplid, - INT blksz, - TMO tmout -) -{ - return E_OK; -} - -/* - * rel_blk - Release Variable-Size Memory Block - */ - -ER rel_blk( - ID mplid, - VP blk -) -{ - return E_OK; -} - -/* - * ref_mpl - Reference Variable-Size Memorypool Status - */ - -ER ref_mpl( - T_RMPL *pk_rmpl, - ID mplid -) -{ - return E_OK; -} - diff --git a/c/src/exec/itron/src/wai_sem.c b/c/src/exec/itron/src/wai_sem.c deleted file mode 100644 index dbcb93f2db..0000000000 --- a/c/src/exec/itron/src/wai_sem.c +++ /dev/null @@ -1,33 +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 - -#include -#include -#include - -/* - * wai_sem - Wait on Semaphore - * - * This function implements the ITRON 3.0 wai_sem() service. - */ - -ER wai_sem( - ID semid -) -{ - return twai_sem( semid, TMO_FEVR ); -} diff --git a/c/src/exec/itron/src/wup_tsk.c b/c/src/exec/itron/src/wup_tsk.c deleted file mode 100644 index 10f2364ebc..0000000000 --- a/c/src/exec/itron/src/wup_tsk.c +++ /dev/null @@ -1,37 +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 - -#include -#include -#include -#include -#include - -#include - - -/* - * wup_tsk - Wakeup Other Task - */ - -ER wup_tsk( - ID tskid -) -{ - return E_OK; -} - diff --git a/c/src/exec/libblock/.cvsignore b/c/src/exec/libblock/.cvsignore deleted file mode 100644 index d29e5050f5..0000000000 --- a/c/src/exec/libblock/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -config.cache -config.guess -config.log -config.status -config.sub -configure -depcomp -install-sh -missing -mkinstalldirs diff --git a/c/src/exec/libblock/ChangeLog b/c/src/exec/libblock/ChangeLog deleted file mode 100644 index c1fb55f89c..0000000000 --- a/c/src/exec/libblock/ChangeLog +++ /dev/null @@ -1,115 +0,0 @@ -2002-07-05 Ralf Corsepius - - * configure.ac: RTEMS_TOP(../..). - -2002-07-01 Joel Sherrill - - * Mega patch merge to change the format of the object IDs to - loosen the dependency between the SCORE and the various APIs. - There was considerable work to simplify the object name management - and it appears that the name_table field is no longer needed. - This patch also includes the addition of the internal mutex - which is currently only used to protect some types of allocation - and deallocation. This significantly can reduce context - switch latency under certain circumstances. In particular, - some heap/region operations were O(n) and had dispatching - disabled. This should help enormously. With this merge, - the patch is not as clean as it should be. In particular, - the documentation has not been modified to reflect the new object - ID layout, the IDs in the test screens are not updated, and - _Objects_Get_information needs to be a real routine not inlined. - As part of this patch a lot of MP code for thread/proxy blocking - was made conditional and cleaned up. - * src/bdbuf.c: Modified as part of above. -2002-07-01 Ralf Corsepius - - * configure.ac: Remove RTEMS_PROJECT_ROOT. - -2002-06-27 Ralf Corsepius - - * configure.ac: Use AC_CONFIG_AUX_DIR(../..). - Add AC_PROG_RANLIB. - -2002-06-26 Ralf Corsepius - - * src/Makefile.am: Don't preinstall libblock.a. - -2002-06-18 Ralf Corsepius - - * Makefile.am: Merge-in include/Makefile.am. - * include/Makefile.am: Remove. - * configure.ac: Reflect changes above. - -2002-06-17 Ralf Corsepius - - * include/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * Makefile.am: Include $(top_srcdir)/../automake/*.am. - Use ../aclocal. - * src/Makefile.am: Include $(top_srcdir)/../automake/*.am. - -2002-05-18 Ralf Corsepius - - Move from c/src/libblock to c/src/exec/libblock - * configure.ac: Reflect move. - * Makefile.am: Ditto. - * include/Makefile.am: Ditto. - * src/Makefile.am: Ditto. - -2002-04-06 Ralf Corsepius - - * src/ramdisk.c: include . - * src/blkdev.c: include . - -2002-04-03 Alexander Kukuta - - * include/rtems/bdbuf.h: Address PR168 by changing bdbuf_buffer.avl.bal - and bdbuf_buffer.avl.cache to signed char instead of char. - -2002-03-27 Ralf Corsepius - - * configure.ac: - AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS). - AM_INIT_AUTOMAKE([no-define foreign 1.6]). - * include/Makefile.am: Remove AUTOMAKE_OPTIONS. - * Makefile.am: Remove AUTOMAKE_OPTIONS. - * src/Makefile.am: Remove AUTOMAKE_OPTIONS. - -2002-03-21 Alexander Kukuta - - * src/bdbuf.c (avl_insert, avl_remove): Reimplemented from scratch - to avoid using GPLed sources in RTEMS core. - * src/bdbuf.c, include/rtems/bdbuf.h: Remove "binary tree" - implementation which was used for debugging only. - -2002-03-13 Victor V. Vengerov - - * src/bdbuf.c (find_or_assign_buffer, rtems_bdbuf_read, - rtems_bdbuf_sync, rtems_bdbuf_syncdev, bdbuf_swapout_task): - Fix bug: disable interrupts and set level properly before - _CORE_mutex_Seize invocation). - -2002-02-28 Joel Sherrill - - * Submitted by Victor V. Vengerov and merged - into the RTEMS source. - * ChangeLog, Makefile.am, README, configure.ac, include/Makefile.am, - include/rtems/bdbuf.h, include/rtems/blkdev.h, include/rtems/diskdevs.h, - include/rtems/ramdisk.h, include/rtems/.cvsignore, include/.cvsignore, - src/Makefile.am, src/bdbuf.c, src/blkdev.c, src/diskdevs.c, - src/ramdisk.c, src/.cvsignore, .cvsignore: New files. - -2001-11-29 Victor V. Vengerov - * AVL trees implementation added. - -2001-11-16 Victor V. Vengerov - * include/rtems/bdbuf.h, src/bdbuf.c(rtems_bdbuf_syncdev): New. - -2001-11-07 Victor V. Vengerov - - * ChangeLog: New file. - * src/, include/, include/rtems/: New directories. - * README, configure.ac, Makefile.am, src/Makefile.am, - include/Makefile.am: New files. - * include/rtems/bdbuf.h include/rtems/blkdev.h - include/rtems/diskdevs.h include/rtems/ramdisk.h - src/bdbuf.c src/blkdev.c src/diskdevs.c src/ramdisk.c: New files. diff --git a/c/src/exec/libblock/Makefile.am b/c/src/exec/libblock/Makefile.am deleted file mode 100644 index 85a2b6af6a..0000000000 --- a/c/src/exec/libblock/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -## -## $Id$ -## - -ACLOCAL_AMFLAGS = -I ../aclocal - -SUBDIRS = src - -include_rtemsdir = $(includedir)/rtems - -$(PROJECT_INCLUDE)/%.h: include/%.h - $(INSTALL_DATA) $< $@ - -$(PROJECT_INCLUDE)/rtems: - @$(mkinstalldirs) $@ - -include_rtems_HEADERS = \ - include/rtems/bdbuf.h include/rtems/blkdev.h \ - include/rtems/diskdevs.h include/rtems/ramdisk.h - -PREINSTALL_FILES = $(PROJECT_INCLUDE)/rtems \ - $(include_rtems_HEADERS:include/%=$(PROJECT_INCLUDE)/%) - -all-local: $(PREINSTALL_FILES) - - -EXTRA_DIST = README - -include $(top_srcdir)/../automake/subdirs.am -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libblock/README b/c/src/exec/libblock/README deleted file mode 100644 index 671cc7f645..0000000000 --- a/c/src/exec/libblock/README +++ /dev/null @@ -1,14 +0,0 @@ -# -# $Id$ -# - -This directory contains the block device (HDD, CDROMs, etc) support code. -It includes: - - block device driver interface - - generic open/close/read/write/ioctl primitives for block device drivers - - disk I/O buffering - - logical disk support - - RAM disk block device driver - -Victor V. Vengerov, -November, 7 2001 diff --git a/c/src/exec/libblock/configure.ac b/c/src/exec/libblock/configure.ac deleted file mode 100644 index e302bcccac..0000000000 --- a/c/src/exec/libblock/configure.ac +++ /dev/null @@ -1,28 +0,0 @@ -## Process this file with autoconf to produce a configure script. -## -## $Id$ - -AC_PREREQ(2.52) -AC_INIT([rtems-c-src-libblock],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com]) -AC_CONFIG_SRCDIR([src/bdbuf.c]) -RTEMS_TOP(../..) -AC_CONFIG_AUX_DIR(../..) - -RTEMS_CANONICAL_TARGET_CPU -RTEMS_CANONICAL_HOST - -AM_INIT_AUTOMAKE([no-define foreign 1.6]) -AM_MAINTAINER_MODE - -RTEMS_ENV_RTEMSCPU -RTEMS_CHECK_CPU -RTEMS_PROG_CC_FOR_TARGET - -RTEMS_CANONICALIZE_TOOLS -AC_PROG_RANLIB - -# Explicitly list all Makefiles here -AC_CONFIG_FILES([Makefile -src/Makefile -]) -AC_OUTPUT diff --git a/c/src/exec/libblock/include/.cvsignore b/c/src/exec/libblock/include/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libblock/include/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libblock/include/rtems/.cvsignore b/c/src/exec/libblock/include/rtems/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libblock/include/rtems/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libblock/include/rtems/bdbuf.h b/c/src/exec/libblock/include/rtems/bdbuf.h deleted file mode 100644 index 4405e17e34..0000000000 --- a/c/src/exec/libblock/include/rtems/bdbuf.h +++ /dev/null @@ -1,275 +0,0 @@ -/* bdbuf.h -- block device buffer management - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Victor V. Vengerov - * - * @(#) $Id$ - */ - -#ifndef __RTEMS_LIBBLOCK_BDBUF_H__ -#define __RTEMS_LIBBLOCK_BDBUF_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include "rtems/blkdev.h" -#include "rtems/diskdevs.h" - - -/* - * To manage buffers we using Buffer Descriptors. - * To speed-up buffer lookup descriptors are organized in AVL-Tree. - * The fields 'dev' and 'block' are search key. - */ - -/* Buffer descriptors - * Descriptors organized in AVL-tree to speedup buffer lookup. - * dev and block fields are search key in AVL-tree. - * Modified buffers, free buffers and used buffers linked in 'mod', 'free' and - * 'lru' chains appropriately. - */ - -typedef struct bdbuf_buffer { - Chain_Node link; /* Link in the lru, mod or free chains */ - - struct bdbuf_avl_node { - signed char cache; /* Cache */ - - struct bdbuf_buffer* left; /* Left Child */ - struct bdbuf_buffer* right; /* Right Child */ - - signed char bal; /* The balance of the sub-tree */ - } avl; - - dev_t dev; /* device number */ - blkdev_bnum block; /* block number on the device */ - - char *buffer; /* Pointer to the buffer memory area */ - rtems_status_code status; /* Last I/O operation completion status */ - int error; /* If status != RTEMS_SUCCESSFUL, this field contains - errno value which can be used by user later */ - boolean modified:1; /* =1 if buffer was modified */ - boolean in_progress:1; /* =1 if exchange with disk is in progress; - need to wait on semaphore */ - boolean actual:1; /* Buffer contains actual data */ - int use_count; /* Usage counter; incremented when somebody use - this buffer; decremented when buffer released - without modification or when buffer is flushed - by swapout task */ - - rtems_bdpool_id pool; /* Identifier of buffer pool to which this buffer - belongs */ - CORE_mutex_Control transfer_sema; - /* Transfer operation semaphore */ -} bdbuf_buffer; - - - -/* bdbuf_config structure describes block configuration (size, - * amount, memory location) for buffering layer - */ -typedef struct rtems_bdbuf_config { - int size; /* Size of block */ - int num; /* Number of blocks of appropriate size */ - char *mem_area; /* Pointer to the blocks location or NULL, in this - case memory for blocks will be allocated by - Buffering Layer with the help of RTEMS partition - manager */ -} rtems_bdbuf_config; - -extern rtems_bdbuf_config rtems_bdbuf_configuration[]; -extern int rtems_bdbuf_configuration_size; - -/* rtems_bdbuf_init -- - * Prepare buffering layer to work - initialize buffer descritors - * and (if it is neccessary) buffers. Buffers will be allocated accoriding - * to the configuration table, each entry describes kind of block and - * amount requested. After initialization all blocks is placed into - * free elements lists. - * - * PARAMETERS: - * conf_table - pointer to the buffers configuration table - * size - number of entries in configuration table - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - */ -rtems_status_code -rtems_bdbuf_init(rtems_bdbuf_config *conf_table, int size); - - -/* rtems_bdbuf_get -- - * Obtain block buffer. If specified block already cached (i.e. there's - * block in the _modified_, or _recently_used_), return address - * of appropriate buffer descriptor and increment reference counter to 1. - * If block is not cached, allocate new buffer and return it. Data - * shouldn't be read to the buffer from media; buffer may contains - * arbitrary data. This primitive may be blocked if there are no free - * buffer descriptors available and there are no unused non-modified - * (or synchronized with media) buffers available. - * - * PARAMETERS: - * device - device number (constructed of major and minor device number) - * block - linear media block number - * bd - address of variable to store pointer to the buffer descriptor - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * bufget_sema semaphore obtained by this primitive. - */ -rtems_status_code -rtems_bdbuf_get(dev_t device, blkdev_bnum block, bdbuf_buffer **bdb_ptr); - -/* rtems_bdbuf_read -- - * (Similar to the rtems_bdbuf_get, except reading data from media) - * Obtain block buffer. If specified block already cached, return address - * of appropriate buffer and increment reference counter to 1. If block is - * not cached, allocate new buffer and read data to it from the media. - * This primitive may be blocked on waiting until data to be read from - * media, if there are no free buffer descriptors available and there are - * no unused non-modified (or synchronized with media) buffers available. - * - * PARAMETERS: - * device - device number (consists of major and minor device number) - * block - linear media block number - * bd - address of variable to store pointer to the buffer descriptor - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * bufget_sema and transfer_sema semaphores obtained by this primitive. - */ -rtems_status_code -rtems_bdbuf_read(dev_t device, blkdev_bnum block, bdbuf_buffer **bdb_ptr); - -/* rtems_bdbuf_release -- - * Release buffer allocated before. This primitive decrease the - * usage counter. If it is zero, further destiny of buffer depends on - * 'modified' status. If buffer was modified, it is placed to the end of - * mod list and flush task waken up. If buffer was not modified, - * it is placed to the end of lru list, and bufget_sema released, allowing - * to reuse this buffer. - * - * PARAMETERS: - * bd_buf - pointer to the bdbuf_buffer structure previously obtained using - * get/read primitive. - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * flush_sema and bufget_sema semaphores may be released by this primitive. - */ -rtems_status_code -rtems_bdbuf_release(bdbuf_buffer *bd_buf); - -/* rtems_bdbuf_release_modified -- - * Release buffer allocated before, assuming that it is _modified_ by - * it's owner. This primitive decrease usage counter for buffer, mark - * buffer descriptor as modified. If usage counter is 0, insert it at - * end of mod chain and release flush_sema semaphore to activate the - * flush task. - * - * PARAMETERS: - * bd_buf - pointer to the bdbuf_buffer structure previously obtained using - * get/read primitive. - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * flush_sema semaphore may be released by this primitive. - */ -rtems_status_code -rtems_bdbuf_release_modified(bdbuf_buffer *bd_buf); - -/* rtems_bdbuf_sync -- - * Wait until specified buffer synchronized with disk. Invoked on exchanges - * critical for data consistency on the media. This primitive mark owned - * block as modified, decrease usage counter. If usage counter is 0, - * block inserted to the mod chain and flush_sema semaphore released. - * Finally, primitives blocked on transfer_sema semaphore. - * - * PARAMETERS: - * bd_buf - pointer to the bdbuf_buffer structure previously obtained using - * get/read primitive. - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * Primitive may be blocked on transfer_sema semaphore. - */ -rtems_status_code -rtems_bdbuf_sync(bdbuf_buffer *bd_buf); - -/* rtems_bdbuf_syncdev -- - * Synchronize with disk all buffers containing the blocks belonging to - * specified device. - * - * PARAMETERS: - * dev - block device number - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - */ -rtems_status_code -rtems_bdbuf_syncdev(dev_t dev); - -/* rtems_bdbuf_find_pool -- - * Find first appropriate buffer pool. This primitive returns the index - * of first buffer pool which block size is greater than or equal to - * specified size. - * - * PARAMETERS: - * block_size - requested block size - * pool - placeholder for result - * - * RETURNS: - * RTEMS status code: RTEMS_SUCCESSFUL if operation completed successfully, - * RTEMS_INVALID_SIZE if specified block size is invalid (not a power - * of 2), RTEMS_NOT_DEFINED if buffer pool for this or greater block size - * is not configured. - */ -rtems_status_code -rtems_bdbuf_find_pool(int block_size, rtems_bdpool_id *pool); - -/* rtems_bdbuf_get_pool_info -- - * Obtain characteristics of buffer pool with specified number. - * - * PARAMETERS: - * pool - buffer pool number - * block_size - block size for which buffer pool is configured returned - * there - * blocks - number of buffers in buffer pool returned there - * - * RETURNS: - * RTEMS status code: RTEMS_SUCCESSFUL if operation completed successfully, - * RTEMS_INVALID_NUMBER if appropriate buffer pool is not configured. - * - * NOTE: - * Buffer pools enumerated contiguously starting from 0. - */ -rtems_status_code -rtems_bdbuf_get_pool_info(rtems_bdpool_id pool, int *block_size, int *blocks); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/exec/libblock/include/rtems/blkdev.h b/c/src/exec/libblock/include/rtems/blkdev.h deleted file mode 100644 index ca3b5ba5e2..0000000000 --- a/c/src/exec/libblock/include/rtems/blkdev.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * blkdev.h - block device driver interface definitions - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Victor V. Vengerov - * - * @(#) $Id$ - */ - -#ifndef __RTEMS_LIBBLOCK_BLKDEV_H__ -#define __RTEMS_LIBBLOCK_BLKDEV_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Interface with device drivers - * Block device looks, initialized and behaves like traditional RTEMS device - * driver. Heart of the block device driver is in BIOREQUEST ioctl. This call - * puts I/O request to the block device queue, in priority order, for - * asynchronous processing. When driver executes request, req_done - * function invoked, so callee knows about it. Look for details below. - */ - - -/* Block device block number datatype */ -typedef rtems_unsigned32 blkdev_bnum; - -/* Block device request type */ -typedef enum blkdev_request_op { - BLKDEV_REQ_READ, /* Read operation */ - BLKDEV_REQ_WRITE /* Write operation */ -} blkdev_request_op; - -/* Type for block device request done callback function. - * - * PARAMETERS: - * arg - argument supplied in blkdev_request - * status - rtems status code for this operation - * errno - errno value to be passed to the user when - * status != RTEMS_SUCCESSFUL - */ -typedef void (* blkdev_request_cb)(void *arg, - rtems_status_code status, - int error); - -/* blkdev_sg_buffer - * Block device scatter/gather buffer structure - */ -typedef struct blkdev_sg_buffer { - rtems_unsigned32 length; /* Buffer length */ - void *buffer; /* Buffer pointer */ -} blkdev_sg_buffer; - -/* blkdev_request (Block Device Request) structure is - * used to read/write a number of blocks from/to device. - */ -typedef struct blkdev_request { - blkdev_request_op req; /* Block device operation (read or write) */ - blkdev_request_cb req_done; /* Callback function */ - void *done_arg; /* Argument to be passed to callback function*/ - blkdev_bnum start; /* Start block number */ - rtems_unsigned32 count; /* Number of blocks to be exchanged */ - rtems_unsigned32 bufnum; /* Number of buffers provided */ - - blkdev_sg_buffer bufs[0];/* List of scatter/gather buffers */ -} blkdev_request; - -/* Block device IOCTL request codes */ -#define BLKIO_REQUEST _IOWR('B', 1, blkdev_request) -#define BLKIO_GETBLKSIZE _IO('B', 2) -#define BLKIO_GETSIZE _IO('B', 3) -#define BLKIO_SYNCDEV _IO('B', 4) - -/* Device driver interface conventions suppose that driver may - * contain initialize/open/close/read/write/ioctl entry points. These - * primitives (except initialize) can be implemented in generic fashion, - * based upon supplied block device driver ioctl handler. Every block - * device driver should provide initialize entry point, which is register - * all block devices and appropriate ioctl handlers. - */ - -#define GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES \ - rtems_blkdev_generic_open, rtems_blkdev_generic_close, \ - rtems_blkdev_generic_read, rtems_blkdev_generic_write, \ - rtems_blkdev_generic_ioctl - -/* blkdev_generic_read -- - * Generic block device read primitive. Implemented using block device - * buffer management primitives. - */ -rtems_device_driver -rtems_blkdev_generic_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -); - -/* blkdev_generic_write -- - * Generic block device driver write primitive. Implemented using block - * device buffer management primitives. - */ -rtems_device_driver -rtems_blkdev_generic_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -); - -/* blkdev_generic_open -- - * Generic block device open primitive. - */ -rtems_device_driver -rtems_blkdev_generic_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -); - -/* blkdev_generic_close -- - * Generic block device close primitive. - */ -rtems_device_driver -rtems_blkdev_generic_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -); - -/* blkdev_generic_ioctl -- - * Generic block device ioctl primitive. - */ -rtems_device_driver -rtems_blkdev_generic_ioctl( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/exec/libblock/include/rtems/diskdevs.h b/c/src/exec/libblock/include/rtems/diskdevs.h deleted file mode 100644 index fab3231e62..0000000000 --- a/c/src/exec/libblock/include/rtems/diskdevs.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - * logdisk.h - Physical and logical block devices (disks) support - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Victor V. Vengerov - * - * @(#) $Id$ - */ - -#ifndef __RTEMS_LIBBLOCK_LOGDISK_H__ -#define __RTEMS_LIBBLOCK_LOGDISK_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include "rtems/blkdev.h" - -/* Buffer pool identifier */ -typedef int rtems_bdpool_id; - -/* Block device ioctl handler */ -typedef int (* block_device_ioctl) (dev_t dev, int req, void *argp); - -/* disk_device: Entry of this type created for every disk device (both for - * logical and physical disks). - * Array of arrays of pointers to disk_device structures maintained. First - * table indexed by major number and second table indexed by minor number. - * Such data organization allow quick lookup using data structure of - * moderated size. - */ -typedef struct disk_device { - dev_t dev; /* Device ID (major + minor) */ - struct disk_device *phys_dev; /* Physical device ID (the same - as dev if this entry specifies - the physical device) */ - char *name; /* Disk device name */ - int uses; /* Use counter. Device couldn't be - removed if it is in use. */ - int start; /* Starting block number (0 for - physical devices, block offset - on the related physical device - for logical device) */ - int size; /* Size of physical or logical disk - in disk blocks */ - int block_size; /* Size of device block (minimum - transfer unit) in bytes - (must be power of 2) */ - int block_size_log2; /* log2 of block_size */ - rtems_bdpool_id pool; /* Buffer pool assigned to this - device */ - block_device_ioctl ioctl; /* ioctl handler for this block - device */ -} disk_device; - -/* rtems_disk_create_phys -- - * Create physical disk entry. This function usually invoked from - * block device driver initialization code when physical device - * detected in the system. Device driver should provide ioctl handler - * to allow block device access operations. This primitive will register - * device in rtems (invoke rtems_io_register_name). - * - * PARAMETERS: - * dev - device identifier (major, minor numbers) - * block_size - size of disk block (minimum data transfer unit); must be - * power of 2 - * disk_size - number of blocks on device - * handler - IOCTL handler (function providing basic block input/output - * request handling BIOREQUEST and other device management - * operations) - * name - character name of device (e.g. /dev/hda) - * - * RETURNS: - * RTEMS_SUCCESSFUL if information about new physical disk added, or - * error code if error occured (device already registered, wrong block - * size value, no memory available). - */ -rtems_status_code -rtems_disk_create_phys(dev_t dev, int block_size, int disk_size, - block_device_ioctl handler, - char *name); - -/* rtems_disk_create_log -- - * Create logical disk entry. Logical disk is contiguous area on physical - * disk. Disk may be splitted to several logical disks in several ways: - * manually or using information stored in blocks on physical disk - * (DOS-like partition table, BSD disk label, etc). This function usually - * invoked from application when application-specific splitting are in use, - * or from generic code which handle different logical disk organizations. - * This primitive will register device in rtems (invoke - * rtems_io_register_name). - * - * PARAMETERS: - * dev - logical device identifier (major, minor numbers) - * phys - physical device (block device which holds this logical disk) - * identifier - * start - starting block number on the physical device - * size - logical disk size in blocks - * name - logical disk name - * - * RETURNS: - * RTEMS_SUCCESSFUL if logical device successfully added, or error code - * if error occured (device already registered, no physical device - * exists, logical disk is out of physical disk boundaries, no memory - * available). - */ -rtems_status_code -rtems_disk_create_log(dev_t dev, dev_t phys, int start, int size, char *name); - -/* rtems_disk_delete -- - * Delete physical or logical disk device. Device may be deleted if its - * use counter (and use counters of all logical devices - if it is - * physical device) equal to 0. When physical device deleted, - * all logical devices deleted inherently. Appropriate devices removed - * from "/dev" filesystem. - * - * PARAMETERS: - * dev - device identifier (major, minor numbers) - * - * RETURNS: - * RTEMS_SUCCESSFUL if block device successfully deleted, or error code - * if error occured (device is not defined, device is in use). - */ -rtems_status_code -rtems_disk_delete(dev_t dev); - -/* rtems_disk_lookup -- - * Find block device descriptor by its device identifier. This function - * increment usage counter to 1. User should release disk_device structure - * by invoking rtems_disk_release primitive. - * - * PARAMETERS: - * dev - device identifier (major, minor numbers) - * - * RETURNS: - * pointer to the block device descriptor, or NULL if no such device - * exists. - */ -disk_device * -rtems_disk_lookup(dev_t dev); - -/* rtems_disk_release -- - * Release disk_device structure (decrement usage counter to 1). - * - * PARAMETERS: - * dd - pointer to disk device structure - * - * RETURNS: - * RTEMS_SUCCESSFUL - * - * NOTE: - * It should be implemented as inline function. - */ -rtems_status_code -rtems_disk_release(disk_device *dd); - -/* rtems_disk_next -- - * Disk device enumerator. Looking for device having device number larger - * than dev and return disk device descriptor for it. If there are no - * such device, NULL value returned. - * - * PARAMETERS: - * dev - device number (use -1 to start search) - * - * RETURNS: - * Pointer to the disk descriptor for next disk device, or NULL if all - * devices enumerated. */ -disk_device * -rtems_disk_next(dev_t dev); - -/* rtems_diskio_initialize -- - * Initialization of disk device library (initialize all data structures, - * etc.) - * - * PARAMETERS: - * none - * - * RETURNS: - * RTEMS_SUCCESSFUL if library initialized, or error code if error - * occured. - */ -rtems_status_code -rtems_disk_io_initialize(void); - -/* rtems_diskio_done -- - * Release all resources allocated for disk device interface. - * - * PARAMETERS: - * none - * - * RETURNS: - * RTEMS_SUCCESSFUL if all resources released, or error code if error - * occured. - */ -rtems_status_code -rtems_disk_io_done(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/exec/libblock/include/rtems/ramdisk.h b/c/src/exec/libblock/include/rtems/ramdisk.h deleted file mode 100644 index b9e8c238b8..0000000000 --- a/c/src/exec/libblock/include/rtems/ramdisk.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ramdisk.c -- RAM disk block device implementation - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Victor V. Vengerov - * - * @(#) $Id$ - */ - -#ifndef __RTEMS_LIBBLOCK_RAMDISK_H__ -#define __RTEMS_LIBBLOCK_RAMDISK_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include "rtems/blkdev.h" - -/* RAM disk configuration table entry */ -typedef struct rtems_ramdisk_config { - int block_size; /* RAM disk block size */ - int block_num; /* Number of blocks on this RAM disk */ - void *location; /* RAM disk permanent location (out of RTEMS controlled - memory), or NULL if RAM disk memory should be - allocated dynamically */ -} rtems_ramdisk_config; - -/* If application want to use RAM disk, it should specify configuration of - * available RAM disks. - * The following is definitions for RAM disk configuration table - */ -extern rtems_ramdisk_config rtems_ramdisk_configuration[]; -extern int rtems_ramdisk_configuration_size; - -/* ramdisk_initialize -- - * RAM disk driver initialization entry point. - */ -rtems_device_driver -ramdisk_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg); - -#define RAMDISK_DRIVER_TABLE_ENTRY \ - { ramdisk_initialize, GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES } - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/exec/libblock/src/.cvsignore b/c/src/exec/libblock/src/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libblock/src/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libblock/src/Makefile.am b/c/src/exec/libblock/src/Makefile.am deleted file mode 100644 index 96d611491c..0000000000 --- a/c/src/exec/libblock/src/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -## -## $Id$ -## - - -LIBNAME = libblock -LIB = ${ARCH}/${LIBNAME}.a - -C_FILES = bdbuf.c blkdev.c diskdevs.c ramdisk.c - -C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) - -SRCS = $(C_FILES) -OBJS = $(C_O_FILES) - -include $(top_srcdir)/../automake/multilib.am -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/lib.am - -AM_CFLAGS += $(LIBC_DEFINES) - -$(LIB): ${OBJS} - $(make-library) - -all-local: ${ARCH} $(LIB) - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libblock/src/bdbuf.c b/c/src/exec/libblock/src/bdbuf.c deleted file mode 100644 index 0960ac4c3a..0000000000 --- a/c/src/exec/libblock/src/bdbuf.c +++ /dev/null @@ -1,1648 +0,0 @@ -/* - * Disk I/O buffering - * Buffer managment - * - * Copyright (C) 2001 OKTET Ltd., St.-Peterburg, Russia - * Author: Andrey G. Ivanov - * Victor V. Vengerov - * Alexander Kukuta - * - * @(#) $Id$ - */ - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ -#include -#include -#include -#include - -#include "rtems/bdbuf.h" - -/* Fatal errors: */ -#define BLKDEV_FATAL_ERROR(n) (('B' << 24) | ((n) & 0x00FFFFFF)) -#define BLKDEV_FATAL_BDBUF_CONSISTENCY BLKDEV_FATAL_ERROR(1) -#define BLKDEV_FATAL_BDBUF_SWAPOUT BLKDEV_FATAL_ERROR(2) - - -#define SWAPOUT_PRIORITY 15 -#define SWAPOUT_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) - -static rtems_task bdbuf_swapout_task(rtems_task_argument unused); - -/* - * The groups of the blocks with the same size are collected in the - * bd_pool. Note that a several of the buffer's groups with the - * same size can exists. - */ -typedef struct bdbuf_pool -{ - bdbuf_buffer *tree; /* Buffer descriptor lookup AVL tree root */ - - Chain_Control free; /* Free buffers list */ - Chain_Control lru; /* Last recently used list */ - - int blksize; /* The size of the blocks (in bytes) */ - int nblks; /* Number of blocks in this pool */ - rtems_id bufget_sema; /* Buffer obtain counting semaphore */ - void *mallocd_bufs; /* Pointer to the malloc'd buffer memory, - or NULL, if buffer memory provided in - buffer configuration */ - bdbuf_buffer *bdbufs; /* Pointer to table of buffer descriptors - allocated for this buffer pool. */ -} bdbuf_pool; - -/* Buffering layer context definition */ -struct bdbuf_context { - bdbuf_pool *pool; /* Table of buffer pools */ - int npools; /* Number of entries in pool table */ - - Chain_Control mod; /* Modified buffers list */ - rtems_id flush_sema; /* Buffer flush semaphore; counting - semaphore; incremented when buffer - flushed to the disk; decremented when - buffer modified */ - rtems_id swapout_task; /* Swapout task ID */ -}; - -/* Block device request with a single buffer provided */ -typedef struct blkdev_request1 { - blkdev_request req; - blkdev_sg_buffer sg[1]; -} blkdev_request1; - -/* The static context of buffering layer */ -static struct bdbuf_context bd_ctx; - -#define SAFE -#ifdef SAFE -typedef rtems_mode preemption_key; - -#define DISABLE_PREEMPTION(key) \ - do { \ - rtems_task_mode(RTEMS_PREEMPT_MASK, RTEMS_NO_PREEMPT, &(key)); \ - } while (0) - -#define ENABLE_PREEMPTION(key) \ - do { \ - rtems_mode temp; \ - rtems_task_mode(RTEMS_PREEMPT_MASK, (key), &temp); \ - } while (0) - -#else - -typedef boolean preemption_key; - -#define DISABLE_PREEMPTION(key) \ - do { \ - (key) = _Thread_Executing->is_preemptible; \ - _Thread_Executing->is_preemptible = 0; \ - } while (0) - -#define ENABLE_PREEMPTION(key) \ - do { \ - _Thread_Executing->is_preemptible = (key); \ - if (_Thread_Evaluate_mode()) \ - _Thread_Dispatch(); \ - } while (0) - -#endif - - -/* The default maximum height of 32 allows for AVL trees having - between 5,704,880 and 4,294,967,295 nodes, depending on order of - insertion. You may change this compile-time constant as you - wish. */ -#ifndef AVL_MAX_HEIGHT -#define AVL_MAX_HEIGHT 32 -#endif - -/* - * avl_search -- - * Searches for the node with specified dev/block. - * - * PARAMETERS: - * root - pointer to the root node of the AVL-Tree. - * dev, block - search key - * - * RETURNS: - * NULL if node with specified dev/block not found - * non-NULL - pointer to the node with specified dev/block - */ -static bdbuf_buffer * -avl_search(bdbuf_buffer **root, dev_t dev, blkdev_bnum block) -{ - bdbuf_buffer *p = *root; - - while ((p != NULL) && ((p->dev != dev) || (p->block != block))) - { - if ((p->dev < dev) || ((p->dev == dev) && (p->block < block))) - { - p = p->avl.right; - } - else - { - p = p->avl.left; - } - } - - return p; -} - - -/* avl_search_for_sync -- - * Search in AVL tree for first modified buffer belongs to specified - * disk device. - * - * PARAMETERS: - * root - pointer to tree root - * dd - disk device descriptor - * - * RETURNS: - * Block buffer, or NULL if no modified blocks on specified device - * exists. - */ -static bdbuf_buffer * -avl_search_for_sync(bdbuf_buffer **root, disk_device *dd) -{ - dev_t dev = dd->phys_dev->dev; - blkdev_bnum block_start = dd->start; - blkdev_bnum block_end = dd->start + dd->size - 1; - - bdbuf_buffer *buf_stack[AVL_MAX_HEIGHT]; - bdbuf_buffer **buf_prev = buf_stack; - bdbuf_buffer *p = *root; - - while (p != NULL) - { - if ((p->dev < dev) || ((p->dev == dev) && (p->block < block_start))) - { - p = p->avl.right; - } - else if ((p->dev > dev) || ((p->dev == dev) && (p->block > block_end))) - { - p = p->avl.left; - } - else if (p->modified) - { - return p; - } - else - { - if (p->avl.right != NULL) - { - *buf_prev++ = p->avl.right; - } - p = p->avl.left; - } - - if ((p == NULL) && (buf_prev > buf_stack)) - { - p = *--buf_prev; - } - } - - return p; -} - - -/* - * avl_insert -- - * Inserts the specified node to the AVl-Tree. - * - * PARAMETERS: - * root - Pointer to pointer to the root node - * node - Pointer to the node to add. - * - * RETURNS: - * 0 - The node added successfully - * -1 - An error occured - */ -static int -avl_insert(bdbuf_buffer **root, bdbuf_buffer *node) -{ - dev_t dev = node->dev; - blkdev_bnum block = node->block; - - bdbuf_buffer *p = *root; - bdbuf_buffer *q, *p1, *p2; - bdbuf_buffer *buf_stack[AVL_MAX_HEIGHT]; - bdbuf_buffer **buf_prev = buf_stack; - - boolean modified = FALSE; - - if (p == NULL) - { - *root = node; - node->avl.left = NULL; - node->avl.right = NULL; - node->avl.bal = 0; - return 0; - } - - while (p != NULL) - { - *buf_prev++ = p; - - if ((p->dev < dev) || ((p->dev == dev) && (p->block < block))) - { - p->avl.cache = 1; - q = p->avl.right; - if (q == NULL) - { - q = node; - p->avl.right = q = node; - break; - } - } - else if ((p->dev != dev) || (p->block != block)) - { - p->avl.cache = -1; - q = p->avl.left; - if (q == NULL) - { - q = node; - p->avl.left = q; - break; - } - } - else - { - return -1; - } - - p = q; - } - - q->avl.left = q->avl.right = NULL; - q->avl.bal = 0; - modified = TRUE; - buf_prev--; - - while (modified) - { - if (p->avl.cache == -1) - { - switch (p->avl.bal) - { - case 1: - p->avl.bal = 0; - modified = FALSE; - break; - - case 0: - p->avl.bal = -1; - break; - - case -1: - p1 = p->avl.left; - if (p1->avl.bal == -1) /* simple LL-turn */ - { - p->avl.left = p1->avl.right; - p1->avl.right = p; - p->avl.bal = 0; - p = p1; - } - else /* double LR-turn */ - { - p2 = p1->avl.right; - p1->avl.right = p2->avl.left; - p2->avl.left = p1; - p->avl.left = p2->avl.right; - p2->avl.right = p; - if (p2->avl.bal == -1) p->avl.bal = +1; else p->avl.bal = 0; - if (p2->avl.bal == +1) p1->avl.bal = -1; else p1->avl.bal = 0; - p = p2; - } - p->avl.bal = 0; - modified = FALSE; - break; - - default: - break; - } - } - else - { - switch (p->avl.bal) - { - case -1: - p->avl.bal = 0; - modified = FALSE; - break; - - case 0: - p->avl.bal = 1; - break; - - case 1: - p1 = p->avl.right; - if (p1->avl.bal == 1) /* simple RR-turn */ - { - p->avl.right = p1->avl.left; - p1->avl.left = p; - p->avl.bal = 0; - p = p1; - } - else /* double RL-turn */ - { - p2 = p1->avl.left; - p1->avl.left = p2->avl.right; - p2->avl.right = p1; - p->avl.right = p2->avl.left; - p2->avl.left = p; - if (p2->avl.bal == +1) p->avl.bal = -1; else p->avl.bal = 0; - if (p2->avl.bal == -1) p1->avl.bal = +1; else p1->avl.bal = 0; - p = p2; - } - p->avl.bal = 0; - modified = FALSE; - break; - - default: - break; - } - } - q = p; - if (buf_prev > buf_stack) - { - p = *--buf_prev; - - if (p->avl.cache == -1) - { - p->avl.left = q; - } - else - { - p->avl.right = q; - } - } - else - { - *root = p; - break; - } - }; - - return 0; -} - - -/* avl_remove -- - * removes the node from the tree. - * - * PARAMETERS: - * root_addr - Pointer to pointer to the root node - * node - Pointer to the node to remove - * - * RETURNS: - * 0 - Item removed - * -1 - No such item found - */ -static int -avl_remove(bdbuf_buffer **root, const bdbuf_buffer *node) -{ - dev_t dev = node->dev; - blkdev_bnum block = node->block; - - bdbuf_buffer *p = *root; - bdbuf_buffer *q, *r, *s, *p1, *p2; - bdbuf_buffer *buf_stack[AVL_MAX_HEIGHT]; - bdbuf_buffer **buf_prev = buf_stack; - - boolean modified = FALSE; - - memset(buf_stack, 0, sizeof(buf_stack)); - - while (p != NULL) - { - *buf_prev++ = p; - - if ((p->dev < dev) || ((p->dev == dev) && (p->block < block))) - { - p->avl.cache = 1; - p = p->avl.right; - } - else if ((p->dev != dev) || (p->block != block)) - { - p->avl.cache = -1; - p = p->avl.left; - } - else - { - /* node found */ - break; - } - } - - if (p == NULL) - { - /* there is no such node */ - return -1; - } - - q = p; - - buf_prev--; - if (buf_prev > buf_stack) - { - p = *(buf_prev - 1); - } - else - { - p = NULL; - } - - /* at this moment q - is a node to delete, p is q's parent */ - if (q->avl.right == NULL) - { - r = q->avl.left; - if (r != NULL) - { - r->avl.bal = 0; - } - q = r; - } - else - { - bdbuf_buffer **t; - - r = q->avl.right; - - if (r->avl.left == NULL) - { - r->avl.left = q->avl.left; - r->avl.bal = q->avl.bal; - r->avl.cache = 1; - *buf_prev++ = q = r; - } - else - { - t = buf_prev++; - s = r; - - while (s->avl.left != NULL) - { - *buf_prev++ = r = s; - s = r->avl.left; - r->avl.cache = -1; - } - - s->avl.left = q->avl.left; - r->avl.left = s->avl.right; - s->avl.right = q->avl.right; - s->avl.bal = q->avl.bal; - s->avl.cache = 1; - - *t = q = s; - } - } - - if (p != NULL) - { - if (p->avl.cache == -1) - { - p->avl.left = q; - } - else - { - p->avl.right = q; - } - } - else - { - *root = q; - } - - modified = TRUE; - - while (modified) - { - if (buf_prev > buf_stack) - { - p = *--buf_prev; - } - else - { - break; - } - - if (p->avl.cache == -1) - { - /* rebalance left branch */ - switch (p->avl.bal) - { - case -1: - p->avl.bal = 0; - break; - case 0: - p->avl.bal = 1; - modified = FALSE; - break; - - case +1: - p1 = p->avl.right; - - if (p1->avl.bal >= 0) /* simple RR-turn */ - { - p->avl.right = p1->avl.left; - p1->avl.left = p; - - if (p1->avl.bal == 0) - { - p1->avl.bal = -1; - modified = FALSE; - } - else - { - p->avl.bal = 0; - p1->avl.bal = 0; - } - p = p1; - } - else /* double RL-turn */ - { - p2 = p1->avl.left; - - p1->avl.left = p2->avl.right; - p2->avl.right = p1; - p->avl.right = p2->avl.left; - p2->avl.left = p; - - if (p2->avl.bal == +1) p->avl.bal = -1; else p->avl.bal = 0; - if (p2->avl.bal == -1) p1->avl.bal = 1; else p1->avl.bal = 0; - - p = p2; - p2->avl.bal = 0; - } - break; - - default: - break; - } - } - else - { - /* rebalance right branch */ - switch (p->avl.bal) - { - case +1: - p->avl.bal = 0; - break; - - case 0: - p->avl.bal = -1; - modified = FALSE; - break; - - case -1: - p1 = p->avl.left; - - if (p1->avl.bal <= 0) /* simple LL-turn */ - { - p->avl.left = p1->avl.right; - p1->avl.right = p; - if (p1->avl.bal == 0) - { - p1->avl.bal = 1; - modified = FALSE; - } - else - { - p->avl.bal = 0; - p1->avl.bal = 0; - } - p = p1; - } - else /* double LR-turn */ - { - p2 = p1->avl.right; - - p1->avl.right = p2->avl.left; - p2->avl.left = p1; - p->avl.left = p2->avl.right; - p2->avl.right = p; - - if (p2->avl.bal == -1) p->avl.bal = 1; else p->avl.bal = 0; - if (p2->avl.bal == +1) p1->avl.bal = -1; else p1->avl.bal = 0; - - p = p2; - p2->avl.bal = 0; - } - break; - - default: - break; - } - } - - if (buf_prev > buf_stack) - { - q = *(buf_prev - 1); - - if (q->avl.cache == -1) - { - q->avl.left = p; - } - else - { - q->avl.right = p; - } - } - else - { - *root = p; - break; - } - - } - - return 0; -} - -/* bdbuf_initialize_pool -- - * Initialize single buffer pool. - * - * PARAMETERS: - * config - buffer pool configuration - * pool - pool number - * - * RETURNS: - * RTEMS_SUCCESSFUL, if buffer pool initialized successfully, or error - * code if error occured. - */ -static rtems_status_code -bdbuf_initialize_pool(rtems_bdbuf_config *config, int pool) -{ - bdbuf_pool *p = bd_ctx.pool + pool; - unsigned char *bufs; - bdbuf_buffer *b; - rtems_status_code rc; - int i; - - p->blksize = config->size; - p->nblks = config->num; - p->tree = NULL; - - Chain_Initialize_empty(&p->free); - Chain_Initialize_empty(&p->lru); - - /* Allocate memory for buffer descriptors */ - p->bdbufs = calloc(config->num, sizeof(bdbuf_buffer)); - if (p->bdbufs == NULL) - { - return RTEMS_NO_MEMORY; - } - - /* Allocate memory for buffers if required */ - if (config->mem_area == NULL) - { - bufs = p->mallocd_bufs = malloc(config->num * config->size); - if (bufs == NULL) - { - free(p->bdbufs); - return RTEMS_NO_MEMORY; - } - } - else - { - bufs = config->mem_area; - p->mallocd_bufs = NULL; - } - - for (i = 0, b = p->bdbufs; i < p->nblks; i++, b++, bufs += p->blksize) - { - b->dev = -1; b->block = 0; - b->buffer = bufs; - b->actual = b->modified = b->in_progress = FALSE; - b->use_count = 0; - b->pool = pool; - _Chain_Append(&p->free, &b->link); - } - - rc = rtems_semaphore_create( - rtems_build_name('B', 'U', 'F', 'G'), - p->nblks, - RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE | RTEMS_NO_INHERIT_PRIORITY | - RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, - 0, - &p->bufget_sema); - - if (rc != RTEMS_SUCCESSFUL) - { - free(p->bdbufs); - free(p->mallocd_bufs); - return rc; - } - - return RTEMS_SUCCESSFUL; -} - -/* bdbuf_release_pool -- - * Free resources allocated for buffer pool with specified number. - * - * PARAMETERS: - * pool - buffer pool number - * - * RETURNS: - * RTEMS_SUCCESSFUL - */ -static rtems_status_code -bdbuf_release_pool(rtems_bdpool_id pool) -{ - bdbuf_pool *p = bd_ctx.pool + pool; - rtems_semaphore_delete(p->bufget_sema); - free(p->bdbufs); - free(p->mallocd_bufs); - return RTEMS_SUCCESSFUL; -} - -/* rtems_bdbuf_init -- - * Prepare buffering layer to work - initialize buffer descritors - * and (if it is neccessary)buffers. Buffers will be allocated accoriding - * to the configuration table, each entry describes kind of block and - * amount requested. After initialization all blocks is placed into - * free elements lists. - * - * PARAMETERS: - * conf_table - pointer to the buffers configuration table - * size - number of entries in configuration table - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - */ -rtems_status_code -rtems_bdbuf_init(rtems_bdbuf_config *conf_table, int size) -{ - rtems_bdpool_id i; - rtems_status_code rc; - - if (size <= 0) - return RTEMS_INVALID_SIZE; - - bd_ctx.npools = size; - - /* - * Allocate memory for buffer pool descriptors - */ - bd_ctx.pool = calloc(size, sizeof(bdbuf_pool)); - if (bd_ctx.pool == NULL) - { - return RTEMS_NO_MEMORY; - } - - Chain_Initialize_empty(&bd_ctx.mod); - - /* Initialize buffer pools and roll out if something failed */ - for (i = 0; i < size; i++) - { - rc = bdbuf_initialize_pool(conf_table + i, i); - if (rc != RTEMS_SUCCESSFUL) - { - rtems_bdpool_id j; - for (j = 0; j < i - 1; j++) - { - bdbuf_release_pool(j); - } - return rc; - } - } - - /* Create buffer flush semaphore */ - rc = rtems_semaphore_create( - rtems_build_name('B', 'F', 'L', 'U'), 0, - RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE | RTEMS_NO_INHERIT_PRIORITY | - RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, 0, - &bd_ctx.flush_sema); - if (rc != RTEMS_SUCCESSFUL) - { - for (i = 0; i < size; i++) - bdbuf_release_pool(i); - free(bd_ctx.pool); - return rc; - } - - /* Create and start swapout task */ - rc = rtems_task_create( - rtems_build_name('B', 'S', 'W', 'P'), - SWAPOUT_PRIORITY, - SWAPOUT_STACK_SIZE, - RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, - RTEMS_DEFAULT_ATTRIBUTES, - &bd_ctx.swapout_task); - if (rc != RTEMS_SUCCESSFUL) - { - rtems_semaphore_delete(bd_ctx.flush_sema); - for (i = 0; i < size; i++) - bdbuf_release_pool(i); - free(bd_ctx.pool); - return rc; - } - - rc = rtems_task_start(bd_ctx.swapout_task, bdbuf_swapout_task, 0); - if (rc != RTEMS_SUCCESSFUL) - { - rtems_task_delete(bd_ctx.swapout_task); - rtems_semaphore_delete(bd_ctx.flush_sema); - for (i = 0; i < size; i++) - bdbuf_release_pool(i); - free(bd_ctx.pool); - return rc; - } - - return RTEMS_SUCCESSFUL; -} - -/* find_or_assign_buffer -- - * Looks for buffer already assigned for this dev/block. If one is found - * obtain block buffer. If specified block already cached (i.e. there's - * block in the _modified_, or _recently_used_), return address - * of appropriate buffer descriptor and increment reference counter to 1. - * If block is not cached, allocate new buffer and return it. Data - * shouldn't be read to the buffer from media; buffer contains arbitrary - * data. This primitive may be blocked if there are no free buffer - * descriptors available and there are no unused non-modified (or - * synchronized with media) buffers available. - * - * PARAMETERS: - * device - device number (constructed of major and minor device number - * block - linear media block number - * ret_buf - address of the variable to store address of found descriptor - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFEECTS: - * bufget_sema may be obtained by this primitive - * - * NOTE: - * It is assumed that primitive invoked when thread preemption is disabled. - */ -static rtems_status_code -find_or_assign_buffer(disk_device *dd, - blkdev_bnum block, - bdbuf_buffer **ret_buf) -{ - bdbuf_buffer *bd_buf; - bdbuf_pool *bd_pool; - rtems_status_code rc; - dev_t device; - ISR_Level level; - - int blksize; - - device = dd->dev; - bd_pool = bd_ctx.pool + dd->pool; - blksize = dd->block_size; - -again: - /* Looking for buffer descriptor used for this dev/block. */ - bd_buf = avl_search(&bd_pool->tree, device, block); - - if (bd_buf == NULL) - { - /* Try to obtain semaphore without waiting first. It is the most - frequent case when reasonable number of buffers configured. If - it is failed, obtain semaphore blocking on it. In this case - it should be checked that appropriate buffer hasn't been loaded - by another thread, because this thread is preempted */ - rc = rtems_semaphore_obtain(bd_pool->bufget_sema, RTEMS_NO_WAIT, 0); - if (rc == RTEMS_UNSATISFIED) - { - rc = rtems_semaphore_obtain(bd_pool->bufget_sema, - RTEMS_WAIT, RTEMS_NO_TIMEOUT); - bd_buf = avl_search(&bd_pool->tree, device, block); - if (bd_buf != NULL) - rtems_semaphore_release(bd_pool->bufget_sema); - } - } - - if (bd_buf == NULL) - { - /* Assign new buffer descriptor */ - if (_Chain_Is_empty(&bd_pool->free)) - { - bd_buf = (bdbuf_buffer *)Chain_Get(&bd_pool->lru); - if (bd_buf != NULL) - { - int avl_result; - avl_result = avl_remove(&bd_pool->tree, bd_buf); - if (avl_result != 0) - { - rtems_fatal_error_occurred(BLKDEV_FATAL_BDBUF_CONSISTENCY); - return RTEMS_INTERNAL_ERROR; - } - } - } - else - { - bd_buf = (bdbuf_buffer *)Chain_Get(&(bd_pool->free)); - } - - if (bd_buf == NULL) - { - goto again; - } - else - { - bd_buf->dev = device; - bd_buf->block = block; -#ifdef AVL_GPL - bd_buf->avl.link[0] = NULL; - bd_buf->avl.link[1] = NULL; -#else - bd_buf->avl.left = NULL; - bd_buf->avl.right = NULL; -#endif - bd_buf->use_count = 1; - bd_buf->modified = bd_buf->actual = bd_buf->in_progress = FALSE; - bd_buf->status = RTEMS_SUCCESSFUL; - - if (avl_insert(&bd_pool->tree, bd_buf) != 0) - { - rtems_fatal_error_occurred(BLKDEV_FATAL_BDBUF_CONSISTENCY); - return RTEMS_INTERNAL_ERROR; - } - - *ret_buf = bd_buf; - - return RTEMS_SUCCESSFUL; - } - } - else - { - /* Buffer descriptor already assigned for this dev/block */ - if (bd_buf->use_count == 0) - { - /* If we are removing from lru list, obtain the bufget_sema - * first. If we are removing from mod list, obtain flush sema. - * It should be obtained without blocking because we know - * that our buffer descriptor is in the list. */ - if (bd_buf->modified) - { - rc = rtems_semaphore_obtain(bd_ctx.flush_sema, - RTEMS_NO_WAIT, 0); - } - else - { - rc = rtems_semaphore_obtain(bd_pool->bufget_sema, - RTEMS_NO_WAIT, 0); - } - /* It is possible that we couldn't obtain flush or bufget sema - * although buffer in the appropriate chain is available: - * semaphore may be released to swapout task, but this task - * actually did not start to process it. */ - if (rc == RTEMS_UNSATISFIED) - rc = RTEMS_SUCCESSFUL; - if (rc != RTEMS_SUCCESSFUL) - { - rtems_fatal_error_occurred(BLKDEV_FATAL_BDBUF_CONSISTENCY); - return RTEMS_INTERNAL_ERROR; - } - - /* Buffer descriptor is linked to the lru or mod chain. Remove - it from there. */ - Chain_Extract(&bd_buf->link); - } - bd_buf->use_count++; - while (bd_buf->in_progress != 0) - { - rtems_interrupt_disable(level); - _CORE_mutex_Seize(&bd_buf->transfer_sema, 0, TRUE, - WATCHDOG_NO_TIMEOUT, level); - } - - *ret_buf = bd_buf; - return RTEMS_SUCCESSFUL; - } -} - -/* rtems_bdbuf_get -- - * Obtain block buffer. If specified block already cached (i.e. there's - * block in the _modified_, or _recently_used_), return address - * of appropriate buffer descriptor and increment reference counter to 1. - * If block is not cached, allocate new buffer and return it. Data - * shouldn't be read to the buffer from media; buffer may contains - * arbitrary data. This primitive may be blocked if there are no free - * buffer descriptors available and there are no unused non-modified - * (or synchronized with media) buffers available. - * - * PARAMETERS: - * device - device number (constructed of major and minor device number) - * block - linear media block number - * bd - address of variable to store pointer to the buffer descriptor - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * bufget_sema semaphore obtained by this primitive. - */ -rtems_status_code -rtems_bdbuf_get(dev_t device, blkdev_bnum block, bdbuf_buffer **bd) -{ - rtems_status_code rc; - disk_device *dd; - disk_device *pdd; - preemption_key key; - - /* - * Convert logical dev/block to physical one - */ - dd = rtems_disk_lookup(device); - if (dd == NULL) - return RTEMS_INVALID_ID; - - if (block >= dd->size) - { - rtems_disk_release(dd); - return RTEMS_INVALID_NUMBER; - } - - pdd = dd->phys_dev; - block += dd->start; - rtems_disk_release(dd); - - DISABLE_PREEMPTION(key); - rc = find_or_assign_buffer(pdd, block, bd); - ENABLE_PREEMPTION(key); - - if (rc != RTEMS_SUCCESSFUL) - return rc; - - return RTEMS_SUCCESSFUL; -} - -/* bdbuf_initialize_transfer_sema -- - * Initialize transfer_sema mutex semaphore associated with buffer - * descriptor. - */ -static inline void -bdbuf_initialize_transfer_sema(bdbuf_buffer *bd_buf) -{ - CORE_mutex_Attributes mutex_attr; - mutex_attr.lock_nesting_behavior = CORE_MUTEX_NESTING_BLOCKS; - mutex_attr.only_owner_release = FALSE; - mutex_attr.discipline = CORE_MUTEX_DISCIPLINES_FIFO; - mutex_attr.priority_ceiling = 0; - - _CORE_mutex_Initialize(&bd_buf->transfer_sema, - &mutex_attr, CORE_MUTEX_LOCKED); -} - -/* bdbuf_write_transfer_done -- - * Callout function. Invoked by block device driver when data transfer - * to device (write) is completed. This function may be invoked from - * interrupt handler. - * - * PARAMETERS: - * arg - arbitrary argument specified in block device request - * structure (in this case - pointer to the appropriate - * bdbuf_buffer buffer descriptor structure). - * status - I/O completion status - * error - errno error code if status != RTEMS_SUCCESSFUL - * - * RETURNS: - * none - */ -static void -bdbuf_write_transfer_done(void *arg, rtems_status_code status, int error) -{ - bdbuf_buffer *bd_buf = arg; - bd_buf->status = status; - bd_buf->error = error; - bd_buf->in_progress = bd_buf->modified = FALSE; - _CORE_mutex_Surrender(&bd_buf->transfer_sema, 0, NULL); - _CORE_mutex_Flush(&bd_buf->transfer_sema, NULL, - CORE_MUTEX_STATUS_SUCCESSFUL); -} - -/* bdbuf_read_transfer_done -- - * Callout function. Invoked by block device driver when data transfer - * from device (read) is completed. This function may be invoked from - * interrupt handler. - * - * PARAMETERS: - * arg - arbitrary argument specified in block device request - * structure (in this case - pointer to the appropriate - * bdbuf_buffer buffer descriptor structure). - * status - I/O completion status - * error - errno error code if status != RTEMS_SUCCESSFUL - * - * RETURNS: - * none - */ -static void -bdbuf_read_transfer_done(void *arg, rtems_status_code status, int error) -{ - bdbuf_buffer *bd_buf = arg; - bd_buf->status = status; - bd_buf->error = error; - _CORE_mutex_Surrender(&bd_buf->transfer_sema, 0, NULL); - _CORE_mutex_Flush(&bd_buf->transfer_sema, NULL, - CORE_MUTEX_STATUS_SUCCESSFUL); -} - -/* rtems_bdbuf_read -- - * (Similar to the rtems_bdbuf_get, except reading data from media) - * Obtain block buffer. If specified block already cached, return address - * of appropriate buffer and increment reference counter to 1. If block is - * not cached, allocate new buffer and read data to it from the media. - * This primitive may be blocked on waiting until data to be read from - * media, if there are no free buffer descriptors available and there are - * no unused non-modified (or synchronized with media) buffers available. - * - * PARAMETERS: - * device - device number (consists of major and minor device number) - * block - linear media block number - * bd - address of variable to store pointer to the buffer descriptor - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * bufget_sema and transfer_sema semaphores obtained by this primitive. - */ -rtems_status_code -rtems_bdbuf_read(dev_t device, - blkdev_bnum block, - bdbuf_buffer **bd) -{ - preemption_key key; - ISR_Level level; - - bdbuf_buffer *bd_buf; - rtems_status_code rc; - int result; - disk_device *dd; - disk_device *pdd; - blkdev_request1 req; - - dd = rtems_disk_lookup(device); - if (dd == NULL) - return RTEMS_INVALID_ID; - - if (block >= dd->size) - { - rtems_disk_release(dd); - return RTEMS_INVALID_NUMBER; - } - - pdd = dd->phys_dev; - block += dd->start; - - DISABLE_PREEMPTION(key); - rc = find_or_assign_buffer(pdd, block, &bd_buf); - - if (rc != RTEMS_SUCCESSFUL) - { - ENABLE_PREEMPTION(key); - rtems_disk_release(dd); - return rc; - } - - if (!bd_buf->actual) - { - bd_buf->in_progress = 1; - - req.req.req = BLKDEV_REQ_READ; - req.req.req_done = bdbuf_read_transfer_done; - req.req.done_arg = bd_buf; - req.req.start = block; - req.req.count = 1; - req.req.bufnum = 1; - req.req.bufs[0].length = dd->block_size; - req.req.bufs[0].buffer = bd_buf->buffer; - - bdbuf_initialize_transfer_sema(bd_buf); - result = dd->ioctl(device, BLKIO_REQUEST, &req); - if (result == -1) - { - bd_buf->status = RTEMS_IO_ERROR; - bd_buf->error = errno; - bd_buf->actual = FALSE; - } - else - { - rtems_interrupt_disable(level); - _CORE_mutex_Seize(&bd_buf->transfer_sema, 0, TRUE, - WATCHDOG_NO_TIMEOUT, level); - bd_buf->actual = TRUE; - } - bd_buf->in_progress = FALSE; - } - rtems_disk_release(dd); - - ENABLE_PREEMPTION(key); - - *bd = bd_buf; - - return RTEMS_SUCCESSFUL; -} - - -/* bdbuf_release -- - * Release buffer. Decrease buffer usage counter. If it is zero, further - * processing depends on modified attribute. If buffer was modified, it - * is inserted into mod chain and swapout task waken up. If buffer was - * not modified, it is returned to the end of lru chain making it available - * for further use. - * - * PARAMETERS: - * bd_buf - pointer to the released buffer descriptor. - * - * RETURNS: - * RTEMS_SUCCESSFUL if buffer released successfully, or error code if - * error occured. - * - * NOTE: - * This is internal function. It is assumed that task made non-preemptive - * before its invocation. - */ -static rtems_status_code -bdbuf_release(bdbuf_buffer *bd_buf) -{ - bdbuf_pool *bd_pool; - rtems_status_code rc = RTEMS_SUCCESSFUL; - - if (bd_buf->use_count <= 0) - return RTEMS_INTERNAL_ERROR; - - bd_pool = bd_ctx.pool + bd_buf->pool; - - bd_buf->use_count--; - - if (bd_buf->use_count == 0) - { - if (bd_buf->modified) - { - - /* Buffer was modified. Insert buffer to the modified buffers - * list and initiate flushing. */ - Chain_Append(&bd_ctx.mod, &bd_buf->link); - - /* Release the flush_sema */ - rc = rtems_semaphore_release(bd_ctx.flush_sema); - } - else - { - /* Buffer was not modified. Add this descriptor to the - * end of lru chain and make it available for reuse. */ - Chain_Append(&bd_pool->lru, &bd_buf->link); - rc = rtems_semaphore_release(bd_pool->bufget_sema); - } - } - return rc; -} - - -/* rtems_bdbuf_release -- - * Release buffer allocated before. This primitive decrease the - * usage counter. If it is zero, further destiny of buffer depends on - * 'modified' status. If buffer was modified, it is placed to the end of - * mod list and flush task waken up. If buffer was not modified, - * it is placed to the end of lru list, and bufget_sema released, allowing - * to reuse this buffer. - * - * PARAMETERS: - * bd_buf - pointer to the bdbuf_buffer structure previously obtained using - * get/read primitive. - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * flush_sema and bufget_sema semaphores may be released by this primitive. - */ -rtems_status_code -rtems_bdbuf_release(bdbuf_buffer *bd_buf) -{ - preemption_key key; - rtems_status_code rc = RTEMS_SUCCESSFUL; - - if (bd_buf == NULL) - return RTEMS_INVALID_ADDRESS; - - DISABLE_PREEMPTION(key); - - rc = bdbuf_release(bd_buf); - - ENABLE_PREEMPTION(key); - - return rc; -} - -/* rtems_bdbuf_release_modified -- - * Release buffer allocated before, assuming that it is _modified_ by - * it's owner. This primitive decrease usage counter for buffer, mark - * buffer descriptor as modified. If usage counter is 0, insert it at - * end of mod chain and release flush_sema semaphore to activate the - * flush task. - * - * PARAMETERS: - * bd_buf - pointer to the bdbuf_buffer structure previously obtained using - * get/read primitive. - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * flush_sema semaphore may be released by this primitive. - */ -rtems_status_code -rtems_bdbuf_release_modified(bdbuf_buffer *bd_buf) -{ - preemption_key key; - rtems_status_code rc = RTEMS_SUCCESSFUL; - - if (bd_buf == NULL) - return RTEMS_INVALID_ADDRESS; - - DISABLE_PREEMPTION(key); - - if (!bd_buf->modified) - { - bdbuf_initialize_transfer_sema(bd_buf); - } - bd_buf->modified = TRUE; - bd_buf->actual = TRUE; - rc = bdbuf_release(bd_buf); - - ENABLE_PREEMPTION(key); - - return rc; -} - -/* rtems_bdbuf_sync -- - * Wait until specified buffer synchronized with disk. Invoked on exchanges - * critical for data consistency on the media. This primitive mark owned - * block as modified, decrease usage counter. If usage counter is 0, - * block inserted to the mod chain and flush_sema semaphore released. - * Finally, primitives blocked on transfer_sema semaphore. - * - * PARAMETERS: - * bd_buf - pointer to the bdbuf_buffer structure previously obtained using - * get/read primitive. - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - * - * SIDE EFFECTS: - * Primitive may be blocked on transfer_sema semaphore. - */ -rtems_status_code -rtems_bdbuf_sync(bdbuf_buffer *bd_buf) -{ - preemption_key key; - ISR_Level level; - rtems_status_code rc = RTEMS_SUCCESSFUL; - - if (bd_buf == NULL) - return RTEMS_INVALID_ADDRESS; - - DISABLE_PREEMPTION(key); - - if (!bd_buf->modified) - { - bdbuf_initialize_transfer_sema(bd_buf); - } - bd_buf->modified = TRUE; - bd_buf->actual = TRUE; - - rc = bdbuf_release(bd_buf); - - if (rc == RTEMS_SUCCESSFUL) - { - rtems_interrupt_disable(level); - _CORE_mutex_Seize(&bd_buf->transfer_sema, 0, TRUE, - WATCHDOG_NO_TIMEOUT, level); - } - - ENABLE_PREEMPTION(key); - - return rc; -} - -/* rtems_bdbuf_syncdev -- - * Synchronize with disk all buffers containing the blocks belonging to - * specified device. - * - * PARAMETERS: - * dev - block device number - * - * RETURNS: - * RTEMS status code (RTEMS_SUCCESSFUL if operation completed successfully - * or error code if error is occured) - */ -rtems_status_code -rtems_bdbuf_syncdev(dev_t dev) -{ - preemption_key key; - ISR_Level level; - - bdbuf_buffer *bd_buf; - disk_device *dd; - bdbuf_pool *pool; - - dd = rtems_disk_lookup(dev); - if (dd == NULL) - return RTEMS_INVALID_ID; - - pool = bd_ctx.pool + dd->pool; - - DISABLE_PREEMPTION(key); - do { - bd_buf = avl_search_for_sync(&pool->tree, dd); - if (bd_buf != NULL /* && bd_buf->modified */) - { - rtems_interrupt_disable(level); - _CORE_mutex_Seize(&bd_buf->transfer_sema, 0, TRUE, - WATCHDOG_NO_TIMEOUT, level); - } - } while (bd_buf != NULL); - ENABLE_PREEMPTION(key); - return rtems_disk_release(dd); -} - -/* bdbuf_swapout_task -- - * Body of task which take care on flushing modified buffers to the - * disk. - */ -static rtems_task -bdbuf_swapout_task(rtems_task_argument unused) -{ - rtems_status_code rc; - int result; - ISR_Level level; - bdbuf_buffer *bd_buf; - bdbuf_pool *bd_pool; - disk_device *dd; - blkdev_request1 req; - - while (1) - { - rc = rtems_semaphore_obtain(bd_ctx.flush_sema, RTEMS_WAIT, 0); - if (rc != RTEMS_SUCCESSFUL) - { - rtems_fatal_error_occurred(BLKDEV_FATAL_BDBUF_SWAPOUT); - } - - bd_buf = (bdbuf_buffer *)Chain_Get(&bd_ctx.mod); - if (bd_buf == NULL) - { - /* It is possible that flush_sema semaphore will be released, but - * buffer to be removed from mod chain before swapout task start - * its processing. */ - continue; - } - - bd_buf->in_progress = TRUE; - bd_buf->use_count++; - bd_pool = bd_ctx.pool + bd_buf->pool; - dd = rtems_disk_lookup(bd_buf->dev); - - req.req.req = BLKDEV_REQ_WRITE; - req.req.req_done = bdbuf_write_transfer_done; - req.req.done_arg = bd_buf; - req.req.start = bd_buf->block + dd->start; - req.req.count = 1; - req.req.bufnum = 1; - req.req.bufs[0].length = dd->block_size; - req.req.bufs[0].buffer = bd_buf->buffer; - - /* transfer_sema initialized when bd_buf inserted in the mod chain - first time */ - result = dd->ioctl(dd->phys_dev->dev, BLKIO_REQUEST, &req); - - rtems_disk_release(dd); - - if (result == -1) - { - bd_buf->status = RTEMS_IO_ERROR; - bd_buf->error = errno; - /* Release tasks waiting on syncing this buffer */ - _CORE_mutex_Flush(&bd_buf->transfer_sema, NULL, - CORE_MUTEX_STATUS_SUCCESSFUL); - } - else - { - if (bd_buf->in_progress) - { - rtems_interrupt_disable(level); - _CORE_mutex_Seize(&bd_buf->transfer_sema, 0, TRUE, 0, level); - } - } - bd_buf->use_count--; - - /* Another task have chance to use this buffer, or even - * modify it. If buffer is not in use, insert it in appropriate chain - * and release semaphore */ - if (bd_buf->use_count == 0) - { - if (bd_buf->modified) - { - Chain_Append(&bd_ctx.mod, &bd_buf->link); - rc = rtems_semaphore_release(bd_ctx.flush_sema); - } - else - { - Chain_Append(&bd_pool->lru, &bd_buf->link); - rc = rtems_semaphore_release(bd_pool->bufget_sema); - } - } - } -} - -/* rtems_bdbuf_find_pool -- - * Find first appropriate buffer pool. This primitive returns the index - * of first buffer pool which block size is greater than or equal to - * specified size. - * - * PARAMETERS: - * block_size - requested block size - * pool - placeholder for result - * - * RETURNS: - * RTEMS status code: RTEMS_SUCCESSFUL if operation completed successfully, - * RTEMS_INVALID_SIZE if specified block size is invalid (not a power - * of 2), RTEMS_NOT_DEFINED if buffer pool for this or greater block size - * is not configured. - */ -rtems_status_code -rtems_bdbuf_find_pool(int block_size, rtems_bdpool_id *pool) -{ - rtems_bdpool_id i; - bdbuf_pool *p; - int cursize = INT_MAX; - rtems_bdpool_id curid = -1; - rtems_boolean found = FALSE; - int j; - - for (j = block_size; (j != 0) && ((j & 1) == 0); j >>= 1); - if (j != 1) - return RTEMS_INVALID_SIZE; - - for (i = 0, p = bd_ctx.pool; i < bd_ctx.npools; i++, p++) - { - if ((p->blksize >= block_size) && - (p->blksize < cursize)) - { - curid = i; - cursize = p->blksize; - found = TRUE; - } - } - - if (found) - { - if (pool != NULL) - *pool = curid; - return RTEMS_SUCCESSFUL; - } - else - { - return RTEMS_NOT_DEFINED; - } -} - -/* rtems_bdbuf_get_pool_info -- - * Obtain characteristics of buffer pool with specified number. - * - * PARAMETERS: - * pool - buffer pool number - * block_size - block size for which buffer pool is configured returned - * there - * blocks - number of buffers in buffer pool returned there - * - * RETURNS: - * RTEMS status code: RTEMS_SUCCESSFUL if operation completed successfully, - * RTEMS_INVALID_NUMBER if appropriate buffer pool is not configured. - * - * NOTE: - * Buffer pools enumerated contiguously starting from 0. - */ -rtems_status_code -rtems_bdbuf_get_pool_info(rtems_bdpool_id pool, int *block_size, - int *blocks) -{ - if (pool >= bd_ctx.npools) - return RTEMS_INVALID_NUMBER; - - if (block_size != NULL) - { - *block_size = bd_ctx.pool[pool].blksize; - } - - if (blocks != NULL) - { - *blocks = bd_ctx.pool[pool].nblks; - } - - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/exec/libblock/src/blkdev.c b/c/src/exec/libblock/src/blkdev.c deleted file mode 100644 index d769dc45ca..0000000000 --- a/c/src/exec/libblock/src/blkdev.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * blkdev.h - block device driver generic support - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Victor V. Vengerov - * - * @(#) $Id$ - */ - -#include - -#include -#include -#include - -#include "rtems/diskdevs.h" -#include "rtems/bdbuf.h" - -/* rtems_blkdev_generic_read -- - * Generic block device read primitive. Implemented using block device - * buffer management primitives. - */ -rtems_device_driver -rtems_blkdev_generic_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg) -{ - rtems_libio_rw_args_t *args = arg; - int block_size_log2; - int block_size; - char *buf; - unsigned int count; - unsigned int block; - unsigned int blkofs; - dev_t dev; - disk_device *dd; - - dev = rtems_filesystem_make_dev_t(major, minor); - dd = rtems_disk_lookup(dev); - if (dd == NULL) - return RTEMS_INVALID_NUMBER; - - block_size_log2 = dd->block_size_log2; - block_size = dd->block_size; - - buf = args->buffer; - count = args->count; - args->bytes_moved = 0; - - block = args->offset >> block_size_log2; - blkofs = args->offset & (block_size - 1); - - while (count > 0) - { - bdbuf_buffer *diskbuf; - int copy; - rtems_status_code rc; - - rc = rtems_bdbuf_read(dev, block, &diskbuf); - if (rc != RTEMS_SUCCESSFUL) - return rc; - copy = block_size - blkofs; - if (copy > count) - copy = count; - memcpy(buf, (char *)diskbuf->buffer + blkofs, copy); - rc = rtems_bdbuf_release(diskbuf); - args->bytes_moved += copy; - if (rc != RTEMS_SUCCESSFUL) - return rc; - count -= copy; - buf += copy; - blkofs = 0; - block++; - } - return RTEMS_SUCCESSFUL; -} - -/* rtems_blkdev_generic_write -- - * Generic block device write primitive. Implemented using block device - * buffer management primitives. - */ -rtems_device_driver -rtems_blkdev_generic_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg) -{ - rtems_libio_rw_args_t *args = arg; - int block_size_log2; - int block_size; - char *buf; - unsigned int count; - unsigned int block; - unsigned int blkofs; - dev_t dev; - rtems_status_code rc; - disk_device *dd; - - dev = rtems_filesystem_make_dev_t(major, minor); - dd = rtems_disk_lookup(dev); - if (dd == NULL) - return RTEMS_INVALID_NUMBER; - - block_size_log2 = dd->block_size_log2; - block_size = dd->block_size; - - buf = args->buffer; - count = args->count; - args->bytes_moved = 0; - - block = args->offset >> block_size_log2; - blkofs = args->offset & (block_size - 1); - - while (count > 0) - { - bdbuf_buffer *diskbuf; - int copy; - - if ((blkofs == 0) && (count > block_size)) - rc = rtems_bdbuf_get(dev, block, &diskbuf); - else - rc = rtems_bdbuf_read(dev, block, &diskbuf); - if (rc != RTEMS_SUCCESSFUL) - return rc; - - copy = block_size - blkofs; - if (copy > count) - copy = count; - memcpy((char *)diskbuf->buffer + blkofs, buf, copy); - args->bytes_moved += copy; - - rc = rtems_bdbuf_release_modified(diskbuf); - if (rc != RTEMS_SUCCESSFUL) - return rc; - - count -= copy; - buf += copy; - blkofs = 0; - block++; - } - return RTEMS_SUCCESSFUL; -} - -/* blkdev_generic_open -- - * Generic block device open primitive. - */ -rtems_device_driver -rtems_blkdev_generic_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg) -{ - dev_t dev; - disk_device *dd; - - dev = rtems_filesystem_make_dev_t(major, minor); - dd = rtems_disk_lookup(dev); - if (dd == NULL) - return RTEMS_INVALID_NUMBER; - - dd->uses++; - - rtems_disk_release(dd); - - return RTEMS_SUCCESSFUL; -} - - -/* blkdev_generic_close -- - * Generic block device close primitive. - */ -rtems_device_driver -rtems_blkdev_generic_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg) -{ - dev_t dev; - disk_device *dd; - - dev = rtems_filesystem_make_dev_t(major, minor); - dd = rtems_disk_lookup(dev); - if (dd == NULL) - return RTEMS_INVALID_NUMBER; - - dd->uses--; - - rtems_disk_release(dd); - - return RTEMS_SUCCESSFUL; -} - -/* blkdev_generic_ioctl -- - * Generic block device ioctl primitive. - */ -rtems_device_driver -rtems_blkdev_generic_ioctl( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg) -{ - rtems_libio_ioctl_args_t *args = arg; - dev_t dev; - disk_device *dd; - int rc; - - dev = rtems_filesystem_make_dev_t(major, minor); - dd = rtems_disk_lookup(dev); - if (dd == NULL) - return RTEMS_INVALID_NUMBER; - - switch (args->command) - { - case BLKIO_GETBLKSIZE: - args->ioctl_return = dd->block_size; - break; - - case BLKIO_GETSIZE: - args->ioctl_return = dd->size; - break; - - case BLKIO_SYNCDEV: - rc = rtems_bdbuf_syncdev(dd->dev); - args->ioctl_return = (rc == RTEMS_SUCCESSFUL ? 0 : -1); - break; - - case BLKIO_REQUEST: - { - blkdev_request *req = args->buffer; - req->start += dd->start; - args->ioctl_return = dd->ioctl(dd->phys_dev->dev, args->command, - req); - break; - } - - default: - args->ioctl_return = dd->ioctl(dd->phys_dev->dev, args->command, - args->buffer); - break; - } - rtems_disk_release(dd); - - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/exec/libblock/src/diskdevs.c b/c/src/exec/libblock/src/diskdevs.c deleted file mode 100644 index a9d6035e8b..0000000000 --- a/c/src/exec/libblock/src/diskdevs.c +++ /dev/null @@ -1,631 +0,0 @@ -/* - * diskdevs.c - Physical and logical block devices (disks) support - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Victor V. Vengerov - * - * @(#) $Id$ - */ - - -#include -#include -#include -#include - -#include "rtems/diskdevs.h" -#include "rtems/bdbuf.h" - -#define DISKTAB_INITIAL_SIZE 32 - -/* Table of disk devices having the same major number */ -struct disk_device_table { - disk_device **minor; /* minor-indexed disk device table */ - int size; /* Number of entries in the table */ -}; - -/* Pointer to [major].minor[minor] indexed array of disk devices */ -static struct disk_device_table *disktab; - -/* Number of allocated entries in disktab table */ -static int disktab_size; - -/* Mutual exclusion semaphore for disk devices table */ -static rtems_id diskdevs_mutex; - -/* Flag meaning that disk I/O, buffering etc. already has been initialized. */ -static boolean disk_io_initialized = FALSE; - -/* diskdevs data structures protection flag. - * Normally, only table lookup operations performed. It is quite fast, so - * it is possible to done lookups when interrupts are disabled, avoiding - * obtaining the semaphore. This flags sets immediately after entering in - * mutex-protected section and cleared before leaving this section in - * "big" primitives like add/delete new device etc. Lookup function first - * disable interrupts and check this flag. If it is set, lookup function - * will be blocked on semaphore and lookup operation will be performed in - * semaphore-protected code. If it is not set (very-very frequent case), - * we can do lookup safely, enable interrupts and return result. - */ -static volatile rtems_boolean diskdevs_protected; - -/* create_disk_entry -- - * Return pointer to the disk_entry structure for the specified device, or - * create one if it is not exists. - * - * PARAMETERS: - * dev - device id (major, minor) - * - * RETURNS: - * pointer to the disk device descirptor entry, or NULL if no memory - * available for its creation. - */ -static disk_device * -create_disk_entry(dev_t dev) -{ - rtems_device_major_number major; - rtems_device_minor_number minor; - struct disk_device **d; - - rtems_filesystem_split_dev_t (dev, major, minor); - - if (major >= disktab_size) - { - struct disk_device_table *p; - int newsize; - int i; - newsize = disktab_size * 2; - if (major >= newsize) - newsize = major + 1; - p = realloc(disktab, sizeof(struct disk_device_table) * newsize); - if (p == NULL) - return NULL; - p += disktab_size; - for (i = disktab_size; i < newsize; i++, p++) - { - p->minor = NULL; - p->size = 0; - } - disktab_size = newsize; - } - - if ((disktab[major].minor == NULL) || - (minor >= disktab[major].size)) - { - int newsize; - disk_device **p; - int i; - int s = disktab[major].size; - - if (s == 0) - newsize = DISKTAB_INITIAL_SIZE; - else - newsize = s * 2; - if (minor >= newsize) - newsize = minor + 1; - - p = realloc(disktab[major].minor, sizeof(disk_device *) * newsize); - if (p == NULL) - return NULL; - disktab[major].minor = p; - p += s; - for (i = s; i < newsize; i++, p++) - *p = NULL; - disktab[major].size = newsize; - } - - d = disktab[major].minor + minor; - if (*d == NULL) - { - *d = calloc(1, sizeof(disk_device)); - } - return *d; -} - -/* get_disk_entry -- - * Get disk device descriptor by device number. - * - * PARAMETERS: - * dev - block device number - * - * RETURNS: - * Pointer to the disk device descriptor corresponding to the specified - * device number, or NULL if disk device with such number not exists. - */ -static inline disk_device * -get_disk_entry(dev_t dev) -{ - rtems_device_major_number major; - rtems_device_minor_number minor; - struct disk_device_table *dtab; - - rtems_filesystem_split_dev_t (dev, major, minor); - - if ((major >= disktab_size) || (disktab == NULL)) - return NULL; - - dtab = disktab + major; - - if ((minor >= dtab->size) || (dtab->minor == NULL)) - return NULL; - - return dtab->minor[minor]; -} - -/* create_disk -- - * Check that disk entry for specified device number is not defined - * and create it. - * - * PARAMETERS: - * dev - device identifier (major, minor numbers) - * name - character name of device (e.g. /dev/hda) - * disdev - placeholder for pointer to created disk descriptor - * - * RETURNS: - * RTEMS_SUCCESSFUL if disk entry successfully created, or - * error code if error occured (device already registered, - * no memory available). - */ -static rtems_status_code -create_disk(dev_t dev, char *name, disk_device **diskdev) -{ - disk_device *dd; - char *n; - - dd = get_disk_entry(dev); - if (dd != NULL) - { - return RTEMS_RESOURCE_IN_USE; - } - - if (name == NULL) - { - n = NULL; - } - else - { - int nlen = strlen(name) + 1; - n = malloc(nlen); - if (n == NULL) - return RTEMS_NO_MEMORY; - strncpy(n, name, nlen); - } - - dd = create_disk_entry(dev); - if (dd == NULL) - { - free(n); - return RTEMS_NO_MEMORY; - } - - dd->dev = dev; - dd->name = n; - - *diskdev = dd; - - return RTEMS_SUCCESSFUL; -} - -/* rtems_disk_create_phys -- - * Create physical disk entry. This function usually invoked from - * block device driver initialization code when physical device - * detected in the system. Device driver should provide ioctl handler - * to allow block device access operations. This primitive will register - * device in rtems (invoke rtems_io_register_name). - * - * PARAMETERS: - * dev - device identifier (major, minor numbers) - * block_size - size of disk block (minimum data transfer unit); must be - * power of 2 - * disk_size - number of blocks on device - * handler - IOCTL handler (function providing basic block input/output - * request handling BIOREQUEST and other device management - * operations) - * name - character name of device (e.g. /dev/hda) - * - * RETURNS: - * RTEMS_SUCCESSFUL if information about new physical disk added, or - * error code if error occured (device already registered, wrong block - * size value, no memory available). - */ -rtems_status_code -rtems_disk_create_phys(dev_t dev, int block_size, int disk_size, - block_device_ioctl handler, - char *name) -{ - int bs_log2; - int i; - disk_device *dd; - rtems_status_code rc; - rtems_bdpool_id pool; - rtems_device_major_number major; - rtems_device_minor_number minor; - - rtems_filesystem_split_dev_t (dev, major, minor); - - - for (bs_log2 = 0, i = block_size; (i & 1) == 0; i >>= 1, bs_log2++); - if ((bs_log2 < 9) || (i != 1)) /* block size < 512 or not power of 2 */ - return RTEMS_INVALID_NUMBER; - - rc = rtems_semaphore_obtain(diskdevs_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (rc != RTEMS_SUCCESSFUL) - return rc; - diskdevs_protected = TRUE; - - rc = rtems_bdbuf_find_pool(block_size, &pool); - if (rc != RTEMS_SUCCESSFUL) - { - diskdevs_protected = FALSE; - rtems_semaphore_release(diskdevs_mutex); - return rc; - } - - rc = create_disk(dev, name, &dd); - if (rc != RTEMS_SUCCESSFUL) - { - diskdevs_protected = FALSE; - rtems_semaphore_release(diskdevs_mutex); - return rc; - } - - dd->phys_dev = dd; - dd->uses = 0; - dd->start = 0; - dd->size = disk_size; - dd->block_size = block_size; - dd->block_size_log2 = bs_log2; - dd->ioctl = handler; - dd->pool = pool; - - rc = rtems_io_register_name(name, major, minor); - - diskdevs_protected = FALSE; - rtems_semaphore_release(diskdevs_mutex); - - return rc; -} - -/* rtems_disk_create_log -- - * Create logical disk entry. Logical disk is contiguous area on physical - * disk. Disk may be splitted to several logical disks in several ways: - * manually or using information stored in blocks on physical disk - * (DOS-like partition table, BSD disk label, etc). This function usually - * invoked from application when application-specific splitting are in use, - * or from generic code which handle different logical disk organizations. - * This primitive will register device in rtems (invoke - * rtems_io_register_name). - * - * PARAMETERS: - * dev - logical device identifier (major, minor numbers) - * phys - physical device (block device which holds this logical disk) - * identifier - * start - starting block number on the physical device - * size - logical disk size in blocks - * name - logical disk name - * - * RETURNS: - * RTEMS_SUCCESSFUL if logical device successfully added, or error code - * if error occured (device already registered, no physical device - * exists, logical disk is out of physical disk boundaries, no memory - * available). - */ -rtems_status_code -rtems_disk_create_log(dev_t dev, dev_t phys, int start, int size, char *name) -{ - disk_device *dd; - disk_device *pdd; - rtems_status_code rc; - rtems_device_major_number major; - rtems_device_minor_number minor; - - rtems_filesystem_split_dev_t (dev, major, minor); - - rc = rtems_semaphore_obtain(diskdevs_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (rc != RTEMS_SUCCESSFUL) - return rc; - diskdevs_protected = TRUE; - - pdd = get_disk_entry(phys); - if (pdd == NULL) - { - diskdevs_protected = FALSE; - rtems_semaphore_release(diskdevs_mutex); - return RTEMS_INVALID_NUMBER; - } - - rc = create_disk(dev, name, &dd); - if (rc != RTEMS_SUCCESSFUL) - { - diskdevs_protected = FALSE; - rtems_semaphore_release(diskdevs_mutex); - return rc; - } - - dd->phys_dev = pdd; - dd->uses = 0; - dd->start = start; - dd->size = size; - dd->block_size = pdd->block_size; - dd->block_size_log2 = pdd->block_size_log2; - dd->ioctl = pdd->ioctl; - - rc = rtems_io_register_name(name, major, minor); - - diskdevs_protected = FALSE; - rc = rtems_semaphore_release(diskdevs_mutex); - - return rc; -} - -/* rtems_disk_delete -- - * Delete physical or logical disk device. Device may be deleted if its - * use counter (and use counters of all logical devices - if it is - * physical device) equal to 0. When physical device deleted, - * all logical devices deleted inherently. Appropriate devices removed - * from "/dev" filesystem. - * - * PARAMETERS: - * dev - device identifier (major, minor numbers) - * - * RETURNS: - * RTEMS_SUCCESSFUL if block device successfully deleted, or error code - * if error occured (device is not defined, device is in use). - */ -rtems_status_code -rtems_disk_delete(dev_t dev) -{ - rtems_status_code rc; - int used; - rtems_device_major_number maj; - rtems_device_minor_number min; - - rc = rtems_semaphore_obtain(diskdevs_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (rc != RTEMS_SUCCESSFUL) - return rc; - diskdevs_protected = TRUE; - - /* Check if this device is in use -- calculate usage counter */ - used = 0; - for (maj = 0; maj < disktab_size; maj++) - { - struct disk_device_table *dtab = disktab + maj; - if (dtab != NULL) - { - for (min = 0; min < dtab->size; min++) - { - disk_device *dd = dtab->minor[min]; - if ((dd != NULL) && (dd->phys_dev->dev == dev)) - used += dd->uses; - } - } - } - - if (used != 0) - { - diskdevs_protected = FALSE; - rtems_semaphore_release(diskdevs_mutex); - return RTEMS_RESOURCE_IN_USE; - } - - /* Delete this device and all of its logical devices */ - for (maj = 0; maj < disktab_size; maj++) - { - struct disk_device_table *dtab = disktab +maj; - if (dtab != NULL) - { - for (min = 0; min < dtab->size; min++) - { - disk_device *dd = dtab->minor[min]; - if ((dd != NULL) && (dd->phys_dev->dev == dev)) - { - unlink(dd->name); - free(dd->name); - free(dd); - dtab->minor[min] = NULL; - } - } - } - } - - diskdevs_protected = FALSE; - rc = rtems_semaphore_release(diskdevs_mutex); - return rc; -} - -/* rtems_disk_lookup -- - * Find block device descriptor by its device identifier. - * - * PARAMETERS: - * dev - device identifier (major, minor numbers) - * - * RETURNS: - * pointer to the block device descriptor, or NULL if no such device - * exists. - */ -disk_device * -rtems_disk_lookup(dev_t dev) -{ - rtems_interrupt_level level; - disk_device *dd; - rtems_status_code rc; - - rtems_interrupt_disable(level); - if (diskdevs_protected) - { - rtems_interrupt_enable(level); - rc = rtems_semaphore_obtain(diskdevs_mutex, RTEMS_WAIT, - RTEMS_NO_TIMEOUT); - if (rc != RTEMS_SUCCESSFUL) - return NULL; - diskdevs_protected = TRUE; - dd = get_disk_entry(dev); - dd->uses++; - diskdevs_protected = FALSE; - rtems_semaphore_release(diskdevs_mutex); - return dd; - } - else - { - /* Frequent and quickest case */ - dd = get_disk_entry(dev); - dd->uses++; - rtems_interrupt_enable(level); - return dd; - } -} - -/* rtems_disk_release -- - * Release disk_device structure (decrement usage counter to 1). - * - * PARAMETERS: - * dd - pointer to disk device structure - * - * RETURNS: - * RTEMS_SUCCESSFUL - */ -rtems_status_code -rtems_disk_release(disk_device *dd) -{ - rtems_interrupt_level level; - rtems_interrupt_disable(level); - dd->uses--; - rtems_interrupt_enable(level); - return RTEMS_SUCCESSFUL; -} - -/* rtems_disk_next -- - * Disk device enumerator. Looking for device having device number larger - * than dev and return disk device descriptor for it. If there are no - * such device, NULL value returned. - * - * PARAMETERS: - * dev - device number (use -1 to start search) - * - * RETURNS: - * Pointer to the disk descriptor for next disk device, or NULL if all - * devices enumerated. - */ -disk_device * -rtems_disk_next(dev_t dev) -{ - rtems_device_major_number major; - rtems_device_minor_number minor; - struct disk_device_table *dtab; - - dev++; - rtems_filesystem_split_dev_t (dev, major, minor); - - if (major >= disktab_size) - return NULL; - - dtab = disktab + major; - while (TRUE) - { - if ((dtab == NULL) || (minor > dtab->size)) - { - major++; minor = 0; - if (major >= disktab_size) - return NULL; - dtab = disktab + major; - } - else if (dtab->minor[minor] == NULL) - { - minor++; - } - else - return dtab->minor[minor]; - } -} - -/* rtems_disk_initialize -- - * Initialization of disk device library (initialize all data structures, - * etc.) - * - * PARAMETERS: - * none - * - * RETURNS: - * RTEMS_SUCCESSFUL if library initialized, or error code if error - * occured. - */ -rtems_status_code -rtems_disk_io_initialize(void) -{ - rtems_status_code rc; - - if (disk_io_initialized) - return RTEMS_SUCCESSFUL; - - disktab_size = DISKTAB_INITIAL_SIZE; - disktab = calloc(disktab_size, sizeof(struct disk_device_table)); - if (disktab == NULL) - return RTEMS_NO_MEMORY; - - diskdevs_protected = FALSE; - rc = rtems_semaphore_create( - rtems_build_name('D', 'D', 'E', 'V'), 1, - RTEMS_FIFO | RTEMS_BINARY_SEMAPHORE | RTEMS_NO_INHERIT_PRIORITY | - RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, 0, &diskdevs_mutex); - - if (rc != RTEMS_SUCCESSFUL) - { - free(disktab); - return rc; - } - - rc = rtems_bdbuf_init(rtems_bdbuf_configuration, - rtems_bdbuf_configuration_size); - - if (rc != RTEMS_SUCCESSFUL) - { - rtems_semaphore_delete(diskdevs_mutex); - free(disktab); - return rc; - } - - disk_io_initialized = 1; - return RTEMS_SUCCESSFUL; -} - -/* rtems_disk_io_done -- - * Release all resources allocated for disk device interface. - * - * PARAMETERS: - * none - * - * RETURNS: - * RTEMS_SUCCESSFUL if all resources released, or error code if error - * occured. - */ -rtems_status_code -rtems_disk_io_done(void) -{ - rtems_device_major_number maj; - rtems_device_minor_number min; - rtems_status_code rc; - - /* Free data structures */ - for (maj = 0; maj < disktab_size; maj++) - { - struct disk_device_table *dtab = disktab + maj; - if (dtab != NULL) - { - for (min = 0; min < dtab->size; min++) - { - disk_device *dd = dtab->minor[min]; - unlink(dd->name); - free(dd->name); - free(dd); - } - free(dtab); - } - } - free(disktab); - - rc = rtems_semaphore_release(diskdevs_mutex); - - /* XXX bdbuf should be released too! */ - disk_io_initialized = 0; - return rc; -} diff --git a/c/src/exec/libblock/src/ramdisk.c b/c/src/exec/libblock/src/ramdisk.c deleted file mode 100644 index 7be2eabcc8..0000000000 --- a/c/src/exec/libblock/src/ramdisk.c +++ /dev/null @@ -1,225 +0,0 @@ -/* ramdisk.c -- RAM disk block device implementation - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Victor V. Vengerov - * - * @(#) $Id$ - */ - -#include -#include -#include -#include -#include -#include - -#include "rtems/blkdev.h" -#include "rtems/diskdevs.h" -#include "rtems/ramdisk.h" - -#define RAMDISK_DEVICE_BASE_NAME "/dev/ramdisk" - -/* Internal RAM disk descriptor */ -struct ramdisk { - int block_size; /* RAM disk block size */ - int block_num; /* Number of blocks on this RAM disk */ - void *area; /* RAM disk memory area */ - rtems_boolean initialized;/* RAM disk is initialized */ - rtems_boolean malloced; /* != 0, if memory allocated by malloc for this - RAM disk */ -}; - -static struct ramdisk *ramdisk; -static int nramdisks; - -/* ramdisk_read -- - * RAM disk READ request handler. This primitive copies data from RAM - * disk to supplied buffer and invoke the callout function to inform - * upper layer that reading is completed. - * - * PARAMETERS: - * req - pointer to the READ block device request info - * - * RETURNS: - * ioctl return value - */ -static int -ramdisk_read(struct ramdisk *rd, blkdev_request *req) -{ - char *from; - rtems_unsigned32 i; - blkdev_sg_buffer *sg; - rtems_unsigned32 remains; - - from = (char *)rd->area + (req->start * rd->block_size); - remains = rd->block_size * req->count; - sg = req->bufs; - for (i = 0; (remains > 0) && (i < req->bufnum); i++, sg++) - { - int count = sg->length; - if (count > remains) - count = remains; - memcpy(sg->buffer, from, count); - remains -= count; - } - req->req_done(req->done_arg, RTEMS_SUCCESSFUL, 0); - return 0; -} - -/* ramdisk_write -- - * RAM disk WRITE request handler. This primitive copies data from - * supplied buffer to RAM disk and invoke the callout function to inform - * upper layer that writing is completed. - * - * PARAMETERS: - * req - pointer to the WRITE block device request info - * - * RETURNS: - * ioctl return value - */ -static int -ramdisk_write(struct ramdisk *rd, blkdev_request *req) -{ - char *to; - rtems_unsigned32 i; - blkdev_sg_buffer *sg; - rtems_unsigned32 remains; - - to = (char *)rd->area + (req->start * rd->block_size); - remains = rd->block_size * req->count; - sg = req->bufs; - for (i = 0; (remains > 0) && (i < req->bufnum); i++, sg++) - { - int count = sg->length; - if (count > remains) - count = remains; - memcpy(to, sg->buffer, count); - remains -= count; - } - req->req_done(req->done_arg, RTEMS_SUCCESSFUL, 0); - return 0; -} - -/* ramdisk_ioctl -- - * IOCTL handler for RAM disk device. - * - * PARAMETERS: - * dev - device number (major, minor number) - * req - IOCTL request code - * argp - IOCTL argument - * - * RETURNS: - * IOCTL return value - */ -static int -ramdisk_ioctl(dev_t dev, int req, void *argp) -{ - switch (req) - { - case BLKIO_REQUEST: - { - rtems_device_minor_number minor; - blkdev_request *r = argp; - struct ramdisk *rd; - - minor = rtems_filesystem_dev_minor_t(dev); - if ((minor >= nramdisks) || !ramdisk[minor].initialized) - { - errno = ENODEV; - return -1; - } - - rd = ramdisk + minor; - - switch (r->req) - { - case BLKDEV_REQ_READ: - return ramdisk_read(rd, r); - - case BLKDEV_REQ_WRITE: - return ramdisk_write(rd, r); - - default: - errno = EBADRQC; - return -1; - } - break; - } - - default: - errno = EBADRQC; - return -1; - } -} - -/* ramdisk_initialize -- - * RAM disk device driver initialization. Run through RAM disk - * configuration information and configure appropriate RAM disks. - * - * PARAMETERS: - * major - RAM disk major device number - * minor - minor device number, not applicable - * arg - initialization argument, not applicable - * - * RETURNS: - * none - */ -rtems_device_driver -ramdisk_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg) -{ - rtems_device_minor_number i; - rtems_ramdisk_config *c = rtems_ramdisk_configuration; - struct ramdisk *r; - rtems_status_code rc; - - rc = rtems_disk_io_initialize(); - if (rc != RTEMS_SUCCESSFUL) - return rc; - - r = ramdisk = calloc(rtems_ramdisk_configuration_size, - sizeof(struct ramdisk)); - - for (i = 0; i < rtems_ramdisk_configuration_size; i++, c++, r++) - { - dev_t dev = rtems_filesystem_make_dev_t(major, i); - char name[sizeof(RAMDISK_DEVICE_BASE_NAME "0123456789")]; - snprintf(name, sizeof(name), RAMDISK_DEVICE_BASE_NAME "%d", i); - r->block_size = c->block_size; - r->block_num = c->block_num; - if (c->location == NULL) - { - r->malloced = TRUE; - r->area = malloc(r->block_size * r->block_num); - if (r->area == NULL) /* No enough memory for this disk */ - { - r->initialized = FALSE; - continue; - } - else - { - r->initialized = TRUE; - } - } - else - { - r->malloced = FALSE; - r->initialized = TRUE; - r->area = c->location; - } - rc = rtems_disk_create_phys(dev, c->block_size, c->block_num, - ramdisk_ioctl, name); - if (rc != RTEMS_SUCCESSFUL) - { - if (r->malloced) - { - free(r->area); - } - r->initialized = FALSE; - } - } - nramdisks = rtems_ramdisk_configuration_size; - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/exec/libcsupport/.cvsignore b/c/src/exec/libcsupport/.cvsignore deleted file mode 100644 index d29e5050f5..0000000000 --- a/c/src/exec/libcsupport/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -config.cache -config.guess -config.log -config.status -config.sub -configure -depcomp -install-sh -missing -mkinstalldirs diff --git a/c/src/exec/libcsupport/ChangeLog b/c/src/exec/libcsupport/ChangeLog deleted file mode 100755 index f781535fb7..0000000000 --- a/c/src/exec/libcsupport/ChangeLog +++ /dev/null @@ -1,39 +0,0 @@ -2002-07-05 Ralf Corsepius - - * configure.ac: RTEMS_TOP(../..). - -2002-07-01 Joel Sherrill - - * src/__times.c: Corrected from previous attempt to cleanup. - -2002-07-01 Ralf Corsepius - - * configure.ac: Remove RTEMS_PROJECT_ROOT. - -2002-06-28 Joel Sherrill - - * src/__times.c: Cleaned up comments, return more information, - and eliminated the fatal error on clock not set since it cannot - occur. - -2002-06-27 Ralf Corsepius - - * configure.ac: Use AC_CONFIG_AUX_DIR(../..). - Add AC_PROG_RANLIB. - -2002-06-17 Ralf Corsepius - - * Makefile.am: Merge src/Makefile.am. - * configure.ac: Reflect changes above. - * src/Makefile.am: Remove. - -2002-06-17 Ralf Corsepius - - * Makefile.am: Include $(top_srcdir)/../automake/*.am. - Use ../aclocal. - * src/Makefile.am: Include $(top_srcdir)/../automake/*.am. - -2001-05-24 Joel Sherrill - - * src/.cvsignore: New file. - diff --git a/c/src/exec/libcsupport/Makefile.am b/c/src/exec/libcsupport/Makefile.am deleted file mode 100644 index 22cbad4233..0000000000 --- a/c/src/exec/libcsupport/Makefile.am +++ /dev/null @@ -1,165 +0,0 @@ -## -## $Id$ -## - -ACLOCAL_AMFLAGS = -I ../aclocal - -include $(top_srcdir)/../automake/multilib.am -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/lib.am - -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) - -LIBNAME = libcsupport -LIB = ${ARCH}/${LIBNAME}.a - -INCLUDES = -Isrc - -ERROR_C_FILES = src/error.c - -ASSOCIATION_C_FILES = src/assoc.c src/assocnamebad.c - -BASE_FS_C_FILES = src/base_fs.c src/mount.c src/unmount.c src/libio.c \ - src/libio_sockets.c src/eval.c src/fs_null_handlers.c src/privateenv.c - -TERMIOS_C_FILES = src/cfgetispeed.c src/cfgetospeed.c src/cfsetispeed.c src/cfsetospeed.c \ - src/tcgetattr.c src/tcsetattr.c src/tcdrain.c src/tcflow.c src/tcflush.c src/tcgetprgrp.c \ - src/tcsendbreak.c src/tcsetpgrp.c src/termios.c src/termiosinitialize.c \ - src/termiosreserveresources.c - -SYSTEM_CALL_C_FILES = src/open.c src/close.c src/read.c src/write.c src/lseek.c src/ioctl.c src/mkdir.c \ - src/mknod.c src/mkfifo.c src/rmdir.c src/chdir.c src/chmod.c src/fchdir.c src/fchmod.c src/chown.c \ - src/link.c src/unlink.c src/umask.c src/ftruncate.c src/utime.c src/fstat.c src/fcntl.c src/fpathconf.c \ - src/getdents.c src/fsync.c src/fdatasync.c src/pipe.c src/dup.c src/dup2.c src/symlink.c src/readlink.c \ - src/creat.c src/chroot.c - -DIRECTORY_SCAN_C_FILES = src/opendir.c src/closedir.c src/readdir.c src/rewinddir.c \ - src/scandir.c src/seekdir.c src/telldir.c src/getcwd.c - -MALLOC_C_FILES = src/malloc.c src/mallocfreespace.c src/__brk.c src/__sbrk.c - -PASSWORD_GROUP_C_FILES = src/getpwent.c src/getgrent.c - -TERMINAL_IDENTIFICATION_C_FILES = src/ctermid.c src/isatty.c src/ttyname.c src/ttyname_r.c - -LIBC_GLUE_C_FILES = src/__getpid.c src/__gettod.c src/__times.c src/truncate.c src/access.c \ - src/stat.c src/lstat.c src/pathconf.c src/newlibc.c src/no_posix.c src/no_libc.c src/utsname.c - -UNIX_LIBC_C_FILES = src/unixlibc.c src/hosterr.c - -COMMON_C_FILES = src/gxx_wrappers.c src/printk.c $(BASE_FS_C_FILES) \ - $(MALLOC_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:src/%.c=${ARCH}/%.o) -OBJS = $(C_O_FILES) - -# -# Add local stuff here using += -# - -AM_CFLAGS += $(LIBC_DEFINES) - -all-local: ${ARCH} ${LIB} - -${ARCH}/%.o: src/%.c - ${COMPILE} -o $@ -c $< - -$(LIB): ${OBJS} - $(make-library) - -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/exec/libcsupport/configure.ac b/c/src/exec/libcsupport/configure.ac deleted file mode 100644 index 2e03783f45..0000000000 --- a/c/src/exec/libcsupport/configure.ac +++ /dev/null @@ -1,34 +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([src]) -RTEMS_TOP(../..) -AC_CONFIG_AUX_DIR(../..) - -RTEMS_CANONICAL_TARGET_CPU -AM_INIT_AUTOMAKE([no-define foreign 1.6]) -AM_MAINTAINER_MODE - -RTEMS_ENV_RTEMSCPU - -RTEMS_CHECK_CPU -RTEMS_CANONICAL_HOST - -RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) -RTEMS_CANONICALIZE_TOOLS -AC_PROG_RANLIB - -RTEMS_CHECK_NEWLIB -RTEMS_CHECK_MULTIPROCESSING - -AM_CONDITIONAL(UNIX,test x"$RTEMS_CPU" = x"unix") -AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes") - -AM_CONFIG_HEADER(src/config.h) - -# Explicitly list all Makefiles here -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/c/src/exec/libcsupport/include/.cvsignore b/c/src/exec/libcsupport/include/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libcsupport/include/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libcsupport/include/chain.h b/c/src/exec/libcsupport/include/chain.h deleted file mode 100644 index ab8bb42513..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/clockdrv.h b/c/src/exec/libcsupport/include/clockdrv.h deleted file mode 100644 index d7b0b4671f..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/console.h b/c/src/exec/libcsupport/include/console.h deleted file mode 100644 index 2d2f380012..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/inttypes.h b/c/src/exec/libcsupport/include/inttypes.h deleted file mode 100644 index dad6c67c7d..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/iosupp.h b/c/src/exec/libcsupport/include/iosupp.h deleted file mode 100644 index ef8e01b76d..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/motorola/.cvsignore b/c/src/exec/libcsupport/include/motorola/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libcsupport/include/motorola/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libcsupport/include/motorola/mc68230.h b/c/src/exec/libcsupport/include/motorola/mc68230.h deleted file mode 100644 index 22ec49c12b..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/motorola/mc68681.h b/c/src/exec/libcsupport/include/motorola/mc68681.h deleted file mode 100644 index 7602097fd8..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/ringbuf.h b/c/src/exec/libcsupport/include/ringbuf.h deleted file mode 100644 index 8c80aaf9c8..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/rtc.h b/c/src/exec/libcsupport/include/rtc.h deleted file mode 100644 index ba9f9d6622..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/rtems/.cvsignore b/c/src/exec/libcsupport/include/rtems/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libcsupport/include/rtems/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libcsupport/include/rtems/assoc.h b/c/src/exec/libcsupport/include/rtems/assoc.h deleted file mode 100644 index 1982d654ac..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/rtems/error.h b/c/src/exec/libcsupport/include/rtems/error.h deleted file mode 100644 index de6e1715db..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/rtems/libcsupport.h b/c/src/exec/libcsupport/include/rtems/libcsupport.h deleted file mode 100644 index 4def1e82c5..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/rtems/libio.h b/c/src/exec/libcsupport/include/rtems/libio.h deleted file mode 100644 index d95e5c375e..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/rtems/libio_.h b/c/src/exec/libcsupport/include/rtems/libio_.h deleted file mode 100644 index 4265c55a1e..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/rtems/termiostypes.h b/c/src/exec/libcsupport/include/rtems/termiostypes.h deleted file mode 100644 index adda9e0871..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/spurious.h b/c/src/exec/libcsupport/include/spurious.h deleted file mode 100644 index 36fcaba904..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/stdint.h b/c/src/exec/libcsupport/include/stdint.h deleted file mode 100644 index dd2e490ef9..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/sys/.cvsignore b/c/src/exec/libcsupport/include/sys/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libcsupport/include/sys/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libcsupport/include/sys/cdefs.h b/c/src/exec/libcsupport/include/sys/cdefs.h deleted file mode 100644 index d089dc5894..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/sys/filio.h b/c/src/exec/libcsupport/include/sys/filio.h deleted file mode 100644 index 5a8b7e4bbb..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/sys/ioccom.h b/c/src/exec/libcsupport/include/sys/ioccom.h deleted file mode 100644 index 60e16a6c8a..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/sys/ioctl.h b/c/src/exec/libcsupport/include/sys/ioctl.h deleted file mode 100644 index e3a69a5a7f..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/sys/sockio.h b/c/src/exec/libcsupport/include/sys/sockio.h deleted file mode 100644 index 5e54baffe8..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/sys/termios.h b/c/src/exec/libcsupport/include/sys/termios.h deleted file mode 100644 index 199bb2aef2..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/sys/ttycom.h b/c/src/exec/libcsupport/include/sys/ttycom.h deleted file mode 100644 index f2e491bc50..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/sys/utime.h b/c/src/exec/libcsupport/include/sys/utime.h deleted file mode 100644 index 3e9955e61f..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/sys/utsname.h b/c/src/exec/libcsupport/include/sys/utsname.h deleted file mode 100644 index 70d6dfc7cf..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/timerdrv.h b/c/src/exec/libcsupport/include/timerdrv.h deleted file mode 100644 index 1234f8283a..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/vmeintr.h b/c/src/exec/libcsupport/include/vmeintr.h deleted file mode 100644 index 583ccff6cc..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/zilog/.cvsignore b/c/src/exec/libcsupport/include/zilog/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libcsupport/include/zilog/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libcsupport/include/zilog/z8036.h b/c/src/exec/libcsupport/include/zilog/z8036.h deleted file mode 100644 index d2f1652bcc..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/zilog/z8530.h b/c/src/exec/libcsupport/include/zilog/z8530.h deleted file mode 100644 index aba481ac25..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/include/zilog/z8536.h b/c/src/exec/libcsupport/include/zilog/z8536.h deleted file mode 100644 index 8b8fac4567..0000000000 --- a/c/src/exec/libcsupport/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/exec/libcsupport/src/.cvsignore b/c/src/exec/libcsupport/src/.cvsignore deleted file mode 100644 index 9188ae45da..0000000000 --- a/c/src/exec/libcsupport/src/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -stamp-h -stamp-h.in -config.h -config.h.in diff --git a/c/src/exec/libcsupport/src/CASES b/c/src/exec/libcsupport/src/CASES deleted file mode 100644 index 4578ae5009..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/README b/c/src/exec/libcsupport/src/README deleted file mode 100644 index ee7a90501e..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/TODO b/c/src/exec/libcsupport/src/TODO deleted file mode 100644 index 38cb012326..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/__brk.c b/c/src/exec/libcsupport/src/__brk.c deleted file mode 100644 index 296b0e3ca7..0000000000 --- a/c/src/exec/libcsupport/src/__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/exec/libcsupport/src/__getpid.c b/c/src/exec/libcsupport/src/__getpid.c deleted file mode 100644 index 54a7c980e0..0000000000 --- a/c/src/exec/libcsupport/src/__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/exec/libcsupport/src/__gettod.c b/c/src/exec/libcsupport/src/__gettod.c deleted file mode 100644 index 96e44802dc..0000000000 --- a/c/src/exec/libcsupport/src/__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/exec/libcsupport/src/__sbrk.c b/c/src/exec/libcsupport/src/__sbrk.c deleted file mode 100644 index 87753d7016..0000000000 --- a/c/src/exec/libcsupport/src/__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/exec/libcsupport/src/__times.c b/c/src/exec/libcsupport/src/__times.c deleted file mode 100644 index 7c06a879f1..0000000000 --- a/c/src/exec/libcsupport/src/__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_interval ticks; - - if ( !ptms ) { - errno = EFAULT; - return -1; - } - - /* - * This call does not depend on TOD being initialized and can't fail. - */ - - (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks ); - - /* - * RTEMS technically has no notion of system versus user time - * since there is no separation of OS from application tasks. - * But we can at least make a distinction between the number - * of ticks since boot and the number of ticks executed by this - * this thread. - */ - - ptms->tms_utime = _Thread_Executing->ticks_executed; - ptms->tms_stime = ticks; - ptms->tms_cutime = 0; - ptms->tms_cstime = 0; - - return ticks; -} - -/* - * 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/exec/libcsupport/src/access.c b/c/src/exec/libcsupport/src/access.c deleted file mode 100644 index 7540cd8d55..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/assoc.c b/c/src/exec/libcsupport/src/assoc.c deleted file mode 100644 index 3e4fb21211..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/assocnamebad.c b/c/src/exec/libcsupport/src/assocnamebad.c deleted file mode 100644 index 4a6a52d6c6..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/base_fs.c b/c/src/exec/libcsupport/src/base_fs.c deleted file mode 100644 index 119f38d794..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/cfgetispeed.c b/c/src/exec/libcsupport/src/cfgetispeed.c deleted file mode 100644 index 964b51ccc4..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/cfgetospeed.c b/c/src/exec/libcsupport/src/cfgetospeed.c deleted file mode 100644 index 955791cbe6..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/cfsetispeed.c b/c/src/exec/libcsupport/src/cfsetispeed.c deleted file mode 100644 index 0298340848..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/cfsetospeed.c b/c/src/exec/libcsupport/src/cfsetospeed.c deleted file mode 100644 index 20e1b11403..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/chdir.c b/c/src/exec/libcsupport/src/chdir.c deleted file mode 100644 index 07fca7610a..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/chmod.c b/c/src/exec/libcsupport/src/chmod.c deleted file mode 100644 index 5e62be0683..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/chown.c b/c/src/exec/libcsupport/src/chown.c deleted file mode 100644 index c860ace76e..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/chroot.c b/c/src/exec/libcsupport/src/chroot.c deleted file mode 100644 index 95124a43c0..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/close.c b/c/src/exec/libcsupport/src/close.c deleted file mode 100644 index a9bfc289ac..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/closedir.c b/c/src/exec/libcsupport/src/closedir.c deleted file mode 100644 index 64562264ec..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/creat.c b/c/src/exec/libcsupport/src/creat.c deleted file mode 100644 index ed7a872d4a..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/ctermid.c b/c/src/exec/libcsupport/src/ctermid.c deleted file mode 100644 index 6869acb291..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/dup.c b/c/src/exec/libcsupport/src/dup.c deleted file mode 100644 index 2edce9c6ff..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/dup2.c b/c/src/exec/libcsupport/src/dup2.c deleted file mode 100644 index af4ed99fb5..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/envlock.c b/c/src/exec/libcsupport/src/envlock.c deleted file mode 100644 index 444d0e6b63..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/error.c b/c/src/exec/libcsupport/src/error.c deleted file mode 100644 index fff95ce80c..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/eval.c b/c/src/exec/libcsupport/src/eval.c deleted file mode 100644 index 7d70d20cf7..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/fchdir.c b/c/src/exec/libcsupport/src/fchdir.c deleted file mode 100644 index 7c984bc892..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/fchmod.c b/c/src/exec/libcsupport/src/fchmod.c deleted file mode 100644 index 70b58a0998..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/fcntl.c b/c/src/exec/libcsupport/src/fcntl.c deleted file mode 100644 index 6c2aa1da11..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/fdatasync.c b/c/src/exec/libcsupport/src/fdatasync.c deleted file mode 100644 index ca27f996aa..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/fpathconf.c b/c/src/exec/libcsupport/src/fpathconf.c deleted file mode 100644 index ac65db000b..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/fs_null_handlers.c b/c/src/exec/libcsupport/src/fs_null_handlers.c deleted file mode 100644 index f9a08d0aca..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/fstat.c b/c/src/exec/libcsupport/src/fstat.c deleted file mode 100644 index 22b1f8c412..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/fsync.c b/c/src/exec/libcsupport/src/fsync.c deleted file mode 100644 index 56ef546f83..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/ftruncate.c b/c/src/exec/libcsupport/src/ftruncate.c deleted file mode 100644 index 4f1cb79d93..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/getcwd.c b/c/src/exec/libcsupport/src/getcwd.c deleted file mode 100644 index fdde4eea81..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/getdents.c b/c/src/exec/libcsupport/src/getdents.c deleted file mode 100644 index fe774fc2f2..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/getgrent.c b/c/src/exec/libcsupport/src/getgrent.c deleted file mode 100644 index 104b0a317f..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/getpwent.c b/c/src/exec/libcsupport/src/getpwent.c deleted file mode 100644 index 91b6550f59..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/gxx_wrappers.c b/c/src/exec/libcsupport/src/gxx_wrappers.c deleted file mode 100644 index d660a6f226..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/hosterr.c b/c/src/exec/libcsupport/src/hosterr.c deleted file mode 100644 index 2a02fd2b03..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/ioctl.c b/c/src/exec/libcsupport/src/ioctl.c deleted file mode 100644 index 5527747cff..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/isatty.c b/c/src/exec/libcsupport/src/isatty.c deleted file mode 100644 index 57eeb8ca50..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/libio.c b/c/src/exec/libcsupport/src/libio.c deleted file mode 100644 index 713ba6dd33..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/libio_sockets.c b/c/src/exec/libcsupport/src/libio_sockets.c deleted file mode 100644 index a1e98c8b0a..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/link.c b/c/src/exec/libcsupport/src/link.c deleted file mode 100644 index 6587f76fb5..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/lseek.c b/c/src/exec/libcsupport/src/lseek.c deleted file mode 100644 index 0a87a4997d..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/lstat.c b/c/src/exec/libcsupport/src/lstat.c deleted file mode 100644 index 8a3e38c049..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/malloc.c b/c/src/exec/libcsupport/src/malloc.c deleted file mode 100644 index 9f02311478..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/mallocfreespace.c b/c/src/exec/libcsupport/src/mallocfreespace.c deleted file mode 100644 index 26f4f34944..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/mkdir.c b/c/src/exec/libcsupport/src/mkdir.c deleted file mode 100644 index c67a0a8cb4..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/mkfifo.c b/c/src/exec/libcsupport/src/mkfifo.c deleted file mode 100644 index 2c1ae3889c..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/mknod.c b/c/src/exec/libcsupport/src/mknod.c deleted file mode 100644 index 6110b90e1d..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/mount.c b/c/src/exec/libcsupport/src/mount.c deleted file mode 100644 index 9ea08b7e2b..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/newlibc.c b/c/src/exec/libcsupport/src/newlibc.c deleted file mode 100644 index 8c3836a1e7..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/no_libc.c b/c/src/exec/libcsupport/src/no_libc.c deleted file mode 100644 index 016b577e63..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/no_posix.c b/c/src/exec/libcsupport/src/no_posix.c deleted file mode 100644 index a845092173..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/open.c b/c/src/exec/libcsupport/src/open.c deleted file mode 100644 index f36f74d4ac..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/opendir.c b/c/src/exec/libcsupport/src/opendir.c deleted file mode 100644 index eef211dcbc..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/pathconf.c b/c/src/exec/libcsupport/src/pathconf.c deleted file mode 100644 index 0d9d4894e8..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/pipe.c b/c/src/exec/libcsupport/src/pipe.c deleted file mode 100644 index f218433be0..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/printk.c b/c/src/exec/libcsupport/src/printk.c deleted file mode 100644 index 3542fd465a..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/privateenv.c b/c/src/exec/libcsupport/src/privateenv.c deleted file mode 100644 index 93dff453c5..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/read.c b/c/src/exec/libcsupport/src/read.c deleted file mode 100644 index 421f967caf..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/readdir.c b/c/src/exec/libcsupport/src/readdir.c deleted file mode 100644 index 8b54a9401b..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/readlink.c b/c/src/exec/libcsupport/src/readlink.c deleted file mode 100644 index 2e2d897709..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/rewinddir.c b/c/src/exec/libcsupport/src/rewinddir.c deleted file mode 100644 index 462fc41f2a..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/rmdir.c b/c/src/exec/libcsupport/src/rmdir.c deleted file mode 100644 index b306894d06..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/scandir.c b/c/src/exec/libcsupport/src/scandir.c deleted file mode 100644 index e8ef3212d5..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/seekdir.c b/c/src/exec/libcsupport/src/seekdir.c deleted file mode 100644 index a6836c36c6..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/stat.c b/c/src/exec/libcsupport/src/stat.c deleted file mode 100644 index e4e4f0be3b..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/symlink.c b/c/src/exec/libcsupport/src/symlink.c deleted file mode 100644 index 8d5bb30bd5..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/tcdrain.c b/c/src/exec/libcsupport/src/tcdrain.c deleted file mode 100644 index 3af93d8c18..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/tcflow.c b/c/src/exec/libcsupport/src/tcflow.c deleted file mode 100644 index ac1fec10c5..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/tcflush.c b/c/src/exec/libcsupport/src/tcflush.c deleted file mode 100644 index 0bfac64235..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/tcgetattr.c b/c/src/exec/libcsupport/src/tcgetattr.c deleted file mode 100644 index cd5b0a5a79..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/tcgetprgrp.c b/c/src/exec/libcsupport/src/tcgetprgrp.c deleted file mode 100644 index 36413f3fe2..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/tcsendbreak.c b/c/src/exec/libcsupport/src/tcsendbreak.c deleted file mode 100644 index d7b3e68764..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/tcsetattr.c b/c/src/exec/libcsupport/src/tcsetattr.c deleted file mode 100644 index f7a413c956..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/tcsetpgrp.c b/c/src/exec/libcsupport/src/tcsetpgrp.c deleted file mode 100644 index 25d1d0403b..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/telldir.c b/c/src/exec/libcsupport/src/telldir.c deleted file mode 100644 index 81c9606ebf..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/termios.c b/c/src/exec/libcsupport/src/termios.c deleted file mode 100644 index 25b8f00c9a..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/termiosinitialize.c b/c/src/exec/libcsupport/src/termiosinitialize.c deleted file mode 100644 index 96194435c6..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/termiosreserveresources.c b/c/src/exec/libcsupport/src/termiosreserveresources.c deleted file mode 100644 index 86bacc3d53..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/truncate.c b/c/src/exec/libcsupport/src/truncate.c deleted file mode 100644 index d4f6f1613f..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/ttyname.c b/c/src/exec/libcsupport/src/ttyname.c deleted file mode 100644 index 08d53b2c24..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/ttyname_r.c b/c/src/exec/libcsupport/src/ttyname_r.c deleted file mode 100644 index 6cf4800dcb..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/umask.c b/c/src/exec/libcsupport/src/umask.c deleted file mode 100644 index fa683936ef..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/unixlibc.c b/c/src/exec/libcsupport/src/unixlibc.c deleted file mode 100644 index f0232ce5db..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/unlink.c b/c/src/exec/libcsupport/src/unlink.c deleted file mode 100644 index 09a68c9247..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/unmount.c b/c/src/exec/libcsupport/src/unmount.c deleted file mode 100644 index 9c2653378b..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/utime.c b/c/src/exec/libcsupport/src/utime.c deleted file mode 100644 index f176615231..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/utsname.c b/c/src/exec/libcsupport/src/utsname.c deleted file mode 100644 index fe3fecac9f..0000000000 --- a/c/src/exec/libcsupport/src/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/exec/libcsupport/src/write.c b/c/src/exec/libcsupport/src/write.c deleted file mode 100644 index 697c4c59ec..0000000000 --- a/c/src/exec/libcsupport/src/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 diff --git a/c/src/exec/libfs/.cvsignore b/c/src/exec/libfs/.cvsignore deleted file mode 100644 index ea6e093b99..0000000000 --- a/c/src/exec/libfs/.cvsignore +++ /dev/null @@ -1,16 +0,0 @@ -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -config.cache -config.guess -config.log -config.status -config.sub -configure -depcomp -install-sh -missing -mkinstalldirs -config.h* -stamp-h* diff --git a/c/src/exec/libfs/ChangeLog b/c/src/exec/libfs/ChangeLog deleted file mode 100644 index 58bb3a4ffe..0000000000 --- a/c/src/exec/libfs/ChangeLog +++ /dev/null @@ -1,359 +0,0 @@ -2002-07-05 Ralf Corsepius - - * configure.ac: RTEMS_TOP(../..). - -2002-07-01 Ralf Corsepius - - * configure.ac: Remove RTEMS_PROJECT_ROOT. - -2002-06-27 Ralf Corsepius - - * configure.ac: Use AC_CONFIG_AUX_DIR(../..). - Add AC_PROG_RANLIB. - -2002-06-26 Ralf Corsepius - - * wrapup/Makefile.am: Don't preinstall libfs.a. - -2002-06-17 Ralf Corsepius - - * src/dosfs/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * src/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * src/imfs/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * Makefile.am: Include $(top_srcdir)/../automake/*.am. - Use ../aclocal. - * wrapup/Makefile.am: Include $(top_srcdir)/../automake/*.am. - -2002-05-18 Ralf Corsepius - - Move from c/src/libfs to c/src/exec/libfs - * configure.ac: Reflect move. - * Makefile.am: Ditto. - * src/Makefile.am: Ditto. - * src/dosfs/Makefile.am: Ditto. - * src/imfs/Makefile.am: Ditto. - * wrapup/Makefile.am: Ditto. - -2002-04-06 Ralf Corsepius - - * src/imfs/imfs_getchild.c: include . - * src/imfs/imfs_gtkn.c: Include . - * src/imfs/ioman.c: Include . - * src/imfs/linearfile.c: Include . - * src/imfs/memfile.c: Include . - -2001-04-04 Joel Sherrill - - * src/dosfs/Makefile.am: Per PR129 do not install as many files - to the $(includedir). - -2002-04-04 Ralf Corsepius - - * src/dosfs/fat.h: Include . - Remove DBG1 and DBG2 (unused). - -2002-04-04 Ralf Corsepius - - * Per PR169. - * src/dosfs/config.h.in, src/dosfs/stamp-h2.in: Removed from CVS. - - -2002-03-27 Ralf Corsepius - - * src/dosfs/fat_file.c: Remove bsp.h. - fat_file_write(.. const char*buf ..). - * src/dosfs/fat_file.h: fat_file_write(.. const char*buf ..). - -2002-03-27 Ralf Corsepius - - * configure.ac: - AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS). - AM_INIT_AUTOMAKE([no-define foreign 1.6]). - * src/dosfs/Makefile.am: Remove AUTOMAKE_OPTIONS. - * src/Makefile.am: Remove AUTOMAKE_OPTIONS. - * src/imfs/Makefile.am: Remove AUTOMAKE_OPTIONS. - * Makefile.am: Remove AUTOMAKE_OPTIONS. - * wrapup/Makefile.am: Remove AUTOMAKE_OPTIONS. - -2002-03-16 Ralf Corsepius - - Addressing PR 140. - * src/dosfs/config.h.in: Removed. - * src/dosfs/stamp-h2.in: Removed. - * .cvsignore: Add config.h*, stamp-h*. - * configure.ac: Remove AC_SRC_DIR(.../dosfs.h). - Remove AM_CONFIG_HEADER(src/dosfs/config.h). - Remove AM_CONFIG_HEADER(src/imfs/config.h). - Add AM_CONFIG_HEADER(config.h). - * src/dosfs/Makefile.am: INCLUDES = -I../.. . - * src/imfs/Makefile.am: INCLUDES = -I../.. . - -2002-03-14 Ralf Corsepius - - Reported and tracked as PR130. - * src/dosfs/Makefile.am: Reworked, Disable dosfs for UNIX. - * wrapup/Makefile.am: Disable dosfs for UNIX. - -2001-03-01 Joel Sherrill - - * src/imfs/.cvsignore: Added stamp-h1.in - -2002-02-28 Victor V. Vengerov - - * DOS filesystem including FAT12, FAT16, and FAT32 support submitted. - * src/dosfs, src/dosfs/Makefile.am, src/dosfs/stamp-h2.in, - src/dosfs/config.h.in, src/dosfs/dosfs.h, src/dosfs/fat.c, - src/dosfs/fat.h, src/dosfs/fat_fat_operations.c, - src/dosfs/fat_fat_operations.h, src/dosfs/fat_file.c, - src/dosfs/fat_file.h, src/dosfs/msdos.h, src/dosfs/msdos_create.c, - src/dosfs/msdos_dir.c, src/dosfs/msdos_eval.c, src/dosfs/msdos_file.c, - src/dosfs/msdos_free.c, src/dosfs/msdos_fsunmount.c, - src/dosfs/msdos_handlers_dir.c, src/dosfs/msdos_handlers_file.c, - src/dosfs/msdos_init.c, src/dosfs/msdos_initsupp.c, - src/dosfs/msdos_misc.c, src/dosfs/msdos_mknod.c, - src/dosfs/msdos_node_type.c, src/dosfs/.cvsignore: New files. - * configure.ac, src/Makefile.am, wrapup/Makefile.am: Modified to - reflect addition. - -2002-01-07 Ralf Corsepius - - * src/imfs/imfs_load_tar.c: Add include . - Add include . Add include . - * src/imfs/imfs_rmnod.c: Add include . - -2002-01-04 Ralf Corsepius - - * src/imfs/imfs_eval.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/memfile.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_readlink.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_unlink.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_link.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_chown.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/ioman.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_mount.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_directory.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_stat.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_fchmod.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_symlink.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_mknod.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/linearfile.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs_unmount.c: Include . - Apply rtems_set_errno_and_return_minus_one. - * src/imfs/imfs.h: Apply rtems_set_errno_and_return_minus_one. - Comment out increment_and_check_linkcounts. - -2001-11-27 Ralf Corsepius - - * wrapup/Makefile.am: Remove HAS_IMFS. - -2001-11-26 Ralf Corsepius - - * src/imfs/Makefile.am: Cleanup. - -2001-11-07 Jennifer Averett - - Reported by Ibragimov Ilya and tracked as PR49. - * src/imfs/imfs_directory.c: Do not calculate the offset twice. - -2001-10-26 Victor V. Vengerov - - * src/imfs/imfs_load_tar.c: Minor modification so this will - compile with gcc-2.95.3 with the arguments "-m5200 -O4". - -2001-10-16 Chris Johns - - * imfs/imfs_load_tar.c: Changed the code around to remove an - internal compiler error on the Coldfire target. - -2001-10-11 Ralf Corsepius - - * .cvsignore: Add autom4te.cache for autoconf > 2.52. - * configure.in: Remove. - * configure.ac: New file, generated from configure.in by autoupdate. - -2001-10-10 Joel Sherrill - - * src/imfs/imfs_getchild.c: Correct length of static string - as reported by Ibragimov Ilya . - -2001-09-28 Ralf Corsepius - - * src/imfs/Makefile.am: Use 'PREINSTALL_FILES ='. - -2001-09-22 Ralf Corsepius - - * src/imfs/Makefile.am: Revamp INCLUDES handling to make automake-1.5 - happy. - -2001-08-09 Fernando-Ruiz Casas - - * src/imfs/imfs_eval.c: The CD_UP problem in imfs_eval has been - touched. The order of the questions is the key. - -2001-07-06 Thomas Doerfler - - * src/imfs/deviceio.c: Make sure errno gets set to reflect - the status from the driver. - -2001-05-25 Joel Sherrill - - * src/imfs/imfs_initsupp.c: Create the root node with the - desired permissions. Nodes should be created with the right - permissions because chmod() is not supported by the miniIMFS - so changing after creation is not possible. - -2001-04-27 Ralf Corsepius - - * configure.in: Add [-ansi -fasm] to RTEMS_PROG_CC_FOR_TARGET. - -2001-04-24 Joel Sherrill - - * src/imfs/memfile.c (memfile_open): Did not set iop->size - and thus the value was incorrect. Before this field was cleared, - this resulted in the value from the last time that IOP was used - being still in place. Discovered by Andrew Bythell - . - -2001-04-20 Joel Sherrill - - * src/imfs/imfs_debug.c (IMFS_print_jnode): Modified to print - only information that does not vary based on target or memory - configuration. The old prints are still there in case they - are needed in the future to debug. Printing target dependent - addresses makes the test output vary by target unnecessarily. - -2001-03-23 Joel Sherrill - - * src/imfs/memfile.c: Reapply fix from bug report from - Jose Sturniolo where NULL pointer - was dereferenced when freeing a triply indirect file. - The fix was applied to the 4.5 release branch and not - the development branch. - -2001-02-03 Ralf Corsepius - - * src/imfs/Makefile.am: Apply include_*HEADERS instead of H_FILES. - -2001-01-16 Ralf Corsepius - - * configure.in: Add src/imfs/config.h - * src/imfs/Makefile.am: Add INCLUDES += -I. to pickup config.h - * src/imfs/.cvsignore: Add config.h and stamp-h - * src/imfs/*.c: Add config.h support. - -2001-01-12 Jake Janovetz - - * src/imfs/imfs.h, src/imfs/imfs_creat.c, src/imfs/imfs_debug.c, - src/imfs/imfs_eval.c, src/imfs/imfs_fchmod.c, - src/imfs/imfs_handlers_memfile.c, src/imfs/imfs_init.c, - src/imfs/imfs_initsupp.c, src/imfs/imfs_stat.c, src/imfs/memfile.c, - src/imfs/miniimfs_init.c: Final developmental update to "tarfs". - When rtems_tarfs_load() is called, it checks the permissions - on each file. If there is write permission, it just creates a - standard file using "creat()" and therefore, uses the IMFS MEMORY_FILE. - If there is no write permission, it creates a LINEAR_FILE node - with the appropriate properties. If the permission is ever changed - to writeable, IMFS_fchmod converts it to a regular memory file. - -2000-12-12 Jake Janovetz - - * src/imfs/linearfile.c, src/imfs/imfs_load_tar.c: New files. - * src/imfs/Makefile.am, src/imfs/imfs.h, - src/imfs/imfs_creat.c, src/imfs/imfs_debug.c, - src/imfs/imfs_eval.c, src/imfs/imfs_handlers_memfile.c, - src/imfs/imfs_init.c, src/imfs/imfs_initsupp.c, - src/imfs/imfs_stat.c, src/imfs/miniimfs_init.c: Added "tarfs". - This is not really a tar filesystem. It is a way to load a tar - image into the IMFS but actually leave bulky file contents in the - original tar image. It essentially adds the linear file type and - associated support and a loader routine. - -2000-11-28 Joel Sherrill - - * src/imfs/memfile.c: Bug report from Sturniolo Jose - where NULL pointer was dereferenced. - -2000-11-17 Jennifer Averret - - * src/imfs/imfs_eval.c: Always return imaginary node at mount points. - -2000-11-09 Ralf Corsepius - - * Makefile.am: Use ... instead of RTEMS_TOPdir in ACLOCAL_AMFLAGS. - -2000-11-02 Ralf Corsepius - - * Makefile.am: Switch to ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal. - -2000-11-01 Joel Sherrill - - * src/imfs/Makefile.am, src/imfs/deviceio.c, src/imfs/imfs_chown.c, - src/imfs/imfs_config.c, src/imfs/imfs_creat.c, src/imfs/imfs_debug.c, - src/imfs/imfs_directory.c, src/imfs/imfs_eval.c, src/imfs/imfs_fchmod.c, - src/imfs/imfs_free.c, src/imfs/imfs_fsunmount.c, src/imfs/imfs_gtkn.c, - src/imfs/imfs_init.c, src/imfs/imfs_initsupp.c, src/imfs/imfs_link.c, - src/imfs/imfs_mknod.c, src/imfs/imfs_mount.c, src/imfs/imfs_readlink.c, - src/imfs/imfs_rmnod.c, src/imfs/imfs_stat.c, src/imfs/imfs_symlink.c, - src/imfs/imfs_unixstub.c, src/imfs/imfs_unlink.c, - src/imfs/imfs_unmount.c, src/imfs/imfs_utime.c, src/imfs/ioman.c, - src/imfs/memfile.c, src/imfs/miniimfs_init.c: - assoc.h, error.h, libio_.h, libio.h, and libcsupport.h moved - from libc to lib/include/rtems and now must be referenced as - . Now we do not have to reach up and over to - libc to pick them up. - -2000-10-24 Joel Sherrill - - * src/imfs/imfs_config.c: New file containing IMFS configuration - information split from libc/base_fs.c. - * src/imfs/ioman.c: New file. Moved from lib/libc. Missed previously. - * src/imfs/Makefile.am: Added imfs_config.c and ioman.c. - -2000-10-24 Ralf Corsepius - - * Makefile.am, configure.in: Introduce GNU canonicalization to libfs/. - The approach is currently a bit of a hack as GNU canonicalization - does not support the per-BSP build some of the other directories - require. As more of the tree is converted, this will become less - of an issue. - -2000-10-19 Joel Sherrill - - * .cvsignore, src/.cvsignore, src/imfs/.cvsignore, wrapup/.cvsignore: - New files. - -2000-10-18 Chris Johns - - * libfs created. - * src, src/imfs, wrapup: New directories. - * ChangeLog, Makefile.am, README, configure.in, src/Makefile.am, - wrapup/Makefile.am: New files. - * src/imfs/deviceio.c, src/imfs/imfs_getchild.c, - src/imfs/imfs_readlink.c, src/imfs/imfs.h, src/imfs/imfs_gtkn.c, - src/imfs/imfs_rmnod.c, src/imfs/imfs_chown.c, - src/imfs/imfs_handlers_device.c, src/imfs/imfs_stat.c, - src/imfs/imfs_creat.c, src/imfs/imfs_handlers_directory.c, - src/imfs/imfs_symlink.c, src/imfs/imfs_debug.c, - src/imfs/imfs_handlers_link.c, src/imfs/imfs_unixstub.c, - src/imfs/imfs_directory.c, src/imfs/imfs_handlers_memfile.c, - src/imfs/imfs_unlink.c, src/imfs/imfs_eval.c, src/imfs/imfs_init.c, - src/imfs/imfs_unmount.c, src/imfs/imfs_fchmod.c, - src/imfs/imfs_initsupp.c, src/imfs/imfs_utime.c, src/imfs/imfs_fcntl.c, - src/imfs/imfs_link.c, src/imfs/memfile.c, src/imfs/imfs_fdatasync.c, - src/imfs/imfs_mknod.c, src/imfs/miniimfs_init.c, src/imfs/imfs_free.c, - src/imfs/imfs_mount.c, src/imfs/imfs_fsunmount.c, src/imfs/imfs_ntype.c: - New files. Moved from libc. diff --git a/c/src/exec/libfs/Makefile.am b/c/src/exec/libfs/Makefile.am deleted file mode 100644 index b1682363c5..0000000000 --- a/c/src/exec/libfs/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -## -## $Id$ -## - -ACLOCAL_AMFLAGS = -I ../aclocal - -SUBDIRS = src wrapup - -EXTRA_DIST = README - -include $(top_srcdir)/../automake/subdirs.am -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libfs/README b/c/src/exec/libfs/README deleted file mode 100644 index 7409b93dca..0000000000 --- a/c/src/exec/libfs/README +++ /dev/null @@ -1,13 +0,0 @@ -# -# $Id$ -# - -This directory contains for the "file system" library. All supported -file systems live under this tree. - -Currently the only supported file systems in this library are the IMFS -and miniIMFS. The TFTP client filesystem is part of the libnetworking -library. - ---Chris Johns and Joel Sherrill -18 October 2000 diff --git a/c/src/exec/libfs/configure.ac b/c/src/exec/libfs/configure.ac deleted file mode 100644 index c22962778a..0000000000 --- a/c/src/exec/libfs/configure.ac +++ /dev/null @@ -1,36 +0,0 @@ -## Process this file with autoconf to produce a configure script. -## -## $Id$ - -AC_PREREQ(2.52) -AC_INIT([rtems-c-src-libfs],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com]) -AC_CONFIG_SRCDIR([src/imfs/imfs.h]) - -RTEMS_TOP(../..) -AC_CONFIG_AUX_DIR(../..) - -RTEMS_CANONICAL_TARGET_CPU - -AM_INIT_AUTOMAKE([no-define foreign 1.6]) -AM_MAINTAINER_MODE - -RTEMS_ENV_RTEMSCPU - -RTEMS_CHECK_CPU -RTEMS_CANONICAL_HOST - -RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) -RTEMS_CANONICALIZE_TOOLS -AC_PROG_RANLIB - -AM_CONDITIONAL(UNIX,test x"$RTEMS_CPU" = x"unix") -AM_CONFIG_HEADER(config.h) - -# Explicitly list all Makefiles here -AC_CONFIG_FILES([Makefile -src/Makefile -src/imfs/Makefile -src/dosfs/Makefile -wrapup/Makefile -]) -AC_OUTPUT diff --git a/c/src/exec/libfs/src/.cvsignore b/c/src/exec/libfs/src/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libfs/src/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libfs/src/Makefile.am b/c/src/exec/libfs/src/Makefile.am deleted file mode 100644 index dff205eaaa..0000000000 --- a/c/src/exec/libfs/src/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -## -## $Id$ -## - - -SUBDIRS = imfs dosfs - -include $(top_srcdir)/../automake/subdirs.am -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libfs/src/dosfs/.cvsignore b/c/src/exec/libfs/src/dosfs/.cvsignore deleted file mode 100644 index 7bb609bf24..0000000000 --- a/c/src/exec/libfs/src/dosfs/.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/exec/libfs/src/dosfs/Makefile.am b/c/src/exec/libfs/src/dosfs/Makefile.am deleted file mode 100644 index 9bb265386a..0000000000 --- a/c/src/exec/libfs/src/dosfs/Makefile.am +++ /dev/null @@ -1,55 +0,0 @@ -## -## $Id$ -## - - -include $(top_srcdir)/../automake/multilib.am -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/lib.am - -INCLUDES = -I../.. - -AM_CFLAGS += $(LIBC_DEFINES) - -FATFS_C_FILES = fat.c fat_fat_operations.c fat_file.c - -DOSFS_C_FILES = msdos_create.c msdos_dir.c msdos_eval.c msdos_file.c \ - msdos_free.c msdos_fsunmount.c msdos_handlers_dir.c \ - msdos_handlers_file.c msdos_init.c msdos_initsupp.c \ - msdos_misc.c msdos_mknod.c msdos_node_type.c - -if !UNIX -LIBNAME = libdosfs -LIB = ${ARCH}/${LIBNAME}.a - -C_FILES = $(FATFS_C_FILES) $(DOSFS_C_FILES) - -C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) - -include_HEADERS = dosfs.h - -H_FILES = $(PROJECT_INCLUDE) \ - $(include_HEADERS:%=$(PROJECT_INCLUDE)/%) - -$(PROJECT_INCLUDE): - @$(mkinstalldirs) $@ - -$(PROJECT_INCLUDE)/%.h: %.h - $(INSTALL_DATA) $< $@ - -OBJS = $(C_O_FILES) - -# -# Add local stuff here using += -# -all-local: ${ARCH} $(LIB) - -$(LIB): ${OBJS} - $(make-library) -endif - -TMPINSTALL_FILES += $(H_FILES) - -EXTRA_DIST = $(DOSFS_C_FILES) $(FATFS_C_FILES) - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libfs/src/dosfs/dosfs.h b/c/src/exec/libfs/src/dosfs/dosfs.h deleted file mode 100644 index 4cea929d4c..0000000000 --- a/c/src/exec/libfs/src/dosfs/dosfs.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * dosfs.h - * - * Application interface to MSDOS filesystem. - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 __DOSFS_DOSFS_H__ -#define __DOSFS_DOSFS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern rtems_filesystem_operations_table msdos_ops; - -#ifdef __cplusplus -} -#endif - -#endif /* __DOSFS_DOSFS_H__ */ diff --git a/c/src/exec/libfs/src/dosfs/fat.c b/c/src/exec/libfs/src/dosfs/fat.c deleted file mode 100644 index 852c104781..0000000000 --- a/c/src/exec/libfs/src/dosfs/fat.c +++ /dev/null @@ -1,695 +0,0 @@ -/* - * fat.c - * - * Low-level operations on a volume with FAT filesystem - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * @(#) $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "fat.h" - -/* _fat_block_read -- - * This function reads 'count' bytes from device filesystem is mounted on, - * starts at 'start+offset' position where 'start' computed in sectors - * and 'offset' is offset inside sector (reading may cross sectors - * boundary; in this case assumed we want to read sequential sector(s)) - * - * PARAMETERS: - * mt_entry - mount table entry - * start - sector num to start read from - * offset - offset inside sector 'start' - * count - count of bytes to read - * buff - buffer provided by user - * - * RETURNS: - * bytes read on success, or -1 if error occured - * and errno set appropriately - */ -ssize_t -_fat_block_read( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 start, - unsigned32 offset, - unsigned32 count, - void *buff - ) -{ - int rc = RC_OK; - register fat_fs_info_t *fs_info = mt_entry->fs_info; - ssize_t cmpltd = 0; - unsigned32 blk = start; - unsigned32 ofs = offset; - bdbuf_buffer *block = NULL; - unsigned32 c = 0; - - while (count > 0) - { - rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_READ, &block); - if (rc != RC_OK) - return rc; - - c = MIN(count, (fs_info->vol.bps - ofs)); - memcpy((buff + cmpltd), (block->buffer + ofs), c); - - count -= c; - cmpltd += c; - blk++; - ofs = 0; - } - return cmpltd; -} - -/* _fat_block_write -- - * This function write 'count' bytes to device filesystem is mounted on, - * starts at 'start+offset' position where 'start' computed in sectors - * and 'offset' is offset inside sector (writing may cross sectors - * boundary; in this case assumed we want to write sequential sector(s)) - * - * PARAMETERS: - * mt_entry - mount table entry - * start - sector num to start read from - * offset - offset inside sector 'start' - * count - count of bytes to write - * buff - buffer provided by user - * - * RETURNS: - * bytes written on success, or -1 if error occured - * and errno set appropriately - */ -ssize_t -_fat_block_write( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 start, - unsigned32 offset, - unsigned32 count, - const void *buff) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - ssize_t cmpltd = 0; - unsigned32 blk = start; - unsigned32 ofs = offset; - bdbuf_buffer *block = NULL; - unsigned32 c = 0; - - while(count > 0) - { - c = MIN(count, (fs_info->vol.bps - ofs)); - - if (c == fs_info->vol.bps) - rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_GET, &block); - else - rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_READ, &block); - if (rc != RC_OK) - return rc; - - memcpy((block->buffer + ofs), (buff + cmpltd), c); - - fat_buf_mark_modified(fs_info); - - count -= c; - cmpltd +=c; - blk++; - ofs = 0; - } - return cmpltd; -} - - - - -/* fat_cluster_read -- - * wrapper for reading a whole cluster at once - * - * PARAMETERS: - * mt_entry - mount table entry - * cln - number of cluster to read - * buff - buffer provided by user - * - * RETURNS: - * bytes read on success, or -1 if error occured - * and errno set appropriately - */ -ssize_t -fat_cluster_read( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - void *buff - ) -{ - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 fsec = 0; - - fsec = fat_cluster_num_to_sector_num(mt_entry, cln); - - return _fat_block_read(mt_entry, fsec, 0, - fs_info->vol.spc << fs_info->vol.sec_log2, buff); -} - -/* fat_cluster_write -- - * wrapper for writting a whole cluster at once - * - * PARAMETERS: - * mt_entry - mount table entry - * cln - number of cluster to write - * buff - buffer provided by user - * - * RETURNS: - * bytes written on success, or -1 if error occured - * and errno set appropriately - */ -ssize_t -fat_cluster_write( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - const void *buff - ) -{ - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 fsec = 0; - - fsec = fat_cluster_num_to_sector_num(mt_entry, cln); - - return _fat_block_write(mt_entry, fsec, 0, - fs_info->vol.spc << fs_info->vol.sec_log2, buff); -} - -/* fat_init_volume_info -- - * Get inforamtion about volume on which filesystem is mounted on - * - * PARAMETERS: - * mt_entry - mount table entry - * - * RETURNS: - * RC_OK on success, or -1 if error occured - * and errno set appropriately - */ -int -fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - register fat_vol_t *vol = &fs_info->vol; - unsigned32 data_secs = 0; - char boot_rec[FAT_MAX_BPB_SIZE]; - char fs_info_sector[FAT_USEFUL_INFO_SIZE]; - ssize_t ret = 0; - int fd; - struct stat stat_buf; - int i = 0; - - rc = stat(mt_entry->dev, &stat_buf); - if (rc == -1) - return rc; - - /* rtmes feature: no block devices, all are character devices */ - if (!S_ISCHR(stat_buf.st_mode)) - set_errno_and_return_minus_one(ENOTBLK); - - /* check that device is registred as block device and lock it */ - vol->dd = rtems_disk_lookup(stat_buf.st_dev); - if (vol->dd == NULL) - set_errno_and_return_minus_one(ENOTBLK); - - vol->dev = stat_buf.st_dev; - - fd = open(mt_entry->dev, O_RDONLY); - if (fd == -1) - { - rtems_disk_release(vol->dd); - return -1; - } - - ret = read(fd, (void *)boot_rec, FAT_MAX_BPB_SIZE); - if ( ret != FAT_MAX_BPB_SIZE ) - { - close(fd); - rtems_disk_release(vol->dd); - set_errno_and_return_minus_one( EIO ); - } - close(fd); - - vol->bps = FAT_BR_BYTES_PER_SECTOR(boot_rec); - - if ( (vol->bps != 512) && - (vol->bps != 1024) && - (vol->bps != 2048) && - (vol->bps != 4096)) - { - rtems_disk_release(vol->dd); - set_errno_and_return_minus_one( EINVAL ); - } - - for (vol->sec_mul = 0, i = (vol->bps >> FAT_SECTOR512_BITS); (i & 1) == 0; - i >>= 1, vol->sec_mul++); - for (vol->sec_log2 = 0, i = vol->bps; (i & 1) == 0; - i >>= 1, vol->sec_log2++); - - vol->spc = FAT_BR_SECTORS_PER_CLUSTER(boot_rec); - for (vol->spc_log2 = 0, i = vol->spc; (i & 1) == 0; - i >>= 1, vol->spc_log2++); - - /* - * According to M$ White Paper "bytes per cluster" value - * greater than 32K is invalid - */ - if ((vol->bpc = vol->bps << vol->spc_log2) > MS_BYTES_PER_CLUSTER_LIMIT) - { - rtems_disk_release(vol->dd); - set_errno_and_return_minus_one(EINVAL); - } - - for (vol->bpc_log2 = 0, i = vol->bpc; (i & 1) == 0; - i >>= 1, vol->bpc_log2++); - - vol->fats = FAT_BR_FAT_NUM(boot_rec); - vol->fat_loc = FAT_BR_RESERVED_SECTORS_NUM(boot_rec); - - vol->rdir_entrs = FAT_BR_FILES_PER_ROOT_DIR(boot_rec); - - /* calculate the count of sectors occupied by the root directory */ - vol->rdir_secs = ((vol->rdir_entrs * FAT_DIRENTRY_SIZE) + (vol->bps - 1)) / - vol->bps; - - vol->rdir_size = vol->rdir_secs << vol->sec_log2; - - if ( (FAT_BR_SECTORS_PER_FAT(boot_rec)) != 0) - vol->fat_length = FAT_BR_SECTORS_PER_FAT(boot_rec); - else - vol->fat_length = FAT_BR_SECTORS_PER_FAT32(boot_rec); - - vol->data_fsec = vol->fat_loc + vol->fats * vol->fat_length + - vol->rdir_secs; - - /* for FAT12/16 root dir starts at(sector) */ - vol->rdir_loc = vol->fat_loc + vol->fats * vol->fat_length; - - if ( (FAT_BR_TOTAL_SECTORS_NUM16(boot_rec)) != 0) - vol->tot_secs = FAT_BR_TOTAL_SECTORS_NUM16(boot_rec); - else - vol->tot_secs = FAT_BR_TOTAL_SECTORS_NUM32(boot_rec); - - data_secs = vol->tot_secs - vol->data_fsec; - - vol->data_cls = data_secs / vol->spc; - - /* determine FAT type at least */ - if ( vol->data_cls < FAT_FAT12_MAX_CLN) - { - vol->type = FAT_FAT12; - vol->mask = FAT_FAT12_MASK; - vol->eoc_val = FAT_FAT12_EOC; - } - else - { - if ( vol->data_cls < FAT_FAT16_MAX_CLN) - { - vol->type = FAT_FAT16; - vol->mask = FAT_FAT16_MASK; - vol->eoc_val = FAT_FAT16_EOC; - } - else - { - vol->type = FAT_FAT32; - vol->mask = FAT_FAT32_MASK; - vol->eoc_val = FAT_FAT32_EOC; - } - } - - if (vol->type == FAT_FAT32) - { - vol->rdir_cl = FAT_BR_FAT32_ROOT_CLUSTER(boot_rec); - - vol->mirror = FAT_BR_EXT_FLAGS(boot_rec) & FAT_BR_EXT_FLAGS_MIRROR; - if (vol->mirror) - vol->afat = FAT_BR_EXT_FLAGS(boot_rec) & FAT_BR_EXT_FLAGS_FAT_NUM; - else - vol->afat = 0; - - vol->info_sec = FAT_BR_FAT32_FS_INFO_SECTOR(boot_rec); - if( vol->info_sec == 0 ) - { - rtems_disk_release(vol->dd); - set_errno_and_return_minus_one( EINVAL ); - } - else - { - ret = _fat_block_read(mt_entry, vol->info_sec , 0, - FAT_FSI_LEADSIG_SIZE, fs_info_sector); - if ( ret < 0 ) - { - rtems_disk_release(vol->dd); - return -1; - } - - if (FAT_FSINFO_LEAD_SIGNATURE(fs_info_sector) != - FAT_FSINFO_LEAD_SIGNATURE_VALUE) - { - rtems_disk_release(vol->dd); - set_errno_and_return_minus_one( EINVAL ); - } - else - { - ret = _fat_block_read(mt_entry, vol->info_sec , FAT_FSI_INFO, - FAT_USEFUL_INFO_SIZE, fs_info_sector); - if ( ret < 0 ) - { - rtems_disk_release(vol->dd); - return -1; - } - - vol->free_cls = FAT_FSINFO_FREE_CLUSTER_COUNT(fs_info_sector); - vol->next_cl = FAT_FSINFO_NEXT_FREE_CLUSTER(fs_info_sector); - rc = fat_fat32_update_fsinfo_sector(mt_entry, 0xFFFFFFFF, - 0xFFFFFFFF); - if ( rc != RC_OK ) - { - rtems_disk_release(vol->dd); - return rc; - } - } - } - } - else - { - vol->rdir_cl = 0; - vol->mirror = 0; - vol->afat = 0; - vol->free_cls = 0xFFFFFFFF; - vol->next_cl = 0xFFFFFFFF; - } - vol->afat_loc = vol->fat_loc + vol->fat_length * vol->afat; - - /* set up collection of fat-files fd */ - fs_info->vhash = calloc(FAT_HASH_SIZE, sizeof(Chain_Control)); - if ( fs_info->vhash == NULL ) - { - rtems_disk_release(vol->dd); - set_errno_and_return_minus_one( ENOMEM ); - } - - for (i = 0; i < FAT_HASH_SIZE; i++) - _Chain_Initialize_empty(fs_info->vhash + i); - - fs_info->rhash = calloc(FAT_HASH_SIZE, sizeof(Chain_Control)); - if ( fs_info->rhash == NULL ) - { - rtems_disk_release(vol->dd); - free(fs_info->vhash); - set_errno_and_return_minus_one( ENOMEM ); - } - for (i = 0; i < FAT_HASH_SIZE; i++) - _Chain_Initialize_empty(fs_info->rhash + i); - - fs_info->uino_pool_size = FAT_UINO_POOL_INIT_SIZE; - fs_info->uino_base = (vol->tot_secs << vol->sec_mul) << 4; - fs_info->index = 0; - fs_info->uino = (char *)calloc(fs_info->uino_pool_size, sizeof(char)); - if ( fs_info->uino == NULL ) - { - rtems_disk_release(vol->dd); - free(fs_info->vhash); - free(fs_info->rhash); - set_errno_and_return_minus_one( ENOMEM ); - } - fs_info->sec_buf = (char *)calloc(vol->bps, sizeof(char)); - if (fs_info->sec_buf == NULL) - { - rtems_disk_release(vol->dd); - free(fs_info->vhash); - free(fs_info->rhash); - free(fs_info->uino); - set_errno_and_return_minus_one( ENOMEM ); - } - - return RC_OK; -} - -/* fat_shutdown_drive -- - * Free all allocated resources and synchronize all necessary data - * - * PARAMETERS: - * mt_entry - mount table entry - * - * RETURNS: - * RC_OK on success, or -1 if error occured - * and errno set appropriately - */ -int -fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - int i = 0; - - if (fs_info->vol.type & FAT_FAT32) - { - rc = fat_fat32_update_fsinfo_sector(mt_entry, fs_info->vol.free_cls, - fs_info->vol.next_cl); - if ( rc != RC_OK ) - rc = -1; - } - - fat_buf_release(fs_info); - - if (rtems_bdbuf_syncdev(fs_info->vol.dev) != RTEMS_SUCCESSFUL) - rc = -1; - - for (i = 0; i < FAT_HASH_SIZE; i++) - { - Chain_Node *node = NULL; - Chain_Control *the_chain = fs_info->vhash + i; - - while ( (node = _Chain_Get(the_chain)) != NULL ) - free(node); - } - - for (i = 0; i < FAT_HASH_SIZE; i++) - { - Chain_Node *node = NULL; - Chain_Control *the_chain = fs_info->rhash + i; - - while ( (node = _Chain_Get(the_chain)) != NULL ) - free(node); - } - - free(fs_info->vhash); - free(fs_info->rhash); - - free(fs_info->uino); - free(fs_info->sec_buf); - rtems_disk_release(fs_info->vol.dd); - - if (rc) - errno = EIO; - return rc; -} - -/* fat_init_clusters_chain -- - * Zeroing contents of all clusters in the chain - * - * PARAMETERS: - * mt_entry - mount table entry - * start_cluster_num - num of first cluster in the chain - * - * RETURNS: - * RC_OK on success, or -1 if error occured - * and errno set appropriately - */ -int -fat_init_clusters_chain( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 start_cln - ) -{ - int rc = RC_OK; - ssize_t ret = 0; - register fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 cur_cln = start_cln; - char *buf; - - buf = calloc(fs_info->vol.bpc, sizeof(char)); - if ( buf == NULL ) - set_errno_and_return_minus_one( EIO ); - - while ((cur_cln & fs_info->vol.mask) != fs_info->vol.eoc_val) - { - ret = fat_cluster_write(mt_entry, cur_cln, buf); - if ( ret == -1 ) - { - free(buf); - return -1; - } - - rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln); - if ( rc != RC_OK ) - { - free(buf); - return rc; - } - - } - free(buf); - return rc; -} - -#define FAT_UNIQ_INO_BASE 0x0FFFFF00 - -#define FAT_UNIQ_INO_IS_BUSY(index, arr) \ - (((arr)[((index)>>3)]>>((index) & (8-1))) & 0x01) - -#define FAT_SET_UNIQ_INO_BUSY(index, arr) \ - ((arr)[((index)>>3)] |= (0x01<<((index) & (8-1)))) - -#define FAT_SET_UNIQ_INO_FREE(index, arr) \ - ((arr)[((index)>>3)] &= (~(0x01<<((index) & (8-1))))) - -/* fat_get_unique_ino -- - * Allocate unique ino from unique ino pool - * - * PARAMETERS: - * mt_entry - mount table entry - * - * RETURNS: - * unique inode number on success, or 0 if there is no free unique inode - * number in the pool - * - * ATTENTION: - * 0 means FAILED !!! - * - */ -unsigned32 -fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry) -{ - register fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 j = 0; - rtems_boolean resrc_unsuff = FALSE; - - while (!resrc_unsuff) - { - for (j = 0; j < fs_info->uino_pool_size; j++) - { - if (!FAT_UNIQ_INO_IS_BUSY(fs_info->index, fs_info->uino)) - { - FAT_SET_UNIQ_INO_BUSY(fs_info->index, fs_info->uino); - return (fs_info->uino_base + fs_info->index); - } - fs_info->index++; - if (fs_info->index >= fs_info->uino_pool_size) - fs_info->index = 0; - } - - if ((fs_info->uino_pool_size << 1) < (0x0FFFFFFF - fs_info->uino_base)) - { - fs_info->uino_pool_size <<= 1; - fs_info->uino = realloc(fs_info->uino, fs_info->uino_pool_size); - if (fs_info->uino != NULL) - fs_info->index = fs_info->uino_pool_size; - else - resrc_unsuff = TRUE; - } - else - resrc_unsuff = TRUE; - } - return 0; -} - -/* fat_free_unique_ino -- - * Return unique ino to unique ino pool - * - * PARAMETERS: - * mt_entry - mount table entry - * ino - inode number to free - * - * RETURNS: - * None - */ -void -fat_free_unique_ino( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 ino - ) -{ - fat_fs_info_t *fs_info = mt_entry->fs_info; - - FAT_SET_UNIQ_INO_FREE((ino - fs_info->uino_base), fs_info->uino); -} - -/* fat_ino_is_unique -- - * Test whether ino is from unique ino pool - * - * PARAMETERS: - * mt_entry - mount table entry - * ino - ino to be tested - * - * RETURNS: - * TRUE if ino is allocated from unique ino pool, FALSE otherwise - */ -inline rtems_boolean -fat_ino_is_unique( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 ino - ) -{ - fat_fs_info_t *fs_info = mt_entry->fs_info; - - return (ino >= fs_info->uino_base); -} - -/* fat_fat32_update_fsinfo_sector -- - * Synchronize fsinfo sector for FAT32 volumes - * - * PARAMETERS: - * mt_entry - mount table entry - * free_count - count of free clusters - * next_free - the next free cluster num - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -fat_fat32_update_fsinfo_sector( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 free_count, - unsigned32 next_free - ) -{ - ssize_t ret1 = 0, ret2 = 0; - register fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 le_free_count = 0; - unsigned32 le_next_free = 0; - - le_free_count = CT_LE_L(free_count); - le_next_free = CT_LE_L(next_free); - - ret1 = _fat_block_write(mt_entry, - fs_info->vol.info_sec, - FAT_FSINFO_FREE_CLUSTER_COUNT_OFFSET, - 4, - (char *)(&le_free_count)); - - ret2 = _fat_block_write(mt_entry, - fs_info->vol.info_sec, - FAT_FSINFO_NEXT_FREE_CLUSTER_OFFSET, - 4, - (char *)(&le_next_free)); - - if ( (ret1 < 0) || (ret2 < 0) ) - return -1; - - return RC_OK; -} - \ No newline at end of file diff --git a/c/src/exec/libfs/src/dosfs/fat.h b/c/src/exec/libfs/src/dosfs/fat.h deleted file mode 100644 index f0aaf21c98..0000000000 --- a/c/src/exec/libfs/src/dosfs/fat.h +++ /dev/null @@ -1,488 +0,0 @@ -/* - * fat.h - * - * Constants/data structures/prototypes for low-level operations on a volume - * with FAT filesystem - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 __DOSFS_FAT_H__ -#define __DOSFS_FAT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -/* XXX: temporary hack :(( */ -#ifndef set_errno_and_return_minus_one -#define set_errno_and_return_minus_one rtems_set_errno_and_return_minus_one -#endif /* set_errno_and_return_minus_one */ - -#include -#include -#include - -#ifndef RC_OK -#define RC_OK 0x00000000 -#endif - -/* - * Remember that all FAT file system on disk data structure is - * "little endian"! - * (derived from linux) - */ -/* - * Conversion from and to little-endian byte order. (no-op on i386/i486) - * - * Naming: Ca_b_c, where a: F = from, T = to, b: LE = little-endian, - * BE = big-endian, c: W = word (16 bits), L = longword (32 bits) - */ - -#if (CPU_BIG_ENDIAN == TRUE) -# define CF_LE_W(v) CPU_swap_u16(v) -# define CF_LE_L(v) CPU_swap_u32(v) -# define CT_LE_W(v) CPU_swap_u16(v) -# define CT_LE_L(v) CPU_swap_u32(v) -#else -# define CF_LE_W(v) (v) -# define CF_LE_L(v) (v) -# define CT_LE_W(v) (v) -# define CT_LE_L(v) (v) -#endif - -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) - -#define FAT_HASH_SIZE 2 -#define FAT_HASH_MODULE FAT_HASH_SIZE - - -#define FAT_SECTOR512_SIZE 512 /* sector size (bytes) */ -#define FAT_SECTOR512_BITS 9 /* log2(SECTOR_SIZE) */ - -/* maximum + 1 number of clusters for FAT12 */ -#define FAT_FAT12_MAX_CLN 4085 - -/* maximum + 1 number of clusters for FAT16 */ -#define FAT_FAT16_MAX_CLN 65525 - -#define FAT_FAT12 0x01 -#define FAT_FAT16 0x02 -#define FAT_FAT32 0x04 - -#define FAT_UNDEFINED_VALUE 0xFFFFFFFF - -#define FAT_FAT12_EOC 0x0FFF -#define FAT_FAT16_EOC 0xFFFF -#define FAT_FAT32_EOC 0x0FFFFFFF - -#define FAT_FAT12_FREE 0x0000 -#define FAT_FAT16_FREE 0x0000 -#define FAT_FAT32_FREE 0x00000000 - -#define FAT_GENFAT_EOC 0xFFFFFFFF -#define FAT_GENFAT_FREE 0x00000000 - -#define FAT_FAT12_SHIFT 0x04 - -#define FAT_FAT12_MASK 0x00000FFF -#define FAT_FAT16_MASK 0x0000FFFF -#define FAT_FAT32_MASK 0x0FFFFFFF - -#define FAT_MAX_BPB_SIZE 90 - -/* size of useful information in FSInfo sector */ -#define FAT_USEFUL_INFO_SIZE 12 - -#define FAT_VAL8(x, ofs) (unsigned8)(*((unsigned8 *)(x) + (ofs))) - -#define FAT_VAL16(x, ofs) \ - (unsigned16)( (*((unsigned8 *)(x) + (ofs))) | \ - ((*((unsigned8 *)(x) + (ofs) + 1)) << 8) ) - -#define FAT_VAL32(x, ofs) \ - (unsigned32)( (*((unsigned8 *)(x) + (ofs))) | \ - ((*((unsigned8 *)(x) + (ofs) + 1)) << 8) | \ - ((*((unsigned8 *)(x) + (ofs) + 2)) << 16) | \ - ((*((unsigned8 *)(x) + (ofs) + 3)) << 24) ) - -/* macros to access boot sector fields */ -#define FAT_BR_BYTES_PER_SECTOR(x) FAT_VAL16(x, 11) -#define FAT_BR_SECTORS_PER_CLUSTER(x) FAT_VAL8(x, 13) -#define FAT_BR_RESERVED_SECTORS_NUM(x) FAT_VAL16(x, 14) -#define FAT_BR_FAT_NUM(x) FAT_VAL8(x, 16) -#define FAT_BR_FILES_PER_ROOT_DIR(x) FAT_VAL16(x, 17) -#define FAT_BR_TOTAL_SECTORS_NUM16(x) FAT_VAL16(x, 19) -#define FAT_BR_MEDIA(x) FAT_VAL8(x, 21) -#define FAT_BR_SECTORS_PER_FAT(x) FAT_VAL16(x, 22) -#define FAT_BR_TOTAL_SECTORS_NUM32(x) FAT_VAL32(x, 32) -#define FAT_BR_SECTORS_PER_FAT32(x) FAT_VAL32(x, 36) -#define FAT_BR_EXT_FLAGS(x) FAT_VAL16(x, 40) -#define FAT_BR_FAT32_ROOT_CLUSTER(x) FAT_VAL32(x, 44) -#define FAT_BR_FAT32_FS_INFO_SECTOR(x) FAT_VAL16(x, 48) -#define FAT_FSINFO_LEAD_SIGNATURE(x) FAT_VAL32(x, 0) -/* - * I read FSInfo sector from offset 484 to access the information, so offsets - * of these fields a relative - */ -#define FAT_FSINFO_FREE_CLUSTER_COUNT(x) FAT_VAL32(x, 4) -#define FAT_FSINFO_NEXT_FREE_CLUSTER(x) FAT_VAL32(x, 8) - -#define FAT_FSINFO_FREE_CLUSTER_COUNT_OFFSET 488 - -#define FAT_FSINFO_NEXT_FREE_CLUSTER_OFFSET 492 - -#define FAT_RSRVD_CLN 0x02 - -#define FAT_FSINFO_LEAD_SIGNATURE_VALUE 0x41615252 - -#define FAT_FSI_LEADSIG_SIZE 0x04 - -#define FAT_FSI_INFO 484 - -#define MS_BYTES_PER_CLUSTER_LIMIT 0x8000 /* 32K */ - -#define FAT_BR_EXT_FLAGS_MIRROR 0x0080 - -#define FAT_BR_EXT_FLAGS_FAT_NUM 0x000F - - -#define FAT_DIRENTRY_SIZE 32 - -#define FAT_DIRENTRIES_PER_SEC512 16 - -/* - * Volume descriptor - * Description of the volume the FAT filesystem is located on - generally - * the fields of the structure corresponde to Boot Sector and BPB Srtucture - * (see M$ White Paper) fields - */ -typedef struct fat_vol_s -{ - unsigned16 bps; /* bytes per sector */ - unsigned8 sec_log2; /* log2 of bps */ - unsigned8 sec_mul; /* log2 of 512bts sectors number per sector */ - unsigned8 spc; /* sectors per cluster */ - unsigned8 spc_log2; /* log2 of spc */ - unsigned16 bpc; /* bytes per cluster */ - unsigned8 bpc_log2; /* log2 of bytes per cluster */ - unsigned8 fats; /* number of FATs */ - unsigned8 type; /* FAT type */ - unsigned32 mask; - unsigned32 eoc_val; - unsigned16 fat_loc; /* FAT start */ - unsigned32 fat_length; /* sectors per FAT */ - unsigned32 rdir_loc; /* root directory start */ - unsigned16 rdir_entrs; /* files per root directory */ - unsigned32 rdir_secs; /* sectors per root directory */ - unsigned32 rdir_size; /* root directory size in bytes */ - unsigned32 tot_secs; /* total count of sectors */ - unsigned32 data_fsec; /* first data sector */ - unsigned32 data_cls; /* count of data clusters */ - unsigned32 rdir_cl; /* first cluster of the root directory */ - unsigned16 info_sec; /* FSInfo Sector Structure location */ - unsigned32 free_cls; /* last known free clusters count */ - unsigned32 next_cl; /* next free cluster number */ - unsigned8 mirror; /* mirroring enabla/disable */ - unsigned32 afat_loc; /* active FAT location */ - unsigned8 afat; /* the number of active FAT */ - dev_t dev; /* device ID */ - disk_device *dd; /* disk device (see libblock) */ - void *private_data; /* reserved */ -} fat_vol_t; - - -typedef struct fat_cache_s -{ - unsigned32 blk_num; - rtems_boolean modified; - unsigned8 state; - bdbuf_buffer *buf; -} fat_cache_t; - -/* - * This structure identifies the instance of the filesystem on the FAT - * ("fat-file") level. - */ -typedef struct fat_fs_info_s -{ - fat_vol_t vol; /* volume descriptor */ - Chain_Control *vhash; /* "vhash" of fat-file descriptors */ - Chain_Control *rhash; /* "rhash" of fat-file descriptors */ - char *uino; /* array of unique ino numbers */ - unsigned32 index; - unsigned32 uino_pool_size; /* size */ - unsigned32 uino_base; - fat_cache_t c; /* cache */ - unsigned8 *sec_buf; /* just placeholder for anything */ -} fat_fs_info_t; - -/* - * if the name we looking for is file we store not only first data cluster - * number, but and cluster number and offset for directory entry for this - * name - */ -typedef struct fat_auxiliary_s -{ - unsigned32 cln; - unsigned32 ofs; -} fat_auxiliary_t; - -#define FAT_FAT_OFFSET(fat_type, cln) \ - ((fat_type) & FAT_FAT12 ? ((cln) + ((cln) >> 1)) : \ - (fat_type) & FAT_FAT16 ? ((cln) << 1) : \ - ((cln) << 2)) - -#define FAT_CLUSTER_IS_ODD(n) ((n) & 0x0001) - -#define FAT12_SHIFT 0x4 /* half of a byte */ - -/* initial size of array of unique ino */ -#define FAT_UINO_POOL_INIT_SIZE 0x100 - -/* cache support */ -#define FAT_CACHE_EMPTY 0x0 -#define FAT_CACHE_ACTUAL 0x1 - -#define FAT_OP_TYPE_READ 0x1 -#define FAT_OP_TYPE_GET 0x2 - -static inline unsigned32 -fat_cluster_num_to_sector_num( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln - ) -{ - register fat_fs_info_t *fs_info = mt_entry->fs_info; - - if ( (cln == 0) && (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)) ) - return fs_info->vol.rdir_loc; - - return (((cln - FAT_RSRVD_CLN) << fs_info->vol.spc_log2) + - fs_info->vol.data_fsec); -} - -static inline unsigned32 -fat_cluster_num_to_sector512_num( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln - ) -{ - fat_fs_info_t *fs_info = mt_entry->fs_info; - - if (cln == 1) - return 1; - - return (fat_cluster_num_to_sector_num(mt_entry, cln) << - fs_info->vol.sec_mul); -} - -static inline int -fat_buf_access(fat_fs_info_t *fs_info, unsigned32 blk, int op_type, - bdbuf_buffer **buf) -{ - rtems_status_code sc = RTEMS_SUCCESSFUL; - unsigned8 i; - rtems_boolean sec_of_fat; - - - if (fs_info->c.state == FAT_CACHE_EMPTY) - { - if (op_type == FAT_OP_TYPE_READ) - sc = rtems_bdbuf_read(fs_info->vol.dev, blk, &fs_info->c.buf); - else - sc = rtems_bdbuf_get(fs_info->vol.dev, blk, &fs_info->c.buf); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - fs_info->c.blk_num = blk; - fs_info->c.state = FAT_CACHE_ACTUAL; - } - - sec_of_fat = ((fs_info->c.blk_num >= fs_info->vol.fat_loc) && - (fs_info->c.blk_num < fs_info->vol.rdir_loc)); - - if (fs_info->c.blk_num != blk) - { - if (fs_info->c.modified) - { - if (sec_of_fat && !fs_info->vol.mirror) - memcpy(fs_info->sec_buf, fs_info->c.buf->buffer, - fs_info->vol.bps); - - sc = rtems_bdbuf_release_modified(fs_info->c.buf); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - fs_info->c.modified = 0; - - if (sec_of_fat && !fs_info->vol.mirror) - { - bdbuf_buffer *b; - - for (i = 1; i < fs_info->vol.fats; i++) - { - sc = rtems_bdbuf_get(fs_info->vol.dev, - fs_info->c.blk_num + - fs_info->vol.fat_length * i, - &b); - if ( sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(ENOMEM); - memcpy(b->buffer, fs_info->sec_buf, fs_info->vol.bps); - sc = rtems_bdbuf_release_modified(b); - if ( sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(ENOMEM); - } - } - } - else - { - sc = rtems_bdbuf_release(fs_info->c.buf); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - } - if (op_type == FAT_OP_TYPE_READ) - sc = rtems_bdbuf_read(fs_info->vol.dev, blk, &fs_info->c.buf); - else - sc = rtems_bdbuf_get(fs_info->vol.dev, blk, &fs_info->c.buf); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - fs_info->c.blk_num = blk; - } - *buf = fs_info->c.buf; - return RC_OK; -} - - -static inline int -fat_buf_release(fat_fs_info_t *fs_info) -{ - rtems_status_code sc = RTEMS_SUCCESSFUL; - unsigned8 i; - rtems_boolean sec_of_fat; - - if (fs_info->c.state == FAT_CACHE_EMPTY) - return RC_OK; - - sec_of_fat = ((fs_info->c.blk_num >= fs_info->vol.fat_loc) && - (fs_info->c.blk_num < fs_info->vol.rdir_loc)); - - if (fs_info->c.modified) - { - if (sec_of_fat && !fs_info->vol.mirror) - memcpy(fs_info->sec_buf, fs_info->c.buf->buffer, fs_info->vol.bps); - - sc = rtems_bdbuf_release_modified(fs_info->c.buf); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - fs_info->c.modified = 0; - - if (sec_of_fat && !fs_info->vol.mirror) - { - bdbuf_buffer *b; - - for (i = 1; i < fs_info->vol.fats; i++) - { - sc = rtems_bdbuf_get(fs_info->vol.dev, - fs_info->c.blk_num + - fs_info->vol.fat_length * i, - &b); - if ( sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(ENOMEM); - memcpy(b->buffer, fs_info->sec_buf, fs_info->vol.bps); - sc = rtems_bdbuf_release_modified(b); - if ( sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(ENOMEM); - } - } - } - else - { - sc = rtems_bdbuf_release(fs_info->c.buf); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - } - fs_info->c.state = FAT_CACHE_EMPTY; - return RC_OK; -} - -static inline void -fat_buf_mark_modified(fat_fs_info_t *fs_info) -{ - fs_info->c.modified = TRUE; -} - - - -ssize_t -_fat_block_read(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 start, - unsigned32 offset, - unsigned32 count, - void *buff); - -ssize_t -_fat_block_write(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 start, - unsigned32 offset, - unsigned32 count, - const void *buff); - -ssize_t -fat_cluster_read(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - void *buff); - -ssize_t -fat_cluster_write(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - const void *buff); - -int -fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry); - -int -fat_init_clusters_chain(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 start_cln); - -unsigned32 -fat_cluster_num_to_sector_num(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln); - -int -fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry); - - -unsigned32 -fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry); - -rtems_boolean -fat_ino_is_unique(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 ino); - -void -fat_free_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 ino); - -int -fat_fat32_update_fsinfo_sector( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 free_count, - unsigned32 next_free - ); - -#ifdef __cplusplus -} -#endif - -#endif /* __DOSFS_FAT_H__ */ diff --git a/c/src/exec/libfs/src/dosfs/fat_fat_operations.c b/c/src/exec/libfs/src/dosfs/fat_fat_operations.c deleted file mode 100644 index 49b2ab70d3..0000000000 --- a/c/src/exec/libfs/src/dosfs/fat_fat_operations.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - * fat_fat_operations.c - * - * General operations on File Allocation Table - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * @(#) $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "fat.h" -#include "fat_fat_operations.h" - -/* fat_scan_fat_for_free_clusters -- - * Allocate chain of free clusters from Files Allocation Table - * - * PARAMETERS: - * mt_entry - mount table entry - * chain - the number of the first allocated cluster (first cluster - * in the chain) - * count - count of clusters to allocate (chain length) - * - * RETURNS: - * RC_OK on success, or error code if error occured (errno set - * appropriately) - * - * - */ -int -fat_scan_fat_for_free_clusters( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 *chain, - unsigned32 count, - unsigned32 *cls_added, - unsigned32 *last_cl - ) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 cl4find = 2; - unsigned32 next_cln = 0; - unsigned32 save_cln = 0; - unsigned32 data_cls_val = fs_info->vol.data_cls + 2; - unsigned32 i = 2; - - *cls_added = 0; - - if (count == 0) - return rc; - - if ((fs_info->vol.type & FAT_FAT32) && - (fs_info->vol.next_cl != FAT_UNDEFINED_VALUE)) - cl4find = fs_info->vol.next_cl; - - /* - * fs_info->vol.data_cls is exactly the count of data clusters - * starting at cluster 2, so the maximum valid cluster number is - * (fs_info->vol.data_cls + 1) - */ - while (i < data_cls_val) - { - rc = fat_get_fat_cluster(mt_entry, cl4find, &next_cln); - if ( rc != RC_OK ) - { - if (*cls_added != 0) - fat_free_fat_clusters_chain(mt_entry, (*chain)); - return rc; - } - - if ((next_cln & fs_info->vol.mask) == FAT_GENFAT_FREE) - { - /* - * We are enforced to process allocation of the first free cluster - * by separate 'if' statement because otherwise undo function - * wouldn't work properly - */ - if (*cls_added == 0) - { - *chain = cl4find; - rc = fat_set_fat_cluster(mt_entry, cl4find, FAT_GENFAT_EOC); - if ( rc != RC_OK ) - { - /* - * this is the first cluster we tried to allocate so no - * cleanup activity needed - */ - return rc; - } - } - else - { - /* set EOC value to new allocated cluster */ - rc = fat_set_fat_cluster(mt_entry, cl4find, FAT_GENFAT_EOC); - if ( rc != RC_OK ) - { - /* cleanup activity */ - fat_free_fat_clusters_chain(mt_entry, (*chain)); - return rc; - } - - rc = fat_set_fat_cluster(mt_entry, save_cln, cl4find); - if ( rc != RC_OK ) - { - /* cleanup activity */ - fat_free_fat_clusters_chain(mt_entry, (*chain)); - /* trying to save last allocated cluster for future use */ - fat_set_fat_cluster(mt_entry, cl4find, FAT_GENFAT_FREE); - fat_buf_release(fs_info); - return rc; - } - } - - save_cln = cl4find; - (*cls_added)++; - - /* have we satisfied request ? */ - if (*cls_added == count) - { - if (fs_info->vol.type & FAT_FAT32) - { - fs_info->vol.next_cl = save_cln; - if (fs_info->vol.free_cls != 0xFFFFFFFF) - fs_info->vol.free_cls -= (*cls_added); - } - *last_cl = save_cln; - fat_buf_release(fs_info); - return rc; - } - } - i++; - cl4find++; - if (cl4find >= data_cls_val) - cl4find = 2; - } - - if (fs_info->vol.type & FAT_FAT32) - { - fs_info->vol.next_cl = save_cln; - if (fs_info->vol.free_cls != 0xFFFFFFFF) - fs_info->vol.free_cls -= (*cls_added); - } - *last_cl = save_cln; - fat_buf_release(fs_info); - return RC_OK; -} - -/* fat_free_fat_clusters_chain -- - * Free chain of clusters in Files Allocation Table. - * - * PARAMETERS: - * mt_entry - mount table entry - * chain - number of the first cluster in the chain - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -fat_free_fat_clusters_chain( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 chain - ) -{ - int rc = RC_OK, rc1 = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 cur_cln = chain; - unsigned32 next_cln = 0; - unsigned32 freed_cls_cnt = 0; - - while ((cur_cln & fs_info->vol.mask) != fs_info->vol.eoc_val) - { - rc = fat_get_fat_cluster(mt_entry, cur_cln, &next_cln); - if ( rc != RC_OK ) - { - if ((fs_info->vol.type & FAT_FAT32) && - (fs_info->vol.free_cls != FAT_UNDEFINED_VALUE)) - fs_info->vol.free_cls += freed_cls_cnt; - fat_buf_release(fs_info); - return rc; - } - - rc = fat_set_fat_cluster(mt_entry, cur_cln, FAT_GENFAT_FREE); - if ( rc != RC_OK ) - rc1 = rc; - - freed_cls_cnt++; - cur_cln = next_cln; - } - - if (fs_info->vol.type & FAT_FAT32) - { - fs_info->vol.next_cl = chain; - if (fs_info->vol.free_cls != FAT_UNDEFINED_VALUE) - fs_info->vol.free_cls += freed_cls_cnt; - } - - fat_buf_release(fs_info); - if (rc1 != RC_OK) - return rc1; - - return RC_OK; -} - -/* fat_get_fat_cluster -- - * Fetches the contents of the cluster (link to next cluster in the chain) - * from Files Allocation Table. - * - * PARAMETERS: - * mt_entry - mount table entry - * cln - number of cluster to fetch the contents from - * ret_val - contents of the cluster 'cln' (link to next cluster in - * the chain) - * - * RETURNS: - * RC_OK on success, or -1 if error occured - * and errno set appropriately - */ -int -fat_get_fat_cluster( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - unsigned32 *ret_val - ) -{ - int rc = RC_OK; - register fat_fs_info_t *fs_info = mt_entry->fs_info; - bdbuf_buffer *block0 = NULL; - unsigned32 sec = 0; - unsigned32 ofs = 0; - - /* sanity check */ - if ( (cln < 2) || (cln > (fs_info->vol.data_cls + 1)) ) - set_errno_and_return_minus_one(EIO); - - sec = (FAT_FAT_OFFSET(fs_info->vol.type, cln) >> fs_info->vol.sec_log2) + - fs_info->vol.afat_loc; - ofs = FAT_FAT_OFFSET(fs_info->vol.type, cln) & (fs_info->vol.bps - 1); - - rc = fat_buf_access(fs_info, sec, FAT_OP_TYPE_READ, &block0); - if (rc != RC_OK) - return rc; - - switch ( fs_info->vol.type ) - { - case FAT_FAT12: - /* - * we are enforced in complex computations for FAT12 to escape CPU - * align problems for some architectures - */ - *ret_val = (*((unsigned8 *)(block0->buffer + ofs))); - if ( ofs == (fs_info->vol.bps - 1) ) - { - rc = fat_buf_access(fs_info, sec + 1, FAT_OP_TYPE_READ, - &block0); - if (rc != RC_OK) - return rc; - - *ret_val |= (*((unsigned8 *)(block0->buffer)))<<8; - } - else - { - *ret_val |= (*((unsigned8 *)(block0->buffer + ofs + 1)))<<8; - } - - if ( FAT_CLUSTER_IS_ODD(cln) ) - *ret_val = (*ret_val) >> FAT12_SHIFT; - else - *ret_val = (*ret_val) & FAT_FAT12_MASK; - - break; - - case FAT_FAT16: - *ret_val = *((unsigned16 *)(block0->buffer + ofs)); - *ret_val = CF_LE_W(*ret_val); - break; - - case FAT_FAT32: - *ret_val = *((unsigned32 *)(block0->buffer + ofs)); - *ret_val = CF_LE_L(*ret_val); - break; - - default: - set_errno_and_return_minus_one(EIO); - break; - } - - return RC_OK; -} - -/* fat_set_fat_cluster -- - * Set the contents of the cluster (link to next cluster in the chain) - * from Files Allocation Table. - * - * PARAMETERS: - * mt_entry - mount table entry - * cln - number of cluster to set contents to - * in_val - value to set - * - * RETURNS: - * RC_OK on success, or -1 if error occured - * and errno set appropriately - */ -int -fat_set_fat_cluster( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - unsigned32 in_val - ) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 sec = 0; - unsigned32 ofs = 0; - unsigned16 fat16_clv = 0; - unsigned32 fat32_clv = 0; - bdbuf_buffer *block0 = NULL; - - /* sanity check */ - if ( (cln < 2) || (cln > (fs_info->vol.data_cls + 1)) ) - set_errno_and_return_minus_one(EIO); - - sec = (FAT_FAT_OFFSET(fs_info->vol.type, cln) >> fs_info->vol.sec_log2) + - fs_info->vol.afat_loc; - ofs = FAT_FAT_OFFSET(fs_info->vol.type, cln) & (fs_info->vol.bps - 1); - - rc = fat_buf_access(fs_info, sec, FAT_OP_TYPE_READ, &block0); - if (rc != RC_OK) - return rc; - - switch ( fs_info->vol.type ) - { - case FAT_FAT12: - if ( FAT_CLUSTER_IS_ODD(cln) ) - { - fat16_clv = CT_LE_W((((unsigned16)in_val) << FAT_FAT12_SHIFT)); - - *((unsigned8 *)(block0->buffer + ofs)) = - (*((unsigned8 *)(block0->buffer + ofs))) & 0x0F; - - *((unsigned8 *)(block0->buffer + ofs)) = - (*((unsigned8 *)(block0->buffer + ofs))) | - (unsigned8)(fat16_clv & 0x00FF); - - fat_buf_mark_modified(fs_info); - - if ( ofs == (fs_info->vol.bps - 1) ) - { - rc = fat_buf_access(fs_info, sec + 1, FAT_OP_TYPE_READ, - &block0); - if (rc != RC_OK) - return rc; - - *((unsigned8 *)(block0->buffer)) &= 0x00; - - *((unsigned8 *)(block0->buffer)) = - (*((unsigned8 *)(block0->buffer))) | - (unsigned8)((fat16_clv & 0xFF00)>>8); - - fat_buf_mark_modified(fs_info); - } - else - { - *((unsigned8 *)(block0->buffer + ofs + 1)) &= 0x00; - - *((unsigned8 *)(block0->buffer + ofs + 1)) = - (*((unsigned8 *)(block0->buffer + ofs + 1))) | - (unsigned8)((fat16_clv & 0xFF00)>>8); - } - } - else - { - fat16_clv = CT_LE_W((((unsigned16)in_val) & FAT_FAT12_MASK)); - - *((unsigned8 *)(block0->buffer + ofs)) &= 0x00; - - *((unsigned8 *)(block0->buffer + ofs)) = - (*((unsigned8 *)(block0->buffer + ofs))) | - (unsigned8)(fat16_clv & 0x00FF); - - fat_buf_mark_modified(fs_info); - - if ( ofs == (fs_info->vol.bps - 1) ) - { - rc = fat_buf_access(fs_info, sec + 1, FAT_OP_TYPE_READ, - &block0); - if (rc != RC_OK) - return rc; - - *((unsigned8 *)(block0->buffer)) = - (*((unsigned8 *)(block0->buffer))) & 0xF0; - - *((unsigned8 *)(block0->buffer)) = - (*((unsigned8 *)(block0->buffer))) | - (unsigned8)((fat16_clv & 0xFF00)>>8); - - fat_buf_mark_modified(fs_info); - } - else - { - *((unsigned8 *)(block0->buffer + ofs + 1)) = - (*((unsigned8 *)(block0->buffer + ofs + 1))) & 0xF0; - - *((unsigned8 *)(block0->buffer + ofs+1)) = - (*((unsigned8 *)(block0->buffer + ofs+1))) | - (unsigned8)((fat16_clv & 0xFF00)>>8); - } - } - break; - - case FAT_FAT16: - *((unsigned16 *)(block0->buffer + ofs)) = - (unsigned16)(CT_LE_W(in_val)); - fat_buf_mark_modified(fs_info); - break; - - case FAT_FAT32: - fat32_clv = CT_LE_L((in_val & FAT_FAT32_MASK)); - - *((unsigned32 *)(block0->buffer + ofs)) = - (*((unsigned32 *)(block0->buffer + ofs))) & (CT_LE_L(0xF0000000)); - - *((unsigned32 *)(block0->buffer + ofs)) = - fat32_clv | (*((unsigned32 *)(block0->buffer + ofs))); - - fat_buf_mark_modified(fs_info); - break; - - default: - set_errno_and_return_minus_one(EIO); - break; - - } - - return RC_OK; -} diff --git a/c/src/exec/libfs/src/dosfs/fat_fat_operations.h b/c/src/exec/libfs/src/dosfs/fat_fat_operations.h deleted file mode 100644 index 59b6a84018..0000000000 --- a/c/src/exec/libfs/src/dosfs/fat_fat_operations.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * fat_fat_operations.h - * - * Constants/data structures/prototypes for operations on Files Allocation - * Table - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 __DOSFS_FAT_FAT_OPERATIONS_H__ -#define __DOSFS_FAT_FAT_OPERATIONS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include -#include "fat.h" - -int -fat_get_fat_cluster(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - unsigned32 *ret_val); - -int -fat_set_fat_cluster(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - unsigned32 in_val); - -int -fat_scan_fat_for_free_clusters( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 *chain, - unsigned32 count, - unsigned32 *cls_added, - unsigned32 *last_cl -); - -int -fat_free_fat_clusters_chain( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 chain -); - -#ifdef __cplusplus -} -#endif - -#endif /* __DOSFS_FAT_FAT_OPERATIONS_H__ */ diff --git a/c/src/exec/libfs/src/dosfs/fat_file.c b/c/src/exec/libfs/src/dosfs/fat_file.c deleted file mode 100644 index 8046f47720..0000000000 --- a/c/src/exec/libfs/src/dosfs/fat_file.c +++ /dev/null @@ -1,978 +0,0 @@ -/* - * fat_file.c - * - * General operations on "fat-file" - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * @(#) $Id$ - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -static inline void -_hash_insert(Chain_Control *hash, unsigned32 key1, unsigned32 key2, - fat_file_fd_t *el); - -static inline void -_hash_delete(Chain_Control *hash, unsigned32 key1, unsigned32 key2, - fat_file_fd_t *el); - -static inline int -_hash_search( - rtems_filesystem_mount_table_entry_t *mt_entry, - Chain_Control *hash, - unsigned32 key1, - unsigned32 key2, - void **ret -); - -static int -fat_file_lseek( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 file_cln, - unsigned32 *disk_cln -); - -/* fat_file_open -- - * Open fat-file. Two hash tables are accessed by key - * constructed from cluster num and offset of the node (i.e. - * files/directories are distinguished by location on the disk). - * First, hash table("vhash") consists of fat-file descriptors corresponded - * to "valid" files is accessed. Search is made by 2 fields equal to key - * constructed. If descriptor is found in the "vhash" - return it. - * Otherwise search is made in hash table("rhash") consits of fat-file - * descriptors corresponded to "removed-but-still-open" files with the - * same keys. - * If search failed, new fat-file descriptor is added to "vhash" - * with both key fields equal to constructed key. Otherwise new fat-file - * descriptor is added to "vhash" with first key field equal to key - * constructed and the second equal to an unique (unique among all values - * of second key fields) value. - * - * PARAMETERS: - * mt_entry - mount table entry - * cln - cluster num of the node - * ofs - offset of the node - * fat_fd - placeholder for returned fat-file descriptor - * - * RETURNS: - * RC_OK and pointer to opened descriptor on success, or -1 if error - * occured (errno set appropriately) - */ -int -fat_file_open( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - unsigned32 ofs, - fat_file_fd_t **fat_fd - ) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - fat_file_fd_t *lfat_fd = NULL; - unsigned32 key = 0; - - /* construct key */ - key = fat_construct_key(mt_entry, cln, ofs); - - /* access "valid" hash table */ - rc = _hash_search(mt_entry, fs_info->vhash, key, 0, (void **)&lfat_fd); - if ( rc == RC_OK ) - { - /* return pointer to fat_file_descriptor allocated before */ - (*fat_fd) = lfat_fd; - lfat_fd->links_num++; - return rc; - } - - /* access "removed-but-still-open" hash table */ - rc = _hash_search(mt_entry, fs_info->rhash, key, key, (void **)&lfat_fd); - - lfat_fd = (*fat_fd) = (fat_file_fd_t*)malloc(sizeof(fat_file_fd_t)); - if ( lfat_fd == NULL ) - set_errno_and_return_minus_one( ENOMEM ); - - lfat_fd->links_num = 1; - lfat_fd->flags &= ~FAT_FILE_REMOVED; - lfat_fd->map.last_cln = FAT_UNDEFINED_VALUE; - - if ( rc != RC_OK ) - lfat_fd->ino = key; - else - { - lfat_fd->ino = fat_get_unique_ino(mt_entry); - - if ( lfat_fd->ino == 0 ) - { - free((*fat_fd)); - /* - * XXX: kernel resource is unsufficient, but not the memory, - * but there is no suitable errno :( - */ - set_errno_and_return_minus_one( ENOMEM ); - } - } - _hash_insert(fs_info->vhash, key, lfat_fd->ino, lfat_fd); - - - /* - * other fields of fat-file descriptor will be initialized on upper - * level - */ - - return RC_OK; -} - - -/* fat_file_reopen -- - * Increment by 1 number of links - * - * PARAMETERS: - * fat_fd - fat-file descriptor - * - * RETURNS: - * RC_OK - */ -int -fat_file_reopen(fat_file_fd_t *fat_fd) -{ - fat_fd->links_num++; - return RC_OK; -} - -/* fat_file_close -- - * Close fat-file. If count of links to fat-file - * descriptor is greater than 1 (i.e. somebody esle holds pointer - * to this descriptor) just decrement it. Otherwise - * do the following. If this descriptor corresponded to removed fat-file - * then free clusters contained fat-file data, delete descriptor from - * "rhash" table and free memory allocated by descriptor. If descriptor - * correspondes to non-removed fat-file and 'ino' field has value from - * unique inode numbers pool then set count of links to descriptor to zero - * and leave it in hash, otherwise delete descriptor from "vhash" and free - * memory allocated by the descriptor - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * - * RETURNS: - * RC_OK, or -1 if error occured (errno set appropriately) - */ -int -fat_file_close( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd - ) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 key = 0; - - /* - * if links_num field of fat-file descriptor is greater than 1 - * decrement the count of links and return - */ - if (fat_fd->links_num > 1) - { - fat_fd->links_num--; - return rc; - } - - key = fat_construct_key(mt_entry, fat_fd->info_cln, fat_fd->info_ofs); - - if (fat_fd->flags & FAT_FILE_REMOVED) - { - rc = fat_file_truncate(mt_entry, fat_fd, 0); - if ( rc != RC_OK ) - return rc; - - _hash_delete(fs_info->rhash, key, fat_fd->ino, fat_fd); - - if ( fat_ino_is_unique(mt_entry, fat_fd->ino) ) - fat_free_unique_ino(mt_entry, fat_fd->ino); - - free(fat_fd); - } - else - { - if (fat_ino_is_unique(mt_entry, fat_fd->ino)) - { - fat_fd->links_num = 0; - } - else - { - _hash_delete(fs_info->vhash, key, fat_fd->ino, fat_fd); - free(fat_fd); - } - } - return rc; -} - -/* fat_file_read -- - * Read 'count' bytes from 'start' position from fat-file. This - * interface hides the architecture of fat-file, represents it as - * linear file - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * start - offset in fat-file (in bytes) to read from - * count - count of bytes to read - * buf - buffer provided by user - * - * RETURNS: - * the number of bytes read on success, or -1 if error occured (errno - * set appropriately) - */ -ssize_t -fat_file_read( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 start, - unsigned32 count, - char *buf - ) -{ - int rc = RC_OK; - ssize_t ret = 0; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 cmpltd = 0; - unsigned32 cur_cln = 0; - unsigned32 cl_start = 0; - unsigned32 save_cln = 0; - unsigned32 ofs = 0; - unsigned32 save_ofs; - unsigned32 sec = 0; - unsigned32 byte = 0; - unsigned32 c = 0; - - /* it couldn't be removed - otherwise cache update will be broken */ - if (count == 0) - return cmpltd; - - /* - * >= because start is offset and computed from 0 and file_size - * computed from 1 - */ - if ( start >= fat_fd->fat_file_size ) - return FAT_EOF; - - if ((count > fat_fd->fat_file_size) || - (start > fat_fd->fat_file_size - count)) - count = fat_fd->fat_file_size - start; - - if ((FAT_FD_OF_ROOT_DIR(fat_fd)) && - (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16))) - { - sec = fat_cluster_num_to_sector_num(mt_entry, fat_fd->cln); - sec += (start >> fs_info->vol.sec_log2); - byte = start & (fs_info->vol.bps - 1); - - ret = _fat_block_read(mt_entry, sec, byte, count, buf); - if ( ret < 0 ) - return -1; - - return ret; - } - - cl_start = start >> fs_info->vol.bpc_log2; - save_ofs = ofs = start & (fs_info->vol.bpc - 1); - - rc = fat_file_lseek(mt_entry, fat_fd, cl_start, &cur_cln); - if (rc != RC_OK) - return rc; - - while (count > 0) - { - c = MIN(count, (fs_info->vol.bpc - ofs)); - - sec = fat_cluster_num_to_sector_num(mt_entry, cur_cln); - sec += (ofs >> fs_info->vol.sec_log2); - byte = ofs & (fs_info->vol.bps - 1); - - ret = _fat_block_read(mt_entry, sec, byte, c, buf + cmpltd); - if ( ret < 0 ) - return -1; - - count -= c; - cmpltd += c; - save_cln = cur_cln; - rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln); - if ( rc != RC_OK ) - return rc; - - ofs = 0; - } - - /* update cache */ - /* XXX: check this - I'm not sure :( */ - fat_fd->map.file_cln = cl_start + - ((save_ofs + cmpltd - 1) >> fs_info->vol.bpc_log2); - fat_fd->map.disk_cln = save_cln; - - return cmpltd; -} - -/* fat_file_write -- - * Write 'count' bytes of data from user supplied buffer to fat-file - * starting at offset 'start'. This interface hides the architecture - * of fat-file, represents it as linear file - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * start - offset(in bytes) to write from - * count - count - * buf - buffer provided by user - * - * RETURNS: - * number of bytes actually written to the file on success, or -1 if - * error occured (errno set appropriately) - */ -ssize_t -fat_file_write( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 start, - unsigned32 count, - const char *buf - ) -{ - int rc = 0; - ssize_t ret = 0; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 cmpltd = 0; - unsigned32 cur_cln = 0; - unsigned32 save_cln = 0; /* FIXME: This might be incorrect, cf. below */ - unsigned32 cl_start = 0; - unsigned32 ofs = 0; - unsigned32 save_ofs; - unsigned32 sec = 0; - unsigned32 byte = 0; - unsigned32 c = 0; - - if ( count == 0 ) - return cmpltd; - - if ( start > fat_fd->fat_file_size ) - set_errno_and_return_minus_one( EIO ); - - if ((count > fat_fd->size_limit) || - (start > fat_fd->size_limit - count)) - set_errno_and_return_minus_one( EIO ); - - rc = fat_file_extend(mt_entry, fat_fd, start + count, &c); - if (rc != RC_OK) - return rc; - - /* - * check whether there was enough room on device to locate - * file of 'start + count' bytes - */ - if (c != (start + count)) - count = c - start; - - if ((FAT_FD_OF_ROOT_DIR(fat_fd)) && - (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16))) - { - sec = fat_cluster_num_to_sector_num(mt_entry, fat_fd->cln); - sec += (start >> fs_info->vol.sec_log2); - byte = start & (fs_info->vol.bps - 1); - - ret = _fat_block_write(mt_entry, sec, byte, count, buf); - if ( ret < 0 ) - return -1; - - return ret; - } - - cl_start = start >> fs_info->vol.bpc_log2; - save_ofs = ofs = start & (fs_info->vol.bpc - 1); - - rc = fat_file_lseek(mt_entry, fat_fd, cl_start, &cur_cln); - if (rc != RC_OK) - return rc; - - while (count > 0) - { - c = MIN(count, (fs_info->vol.bpc - ofs)); - - sec = fat_cluster_num_to_sector_num(mt_entry, cur_cln); - sec += (ofs >> fs_info->vol.sec_log2); - byte = ofs & (fs_info->vol.bps - 1); - - ret = _fat_block_write(mt_entry, sec, byte, c, buf + cmpltd); - if ( ret < 0 ) - return -1; - - count -= c; - cmpltd += c; - save_cln = cur_cln; - rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln); - if ( rc != RC_OK ) - return rc; - - ofs = 0; - } - - /* update cache */ - /* XXX: check this - I'm not sure :( */ - fat_fd->map.file_cln = cl_start + - ((save_ofs + cmpltd - 1) >> fs_info->vol.bpc_log2); - fat_fd->map.disk_cln = save_cln; - - return cmpltd; -} - -/* fat_file_extend -- - * Extend fat-file. If new length less than current fat-file size - - * do nothing. Otherwise calculate necessary count of clusters to add, - * allocate it and add new clusters chain to the end of - * existing clusters chain. - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * new_length - new length - * a_length - placeholder for result - actual new length of file - * - * RETURNS: - * RC_OK and new length of file on success, or -1 if error occured (errno - * set appropriately) - */ -int -fat_file_extend( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 new_length, - unsigned32 *a_length - ) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 chain = 0; - unsigned32 bytes2add = 0; - unsigned32 cls2add = 0; - unsigned32 old_last_cl; - unsigned32 last_cl = 0; - unsigned32 bytes_remain = 0; - unsigned32 cls_added; - - *a_length = new_length; - - if (new_length <= fat_fd->fat_file_size) - return RC_OK; - - if ((FAT_FD_OF_ROOT_DIR(fat_fd)) && - (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16))) - set_errno_and_return_minus_one( ENOSPC ); - - bytes_remain = (fs_info->vol.bpc - - (fat_fd->fat_file_size & (fs_info->vol.bpc - 1))) & - (fs_info->vol.bpc - 1); - - bytes2add = new_length - fat_fd->fat_file_size; - - if (bytes2add > bytes_remain) - bytes2add -= bytes_remain; - else - bytes2add = 0; - - /* - * if in last cluster allocated for the file there is enough room to - * handle extention (hence we don't need to add even one cluster to the - * file ) - return - */ - if (bytes2add == 0) - return RC_OK; - - cls2add = ((bytes2add - 1) >> fs_info->vol.bpc_log2) + 1; - - rc = fat_scan_fat_for_free_clusters(mt_entry, &chain, cls2add, - &cls_added, &last_cl); - - /* this means that low level I/O error occured */ - if (rc != RC_OK) - return rc; - - /* this means that no space left on device */ - if ((cls_added == 0) && (bytes_remain == 0)) - set_errno_and_return_minus_one(ENOSPC); - - /* check wether we satisfied request for 'cls2add' clusters */ - if (cls2add != cls_added) - *a_length = new_length - - ((cls2add - cls_added - 1) << fs_info->vol.bpc_log2) - - (bytes2add & (fs_info->vol.bpc - 1)); - - /* add new chain to the end of existed */ - if ( fat_fd->fat_file_size == 0 ) - { - fat_fd->map.disk_cln = fat_fd->cln = chain; - fat_fd->map.file_cln = 0; - } - else - { - if (fat_fd->map.last_cln != FAT_UNDEFINED_VALUE) - { - old_last_cl = fat_fd->map.last_cln; - } - else - { - rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM, - (fat_fd->fat_file_size - 1), &old_last_cl); - if ( rc != RC_OK ) - { - fat_free_fat_clusters_chain(mt_entry, chain); - return rc; - } - } - - rc = fat_set_fat_cluster(mt_entry, old_last_cl, chain); - if ( rc != RC_OK ) - { - fat_free_fat_clusters_chain(mt_entry, chain); - return rc; - } - fat_buf_release(fs_info); - } - - /* update number of the last cluster of the file if it changed */ - if (cls_added != 0) - { - fat_fd->map.last_cln = last_cl; - if (fat_fd->fat_file_type == FAT_DIRECTORY) - { - rc = fat_init_clusters_chain(mt_entry, chain); - if ( rc != RC_OK ) - { - fat_free_fat_clusters_chain(mt_entry, chain); - return rc; - } - } - } - - return RC_OK; -} - -/* fat_file_truncate -- - * Truncate fat-file. If new length greater than current fat-file size - - * do nothing. Otherwise find first cluster to free and free all clusters - * in the chain starting from this cluster. - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * new_length - new length - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -fat_file_truncate( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 new_length - ) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 cur_cln = 0; - unsigned32 cl_start = 0; - unsigned32 new_last_cln = FAT_UNDEFINED_VALUE; - - - if ( new_length >= fat_fd->fat_file_size ) - return rc; - - assert(fat_fd->fat_file_size); - - cl_start = (new_length + fs_info->vol.bpc - 1) >> fs_info->vol.bpc_log2; - - if ((cl_start << fs_info->vol.bpc_log2) >= fat_fd->fat_file_size) - return RC_OK; - - if (cl_start != 0) - { - rc = fat_file_lseek(mt_entry, fat_fd, cl_start - 1, &new_last_cln); - if (rc != RC_OK) - return rc; - - } - - rc = fat_file_lseek(mt_entry, fat_fd, cl_start, &cur_cln); - if (rc != RC_OK) - return rc; - - rc = fat_free_fat_clusters_chain(mt_entry, cur_cln); - if (rc != RC_OK) - return rc; - - if (cl_start != 0) - { - rc = fat_set_fat_cluster(mt_entry, new_last_cln, FAT_GENFAT_EOC); - if ( rc != RC_OK ) - return rc; - fat_fd->map.file_cln = cl_start - 1; - fat_fd->map.disk_cln = new_last_cln; - fat_fd->map.last_cln = new_last_cln; - } - return RC_OK; -} - -/* fat_file_ioctl -- - * F_CLU_NUM: - * make mapping between serial number of the cluster in fat-file and - * its real number on the volume - * - * PARAMETERS: - * fat_fd - fat-file descriptor - * mt_entry - mount table entry - * cmd - command - * ... - * - * RETURNS: - * RC_OK on success, or -1 if error occured and errno set appropriately - */ -int -fat_file_ioctl( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - int cmd, - ...) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 cur_cln = 0; - unsigned32 cl_start = 0; - unsigned32 pos = 0; - unsigned32 *ret; - va_list ap; - - va_start(ap, cmd); - - switch (cmd) - { - case F_CLU_NUM: - pos = va_arg(ap, int); - ret = va_arg(ap, int *); - - /* sanity check */ - if ( pos >= fat_fd->fat_file_size ) - set_errno_and_return_minus_one( EIO ); - - if ((FAT_FD_OF_ROOT_DIR(fat_fd)) && - (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16))) - { - /* cluster 0 (zero) reserved for root dir */ - *ret = 0; - return RC_OK; - } - - cl_start = pos >> fs_info->vol.bpc_log2; - - rc = fat_file_lseek(mt_entry, fat_fd, cl_start, &cur_cln); - if ( rc != RC_OK ) - return rc; - - *ret = cur_cln; - break; - - default: - errno = EINVAL; - rc = -1; - break; - } - return rc; -} - -/* fat_file_mark_removed -- - * Remove the fat-file descriptor from "valid" hash table, insert it - * into "removed-but-still-open" hash table and set up "removed" bit. - * - * PARAMETERS: - * fat_fd - fat-file descriptor - * mt_entry - mount table entry - * - * RETURNS: - * None - */ -void -fat_file_mark_removed( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd - ) -{ - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 key = 0; - - key = fat_construct_key(mt_entry, fat_fd->info_cln, fat_fd->info_ofs); - - _hash_delete(fs_info->vhash, key, fat_fd->ino, fat_fd); - - _hash_insert(fs_info->rhash, key, fat_fd->ino, fat_fd); - - fat_fd->flags |= FAT_FILE_REMOVED; -} - -/* fat_file_datasync -- - * Synchronize fat-file - flush all buffered data to the media. - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * - * RETURNS: - * RC_OK on success, or -1 if error occured and errno set appropriately - */ -int -fat_file_datasync( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd - ) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 cur_cln = fat_fd->cln; - bdbuf_buffer *block = NULL; - unsigned32 sec = 0; - unsigned32 i = 0; - - if (fat_fd->fat_file_size == 0) - return RC_OK; - - /* - * we can use only one bdbuf :( and we also know that cache is useless - * for sync operation, so don't use it - */ - rc = fat_buf_release(fs_info); - if (rc != RC_OK) - return rc; - - /* for each cluster of the file ... */ - while ((cur_cln & fs_info->vol.mask) != fs_info->vol.eoc_val) - { - sec = fat_cluster_num_to_sector_num(mt_entry, cur_cln); - /* for each sector in cluster ... */ - for ( i = 0; i < fs_info->vol.spc; i++ ) - { - /* ... sync it */ - sc = rtems_bdbuf_read(fs_info->vol.dev, (sec + i), &block); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one( EIO ); - - sc = rtems_bdbuf_sync(block); - if ( sc != RTEMS_SUCCESSFUL ) - set_errno_and_return_minus_one( EIO ); - } - - rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln); - if ( rc != RC_OK ) - return rc; - } - return rc; -} - -/* fat_file_size -- - * Calculate fat-file size - fat-file is nothing that clusters chain, so - * go through all clusters in the chain and count it. Only - * special case is root directory for FAT12/16 volumes. - * This function is used only for directories which are fat-files with - * non-zero length, hence 'fat_fd->cln' always contains valid data. - * Calculated size is stored in 'fat_file_size' field of fat-file - * descriptor. - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -fat_file_size( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd - ) -{ - int rc = RC_OK; - fat_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 cur_cln = fat_fd->cln; - unsigned32 save_cln = 0; - - /* Have we requested root dir size for FAT12/16? */ - if ((FAT_FD_OF_ROOT_DIR(fat_fd)) && - (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16))) - { - fat_fd->fat_file_size = fs_info->vol.rdir_size; - return rc; - } - - fat_fd->fat_file_size = 0; - - while ((cur_cln & fs_info->vol.mask) != fs_info->vol.eoc_val) - { - save_cln = cur_cln; - rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln); - if ( rc != RC_OK ) - return rc; - - fat_fd->fat_file_size += fs_info->vol.bpc; - } - fat_fd->map.last_cln = save_cln; - return rc; -} - -/* hash support routines */ - -/* _hash_insert -- - * Insert elemnt into hash based on key 'key1' - * - * PARAMETERS: - * hash - hash element will be inserted into - * key1 - key on which insertion is based on - * key2 - not used during insertion - * el - element to insert - * - * RETURNS: - * None - */ -static inline void -_hash_insert(Chain_Control *hash, unsigned32 key1, unsigned32 key2, - fat_file_fd_t *el) -{ - _Chain_Append((hash) + ((key1) % FAT_HASH_MODULE), &(el)->link); -} - - -/* _hash_delete -- - * Remove element from hash - * - * PARAMETERS: - * hash - hash element will be removed from - * key1 - not used - * key2 - not used - * el - element to delete - * - * RETURNS: - * None - */ -static inline void -_hash_delete(Chain_Control *hash, unsigned32 key1, unsigned32 key2, - fat_file_fd_t *el) -{ - _Chain_Extract(&(el)->link); -} - -/* _hash_search -- - * Search element in hash. If both keys match pointer to found element - * is returned - * - * PARAMETERS: - * mt_entry - mount table entry - * hash - hash element will be removed from - * key1 - search key - * key2 - search key - * ret - placeholder for result - * - * RETURNS: - * 0 and pointer to found element on success, -1 otherwise - */ -static inline int -_hash_search( - rtems_filesystem_mount_table_entry_t *mt_entry, - Chain_Control *hash, - unsigned32 key1, - unsigned32 key2, - void **ret - ) -{ - unsigned32 mod = (key1) % FAT_HASH_MODULE; - Chain_Node *the_node = ((Chain_Control *)((hash) + mod))->first; - - for ( ; !_Chain_Is_tail((hash) + mod, the_node) ; ) - { - fat_file_fd_t *ffd = (fat_file_fd_t *)the_node; - unsigned32 ck = - fat_construct_key(mt_entry, ffd->info_cln, ffd->info_ofs); - - if ( (key1) == ck) - { - if ( ((key2) == 0) || ((key2) == ffd->ino) ) - { - *ret = (void *)the_node; - return 0; - } - } - the_node = the_node->next; - } - return -1; -} - -static int -fat_file_lseek( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 file_cln, - unsigned32 *disk_cln - ) -{ - int rc = RC_OK; -/* - assert(fat_fd->fat_file_size); - */ - if (file_cln == fat_fd->map.file_cln) - *disk_cln = fat_fd->map.disk_cln; - else - { - unsigned32 cur_cln; - unsigned32 count; - unsigned32 i; - - if (file_cln > fat_fd->map.file_cln) - { - cur_cln = fat_fd->map.disk_cln; - count = file_cln - fat_fd->map.file_cln; - } - else - { - cur_cln = fat_fd->cln; - count = file_cln; - } - - /* skip over the clusters */ - for (i = 0; i < count; i++) - { - rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln); - if ( rc != RC_OK ) - return rc; - } - - /* update cache */ - fat_fd->map.file_cln = file_cln; - fat_fd->map.disk_cln = cur_cln; - - *disk_cln = cur_cln; - } - return RC_OK; -} diff --git a/c/src/exec/libfs/src/dosfs/fat_file.h b/c/src/exec/libfs/src/dosfs/fat_file.h deleted file mode 100644 index 02baf3f1ef..0000000000 --- a/c/src/exec/libfs/src/dosfs/fat_file.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * fat_file.h - * - * Constants/data structures/prototypes for operations on "fat-file" - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 __DOSFS_FAT_FILE_H__ -#define __DOSFS_FAT_FILE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include - -/* "fat-file" representation - * - * the idea is: fat-file is nothing but a cluster chain, any open fat-file is - * represented in system by fat-file descriptor and has well-known - * file interface: - * - * fat_file_open() - * fat_file_close() - * fat_file_read() - * fat_file_write() - * - * Such interface hides the architecture of fat-file and represents it like - * linear file - */ - -typedef rtems_filesystem_node_types_t fat_file_type_t; - -#define FAT_DIRECTORY RTEMS_FILESYSTEM_DIRECTORY -#define FAT_FILE RTEMS_FILESYSTEM_MEMORY_FILE - -typedef struct fat_file_map_s -{ - unsigned32 file_cln; - unsigned32 disk_cln; - unsigned32 last_cln; -} fat_file_map_t; -/* - * descriptor of a fat-file - * - * To each particular clusters chain - */ -typedef struct fat_file_fd_s -{ - Chain_Node link; /* - * fat-file descriptors organized into hash; - * collision lists are handled via link - * field - */ - unsigned32 links_num; /* - * the number of fat_file_open call on - * this fat-file - */ - unsigned32 ino; /* inode, file serial number :)))) */ - fat_file_type_t fat_file_type; - unsigned32 size_limit; - unsigned32 fat_file_size; /* length */ - unsigned32 info_cln; - unsigned32 cln; - unsigned16 info_ofs; - unsigned char first_char; - unsigned8 flags; - fat_file_map_t map; - time_t mtime; - -} fat_file_fd_t; - - -#define FAT_FILE_REMOVED 0x01 - -#define FAT_FILE_IS_REMOVED(p)\ - (((p)->flags & FAT_FILE_REMOVED) ? 1 : 0) - -/* ioctl macros */ -#define F_CLU_NUM 0x01 - -/* - * Each file and directory on a MSDOS volume is unique identified by it - * location, i.e. location of it 32 Bytes Directory Entry Structure. We can - * distinguish them by cluster number it locates on and offset inside this - * cluster. But root directory on any volumes (FAT12/16/32) has no 32 Bytes - * Directory Entry Structure corresponded to it. So we assume 32 Bytes - * Directory Entry Structure of root directory locates at cluster 1 (invalid - * cluaster number) and offset 0 - */ -#define FAT_ROOTDIR_CLUSTER_NUM 0x01 - -#define FAT_FD_OF_ROOT_DIR(fat_fd) \ - ((fat_fd->info_cln == FAT_ROOTDIR_CLUSTER_NUM ) && \ - (fat_fd->info_ofs == 0)) - -#define FAT_EOF 0x00 - -/* fat_construct_key -- - * Construct key for hash access: convert (cluster num, offset) to - * (sector512 num, new offset) and than construct key as - * key = (sector512 num) << 4 | (new offset) - * - * PARAMETERS: - * cl - cluster number - * ofs - offset inside cluster 'cl' - * mt_entry - mount table entry - * - * RETURNS: - * constructed key - */ -static inline unsigned32 -fat_construct_key( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cl, - unsigned32 ofs) -{ - return ( ((fat_cluster_num_to_sector512_num(mt_entry, cl) + - (ofs >> FAT_SECTOR512_BITS)) << 4) + - ((ofs >> 5) & (FAT_DIRENTRIES_PER_SEC512 - 1)) ); -} - -/* Prototypes for "fat-file" operations */ -int -fat_file_open(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - unsigned32 ofs, - fat_file_fd_t **fat_fd); - -int -fat_file_reopen(fat_file_fd_t *fat_fd); - -int -fat_file_close(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd); - -ssize_t -fat_file_read(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 start, - unsigned32 count, - char *buf); - -ssize_t -fat_file_write(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 start, - unsigned32 count, - const char *buf); - -int -fat_file_extend(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 new_length, - unsigned32 *a_length); - -int -fat_file_truncate(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 new_length); - -int -fat_file_datasync(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd); - - -int -fat_file_ioctl(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - int cmd, - ...); - -int -fat_file_size(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd); - -void -fat_file_mark_removed(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd); - -#ifdef __cplusplus -} -#endif - -#endif /* __DOSFS_FAT_FILE_H__ */ diff --git a/c/src/exec/libfs/src/dosfs/msdos.h b/c/src/exec/libfs/src/dosfs/msdos.h deleted file mode 100644 index a9216b1ed3..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos.h +++ /dev/null @@ -1,408 +0,0 @@ -/* - * msdos.h - * - * The MSDOS filesystem constants/data structures/prototypes - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 __DOSFS_MSDOS_H__ -#define __DOSFS_MSDOS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include "fat.h" -#include "fat_file.h" - -#ifndef RC_OK -#define RC_OK 0x00000000 -#endif - -#define MSDOS_NAME_NOT_FOUND_ERR 0xDD000001 - -/* - * This structure identifies the instance of the filesystem on the MSDOS - * level. - */ -typedef struct msdos_fs_info_s -{ - fat_fs_info_t fat; /* - * volume - * description - */ - rtems_filesystem_file_handlers_r *directory_handlers; /* - * a set of routines - * that handles the - * nodes of directory - * type - */ - rtems_filesystem_file_handlers_r *file_handlers; /* - * a set of routines - * that handles the - * nodes of file - * type - */ - rtems_id vol_sema; /* - * semaphore - * associated with - * the volume - */ - unsigned8 *cl_buf; /* - * just placeholder - * for anything - */ -} msdos_fs_info_t; - -/* a set of routines that handle the nodes which are directories */ -extern rtems_filesystem_file_handlers_r msdos_dir_handlers; - -/* a set of routines that handle the nodes which are files */ -extern rtems_filesystem_file_handlers_r msdos_file_handlers; - -/* Volume semaphore timeout value */ -#define MSDOS_VOLUME_SEMAPHORE_TIMEOUT 100 - -/* Node types */ -#define MSDOS_DIRECTORY RTEMS_FILESYSTEM_DIRECTORY -#define MSDOS_REGULAR_FILE RTEMS_FILESYSTEM_MEMORY_FILE - -typedef rtems_filesystem_node_types_t msdos_node_type_t; - -/* - * Macros for fetching fields from 32 bytes long FAT Directory Entry - * Structure (see M$ White Paper) - */ -#define MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE 32 /* 32 bytes */ - -#define MSDOS_DIR_NAME(x) (unsigned8 *)((x) + 0) -#define MSDOS_DIR_ATTR(x) (unsigned8 *)((x) + 11) -#define MSDOS_DIR_NT_RES(x) (unsigned8 *)((x) + 12) -#define MSDOS_DIR_CRT_TIME_TENTH(x) (unsigned8 *)((x) + 13) -#define MSDOS_DIR_CRT_TIME(x) (unsigned16 *)((x) + 14) -#define MSDOS_DIR_CRT_DATE(x) (unsigned16 *)((x) + 16) -#define MSDOS_DIR_LAST_ACCESS_DATE(x) (unsigned16 *)((x) + 18) -#define MSDOS_DIR_FIRST_CLUSTER_HI(x) (unsigned16 *)((x) + 20) -#define MSDOS_DIR_WRITE_TIME(x) (unsigned16 *)((x) + 22) -#define MSDOS_DIR_WRITE_DATE(x) (unsigned16 *)((x) + 24) -#define MSDOS_DIR_FIRST_CLUSTER_LOW(x) (unsigned16 *)((x) + 26) -#define MSDOS_DIR_FILE_SIZE(x) (unsigned32 *)((x) + 28) - -#define MSDOS_EXTRACT_CLUSTER_NUM(p) \ - (unsigned32)( (CF_LE_W(*MSDOS_DIR_FIRST_CLUSTER_LOW(p))) | \ - ((CF_LE_W((*MSDOS_DIR_FIRST_CLUSTER_HI(p))))<<16) ) - -/* - * Fields offset in 32 bytes long FAT Directory Entry - * Structure (see M$ White Paper) - */ -#define MSDOS_FILE_SIZE_OFFSET 28 -#define MSDOS_FILE_NAME_OFFSET 0 -#define MSDOS_FIRST_CLUSTER_HI_OFFSET 20 -#define MSDOS_FIRST_CLUSTER_LOW_OFFSET 26 -#define MSDOS_FILE_WDATE_OFFSET 24 -#define MSDOS_FILE_WTIME_OFFSET 22 - -/* - * Possible values of DIR_Attr field of 32 bytes long FAT Directory Entry - * Structure (see M$ White Paper) - */ -#define MSDOS_ATTR_READ_ONLY 0x01 -#define MSDOS_ATTR_HIDDEN 0x02 -#define MSDOS_ATTR_SYSTEM 0x04 -#define MSDOS_ATTR_VOLUME_ID 0x08 -#define MSDOS_ATTR_DIRECTORY 0x10 -#define MSDOS_ATTR_ARCHIVE 0x20 - -/* - * Possible values of DIR_Name[0] field of 32 bytes long FAT Directory Entry - * Structure (see M$ White Paper) - */ -#define MSDOS_THIS_DIR_ENTRY_EMPTY 0xE5 -#define MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY 0x00 - - -/* - * Macros for names parsing and formatting - */ -#define msdos_is_valid_name_char(_ch) (1) -#define msdos_is_separator(_ch) rtems_filesystem_is_separator(_ch) - -#define MSDOS_SHORT_NAME_LEN 11 /* 11 characters */ -#define MSDOS_NAME_MAX MSDOS_SHORT_NAME_LEN -#define MSDOS_NAME_MAX_WITH_DOT (MSDOS_NAME_MAX + 1) - -#define MSDOS_DOT_NAME ". " /* ".", padded to MSDOS_NAME chars */ -#define MSDOS_DOTDOT_NAME ".. " /* "..", padded to MSDOS_NAME chars */ - -typedef enum msdos_token_types_e -{ - MSDOS_NO_MORE_PATH, - MSDOS_CURRENT_DIR, - MSDOS_UP_DIR, - MSDOS_NAME, - MSDOS_INVALID_TOKEN -} msdos_token_types_t; - -/* Others macros */ -#define MSDOS_RES_NT_VALUE 0x00 -#define MSDOS_INIT_DIR_SIZE 0x00 - -/* "dot" entry offset in a directory */ -#define MSDOS_DOT_DIR_ENTRY_OFFSET 0x00 /* first entry in directory */ - -/* "dotdot" entry offset in a directory */ -#define MSDOS_DOTDOT_DIR_ENTRY_OFFSET 0x20 /* second entry in directory */ - -/* 'p' should be char* */ -#define DOT_NODE_P(p) ((char *)(p)) -#define DOTDOT_NODE_P(p) ((char *)((p) + MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)) - -/* Size limits for files and directories (see M$ White Paper) */ -#define MSDOS_MAX_DIR_LENGHT 0x200000 /* 2,097,152 bytes */ -#define MSDOS_MAX_FILE_SIZE 0xFFFFFFFF /* 4 Gb */ - -/* - * The number of 32 bytes long FAT Directory Entry - * Structures per 512 bytes sector - */ -#define MSDOS_DPS512_NUM 16 - -/* Prototypes */ -int -msdos_initialize(rtems_filesystem_mount_table_entry_t *temp_mt_entry); - -int -msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry); - -int -msdos_eval_path(const char *pathname, /* IN */ - int flags, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */); - -int -msdos_eval4make(const char *path, /* IN */ - rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ - const char **name /* OUT */); - -int -msdos_unlink(rtems_filesystem_location_info_t *pathloc /* IN */); - -int -msdos_free_node_info(rtems_filesystem_location_info_t *pathloc /* IN */); - -rtems_filesystem_node_types_t -msdos_node_type(rtems_filesystem_location_info_t *pathloc); - -int -msdos_mknod(const char *path, /* IN */ - mode_t mode, /* IN */ - dev_t dev, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */); - -int -msdos_utime(rtems_filesystem_location_info_t *pathloc, /* IN */ - time_t actime, /* IN */ - time_t modtime /* IN */); - -int -msdos_initialize_support( - rtems_filesystem_mount_table_entry_t *temp_mt_entry, - rtems_filesystem_operations_table *op_table, - rtems_filesystem_file_handlers_r *file_handlers, - rtems_filesystem_file_handlers_r *directory_handlers -); - -int -msdos_file_open( - rtems_libio_t *iop, /* IN */ - const char *pathname, /* IN */ - unsigned32 flag, /* IN */ - unsigned32 mode /* IN */ -); - -int -msdos_file_close(rtems_libio_t *iop /* IN */); - -ssize_t -msdos_file_read( - rtems_libio_t *iop, /* IN */ - void *buffer, /* IN */ - unsigned32 count /* IN */ -); - -ssize_t -msdos_file_write( - rtems_libio_t *iop, /* IN */ - const void *buffer, /* IN */ - unsigned32 count /* IN */ -); - -int -msdos_file_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - -int -msdos_file_stat(rtems_filesystem_location_info_t *loc, /* IN */ - struct stat *buf /* OUT */); - -int -msdos_file_ftruncate( - rtems_libio_t *iop, /* IN */ - off_t length /* IN */ -); - -int -msdos_file_sync(rtems_libio_t *iop); - -int -msdos_file_datasync(rtems_libio_t *iop); - -int -msdos_file_ioctl( - rtems_libio_t *iop, /* IN */ - unsigned32 command, /* IN */ - void *buffer /* IN */ -); - -int -msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc /* IN */); - -int -msdos_dir_open( - rtems_libio_t *iop, /* IN */ - const char *pathname, /* IN */ - unsigned32 flag, /* IN */ - unsigned32 mode /* IN */ -); - -int -msdos_dir_close(rtems_libio_t *iop /* IN */); - -ssize_t -msdos_dir_read( - rtems_libio_t *iop, /* IN */ - void *buffer, /* IN */ - unsigned32 count /* IN */ -); - -int -msdos_dir_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - -int -msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc /* IN */); - -int -msdos_dir_sync(rtems_libio_t *iop); - -int -msdos_dir_stat( - rtems_filesystem_location_info_t *loc, /* IN */ - struct stat *buf /* OUT */ -); - -int -msdos_creat_node(rtems_filesystem_location_info_t *parent_loc, - msdos_node_type_t type, - char *name, - mode_t mode); - -/* Misc prototypes */ -msdos_token_types_t msdos_get_token(const char *path, - char *token, - int *token_len); - -int -msdos_find_name(rtems_filesystem_location_info_t *parent_loc, - char *name); - -int -msdos_get_name_node(rtems_filesystem_location_info_t *parent_loc, - char *name, - fat_auxiliary_t *paux, - char *name_dir_entry); - -int -msdos_dir_info_remove(rtems_filesystem_location_info_t *pathloc); - -void -msdos_date_unix2dos(int unix_date, - unsigned short *time_val, - unsigned short *date); - -unsigned int -msdos_date_dos2unix(unsigned short time_val, unsigned short date); - -int -msdos_set_first_cluster_num(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd); - -int -msdos_set_file_size(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd); - -int -msdos_set_first_char4file_name(rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cl, - unsigned32 ofs, - unsigned char first_char); - -int -msdos_set_dir_wrt_time_and_date( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd -); - - -int -msdos_dir_is_empty(rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - rtems_boolean *ret_val); - -int -msdos_find_name_in_fat_file( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - char *name, - fat_auxiliary_t *paux, - char *name_dir_entry); - -int -msdos_find_node_by_cluster_num_in_fat_file( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 cl4find, - fat_auxiliary_t *paux, - char *dir_entry -); - -int -msdos_get_dotdot_dir_info_cluster_num_and_offset( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - fat_auxiliary_t *paux, - char *dir_entry -); - -#ifdef __cplusplus -} -#endif - -#endif /* __DOSFS_MSDOS_H__ */ diff --git a/c/src/exec/libfs/src/dosfs/msdos_create.c b/c/src/exec/libfs/src/dosfs/msdos_create.c deleted file mode 100644 index 4b4c7001ca..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_create.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Routine to create a new MSDOS filesystem node - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* msdos_creat_node -- - * Create a new node. If a new node is file, FAT 32 Bytes Directory - * Entry Structure (see M$ White Paper) is initialized, free space is - * found in parent directory and structure is written to the disk. - * In case of directory, all above steps present and also new cluster - * is allocated for a new directory and dot and dotdot nodes are created - * in alloceted cluster. - * - * PARAMETERS: - * parent_loc - parent (directory we are going to create node in) - * type - new node type (file or directory) - * name - new node name - * mode - mode - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately). - * - */ -int -msdos_creat_node( - rtems_filesystem_location_info_t *parent_loc, - msdos_node_type_t type, - char *name, - mode_t mode - ) -{ - int rc = RC_OK; - ssize_t ret = 0; - msdos_fs_info_t *fs_info = parent_loc->mt_entry->fs_info; - fat_file_fd_t *parent_fat_fd = parent_loc->node_access; - fat_file_fd_t *fat_fd = NULL; - time_t time_ret = 0; - unsigned16 time_val = 0; - unsigned16 date = 0; - fat_auxiliary_t aux; - unsigned char new_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE]; - unsigned char dot_dotdot[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2]; - - memset(new_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE); - memset(dot_dotdot, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2); - - /* set up name */ - strncpy(MSDOS_DIR_NAME(new_node), name, MSDOS_NAME_MAX); - - /* fill reserved field */ - *MSDOS_DIR_NT_RES(new_node) = MSDOS_RES_NT_VALUE; - - /* set up last write date and time */ - time_ret = time(NULL); - if ( time_ret == -1 ) - return -1; - - msdos_date_unix2dos(time_ret, &time_val, &date); - *MSDOS_DIR_WRITE_TIME(new_node) = CT_LE_W(time_val); - *MSDOS_DIR_WRITE_DATE(new_node) = CT_LE_W(date); - - /* initialize directory/file size */ - *MSDOS_DIR_FILE_SIZE(new_node) = MSDOS_INIT_DIR_SIZE; - - if (type == MSDOS_DIRECTORY) - *MSDOS_DIR_ATTR(new_node) |= MSDOS_ATTR_DIRECTORY; - else - *MSDOS_DIR_ATTR(new_node) |= MSDOS_ATTR_ARCHIVE; - - /* - * find free space in the parent directory and write new initialized - * FAT 32 Bytes Directory Entry Structure (see M$ White Paper) - * to the disk - */ - rc = msdos_get_name_node(parent_loc, NULL, &aux, new_node); - if ( rc != RC_OK ) - return rc; - - /* - * if we create a new file we are done, if directory there are more steps - * to do - */ - if (type == MSDOS_DIRECTORY) - { - /* open new directory as fat-file */ - rc = fat_file_open(parent_loc->mt_entry, aux.cln, aux.ofs, &fat_fd); - if (rc != RC_OK) - goto err; - - /* - * we opened fat-file for node we just created, so initialize fat-file - * descritor - */ - fat_fd->info_cln = aux.cln; - fat_fd->info_ofs = aux.ofs; - fat_fd->fat_file_size = 0; - fat_fd->fat_file_type = FAT_DIRECTORY; - fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT; - - /* - * dot and dotdot entries are identical to new node except the - * names - */ - memcpy(DOT_NODE_P(dot_dotdot), new_node, - MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE); - memcpy(DOTDOT_NODE_P(dot_dotdot), new_node, - MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE); - memcpy(MSDOS_DIR_NAME(DOT_NODE_P(dot_dotdot)), MSDOS_DOT_NAME, - MSDOS_NAME_MAX); - memcpy(MSDOS_DIR_NAME(DOTDOT_NODE_P(dot_dotdot)), MSDOS_DOTDOT_NAME, - MSDOS_NAME_MAX); - - /* set up cluster num for dotdot entry */ - /* - * here we can ommit FAT32 condition because for all FAT types dirs - * right under root dir should contain 0 in dotdot entry but for - * FAT12/16 parent_fat_fd->cluster_num always contains such value - */ - if ((FAT_FD_OF_ROOT_DIR(parent_fat_fd)) && - (fs_info->fat.vol.type & FAT_FAT32)) - { - *MSDOS_DIR_FIRST_CLUSTER_LOW(DOTDOT_NODE_P(dot_dotdot)) = 0x0000; - *MSDOS_DIR_FIRST_CLUSTER_HI(DOTDOT_NODE_P(dot_dotdot)) = 0x0000; - } - else - { - *MSDOS_DIR_FIRST_CLUSTER_LOW(DOTDOT_NODE_P(dot_dotdot)) = - CT_LE_W((unsigned16)((parent_fat_fd->cln) & 0x0000FFFF)); - *MSDOS_DIR_FIRST_CLUSTER_HI(DOTDOT_NODE_P(dot_dotdot)) = - CT_LE_W((unsigned16)(((parent_fat_fd->cln) & 0xFFFF0000)>>16)); - } - - /* - * write dot and dotdot entries to new fat-file: currently fat-file - * correspondes to a new node is zero length, so it will be extended - * by one cluster and entries will be written - */ - ret = fat_file_write(parent_loc->mt_entry, fat_fd, 0, - MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2, - dot_dotdot); - if (ret < 0) - { - rc = -1; - goto error; - } - - /* increment fat-file size by cluster size */ - fat_fd->fat_file_size += fs_info->fat.vol.bpc; - - /* set up cluster num for dot entry */ - *MSDOS_DIR_FIRST_CLUSTER_LOW(DOT_NODE_P(dot_dotdot)) = - CT_LE_W((unsigned16)((fat_fd->cln) & 0x0000FFFF)); - *MSDOS_DIR_FIRST_CLUSTER_HI(DOT_NODE_P(dot_dotdot)) = - CT_LE_W((unsigned16)(((fat_fd->cln) & 0xFFFF0000) >> 16)); - - /* rewrite dot entry */ - ret = fat_file_write(parent_loc->mt_entry, fat_fd, 0, - MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE, - DOT_NODE_P(dot_dotdot)); - if (ret < 0) - { - rc = -1; - goto error; - } - - /* write first cluster num of a new directory to disk */ - rc = msdos_set_first_cluster_num(parent_loc->mt_entry, fat_fd); - if (rc != RC_OK) - goto error; - - fat_file_close(parent_loc->mt_entry, fat_fd); - } - return RC_OK; - -error: - fat_file_close(parent_loc->mt_entry, fat_fd); - -err: - /* mark 32bytes structure on the disk as free */ - msdos_set_first_char4file_name(parent_loc->mt_entry, aux.cln, aux.ofs, - 0xE5); - return rc; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_dir.c b/c/src/exec/libfs/src/dosfs/msdos_dir.c deleted file mode 100644 index 93449cd2fb..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_dir.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - * MSDOS directory handlers implementation - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* msdos_dir_open -- - * Open fat-file which correspondes to the directory being opened and - * set offset field of file control block to zero. - * - * PARAMETERS: - * iop - file control block - * pathname - name - * flag - flags - * mode - mode - * - * RETURNS: - * RC_OK, if directory opened successfully, or -1 if error occured (errno - * set apropriately) - */ -int -msdos_dir_open(rtems_libio_t *iop, const char *pathname, unsigned32 flag, - unsigned32 mode) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->file_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one( EIO ); - - rc = fat_file_reopen(fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - iop->offset = 0; - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} - -/* msdos_dir_close -- - * Close fat-file which correspondes to the directory being closed - * - * PARAMETERS: - * iop - file control block - * - * RETURNS: - * RC_OK, if directory closed successfully, or -1 if error occured (errno - * set apropriately. - */ -int -msdos_dir_close(rtems_libio_t *iop) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->file_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one( EIO ); - - rc = fat_file_close(iop->pathinfo.mt_entry, fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} - -/* msdos_dir_read -- - * This routine will read the next directory entry based on the directory - * offset. The offset should be equal to -n- time the size of an - * individual dirent structure. If n is not an integer multiple of the - * sizeof a dirent structure, an integer division will be performed to - * determine directory entry that will be returned in the buffer. Count - * should reflect -m- times the sizeof dirent bytes to be placed in the - * buffer. - * If there are not -m- dirent elements from the current directory - * position to the end of the exisiting file, the remaining entries will - * be placed in the buffer and the returned value will be equal to - * -m actual- times the size of a directory entry. - * - * PARAMETERS: - * iop - file control block - * buffer - buffer provided by user - * count - count of bytes to read - * - * RETURNS: - * the number of bytes read on success, or -1 if error occured (errno - * set apropriately). - */ -ssize_t -msdos_dir_read(rtems_libio_t *iop, void *buffer, unsigned32 count) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->file_info; - fat_file_fd_t *tmp_fat_fd = NULL; - struct dirent tmp_dirent; - unsigned32 start = 0; - ssize_t ret = 0; - unsigned32 cmpltd = 0; - unsigned32 j = 0, i = 0; - unsigned32 bts2rd = 0; - unsigned32 cur_cln = 0; - - /* - * cast start and count - protect against using sizes that are not exact - * multiples of the -dirent- size. These could result in unexpected - * results - */ - start = iop->offset / sizeof(struct dirent); - count = (count / sizeof(struct dirent)) * sizeof(struct dirent); - - /* - * optimization: we know that root directory for FAT12/16 volumes is - * sequential set of sectors and any cluster is sequential set of sectors - * too, so read such set of sectors is quick operation for low-level IO - * layer. - */ - bts2rd = (FAT_FD_OF_ROOT_DIR(fat_fd) && - (fs_info->fat.vol.type & (FAT_FAT12 | FAT_FAT16))) ? - fat_fd->fat_file_size : - fs_info->fat.vol.bpc; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - while (count > 0) - { - /* - * fat-file is already opened by open call, so read it - * Always read directory fat-file from the beggining because of MSDOS - * directories feature :( - we should count elements currently - * present in the directory because there may be holes :) - */ - ret = fat_file_read(iop->pathinfo.mt_entry, fat_fd, (j * bts2rd), - bts2rd, fs_info->cl_buf); - if (ret < MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE) - { - rtems_semaphore_release(fs_info->vol_sema); - set_errno_and_return_minus_one(EIO); - } - - for (i = 0; i < ret; i += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE) - { - if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) == - MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY) - { - rtems_semaphore_release(fs_info->vol_sema); - return cmpltd; - } - - if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) == - MSDOS_THIS_DIR_ENTRY_EMPTY) - continue; - - /* - * skip active entries until get the entry to start from - */ - if (start) - { - start--; - continue; - } - - /* - * Move the entry to the return buffer - * - * unfortunately there is no method to extract ino except to - * open fat-file descriptor :( ... so, open it - */ - - /* get number of cluster we are working with */ - rc = fat_file_ioctl(iop->pathinfo.mt_entry, fat_fd, F_CLU_NUM, - j * bts2rd, &cur_cln); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - rc = fat_file_open(iop->pathinfo.mt_entry, cur_cln, i, - &tmp_fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - tmp_fat_fd->info_cln = cur_cln; - tmp_fat_fd->info_ofs = i; - - /* fill in dirent structure */ - /* XXX: from what and in what d_off should be computed ?! */ - tmp_dirent.d_off = start + cmpltd; - tmp_dirent.d_reclen = sizeof(struct dirent); - tmp_dirent.d_ino = tmp_fat_fd->ino; - tmp_dirent.d_namlen = MSDOS_SHORT_NAME_LEN; - memcpy(tmp_dirent.d_name, MSDOS_DIR_NAME((fs_info->cl_buf + i)), - MSDOS_SHORT_NAME_LEN); - - /* d_name is null-terminated */ - tmp_dirent.d_name[MSDOS_SHORT_NAME_LEN] = 0; - memcpy(buffer + cmpltd, &tmp_dirent, sizeof(struct dirent)); - - iop->offset = iop->offset + sizeof(struct dirent); - cmpltd += (sizeof(struct dirent)); - count -= (sizeof(struct dirent)); - - /* inode number extracted, close fat-file */ - rc = fat_file_close(iop->pathinfo.mt_entry, tmp_fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - if (count <= 0) - break; - } - j++; - } - - rtems_semaphore_release(fs_info->vol_sema); - return cmpltd; -} - -/* msdos_dir_write -- - * no write for directory - */ - -/* msdos_dir_lseek -- - * - * This routine will behave in one of three ways based on the state of - * argument whence. Based on the state of its value the offset argument will - * be interpreted using one of the following methods: - * - * SEEK_SET - offset is the absolute byte offset from the start of the - * logical start of the dirent sequence that represents the - * directory - * SEEK_CUR - offset is used as the relative byte offset from the current - * directory position index held in the iop structure - * SEEK_END - N/A --> This will cause an assert. - * - * PARAMETERS: - * iop - file control block - * offset - offset - * whence - predefine directive - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno - * set apropriately). - */ -int -msdos_dir_lseek(rtems_libio_t *iop, off_t offset, int whence) -{ - switch (whence) - { - case SEEK_SET: - case SEEK_CUR: - break; - /* - * Movement past the end of the directory via lseek is not a - * permitted operation - */ - case SEEK_END: - default: - set_errno_and_return_minus_one( EINVAL ); - break; - } - return RC_OK; -} - -/* msdos_dir_stat -- - * - * This routine will obtain the following information concerning the current - * directory: - * st_dev device id - * st_ino node serial number :) - * st_mode mode extracted from the node - * st_size total size in bytes - * st_blksize blocksize for filesystem I/O - * st_blocks number of blocks allocated - * stat_mtime time of last modification - * - * PARAMETERS: - * loc - this directory - * buf - stat buffer provided by user - * - * RETURNS: - * RC_OK and filled stat buffer on success, or -1 if error occured (errno - * set apropriately). - */ -int -msdos_dir_stat( - rtems_filesystem_location_info_t *loc, - struct stat *buf - ) -{ - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = loc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = loc->node_access; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - buf->st_dev = fs_info->fat.vol.dev; - buf->st_ino = fat_fd->ino; - buf->st_mode = S_IFDIR; - buf->st_rdev = 0ll; - buf->st_size = fat_fd->fat_file_size; - buf->st_blocks = fat_fd->fat_file_size >> FAT_SECTOR512_BITS; - buf->st_blksize = fs_info->fat.vol.bps; - buf->st_mtime = fat_fd->mtime; - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} - -/* msdos_dir_truncate -- - * No truncate for directory. - * - * PARAMETERS: - * - * RETURNS: - * - */ - -/* msdos_dir_sync -- - * The following routine does a syncronization on a MSDOS directory node. - * DIR_WrtTime, DIR_WrtDate and DIR_fileSize fields of 32 Bytes Directory - * Entry Structure(see M$ White Paper) should not be updated for - * directories, so only call to corresponding fat-file routine. - * - * PARAMETERS: - * iop - file control block - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set apropriately). - */ -int -msdos_dir_sync(rtems_libio_t *iop) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - fat_file_fd_t *fat_fd = iop->file_info; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - rc = fat_file_datasync(iop->pathinfo.mt_entry, fat_fd); - - rtems_semaphore_release(fs_info->vol_sema); - return rc; -} - -/* msdos_dir_rmnod -- - * Remove directory node. - * - * Check that this directory node is not opened as fat-file, is empty and - * not filesystem root node. If all this conditions met then delete. - * - * PARAMETERS: - * pathloc - node description - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set apropriately). - */ -int -msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = pathloc->node_access; - rtems_boolean is_empty = FALSE; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - /* - * We deny attemp to delete open directory (if directory is current - * directory we assume it is open one) - */ - if (fat_fd->links_num > 1) - { - rtems_semaphore_release(fs_info->vol_sema); - set_errno_and_return_minus_one(EBUSY); - } - - /* - * You cannot remove a node that still has children - */ - rc = msdos_dir_is_empty(pathloc->mt_entry, fat_fd, &is_empty); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - if (!is_empty) - { - rtems_semaphore_release(fs_info->vol_sema); - set_errno_and_return_minus_one(ENOTEMPTY); - } - - /* - * You cannot remove the file system root node. - */ - if (pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access) - { - rtems_semaphore_release(fs_info->vol_sema); - set_errno_and_return_minus_one(EBUSY); - } - - /* - * You cannot remove a mountpoint. - * not used - mount() not implemenetd yet. - */ - - /* mark file removed */ - rc = msdos_set_first_char4file_name(pathloc->mt_entry, fat_fd->info_cln, - fat_fd->info_ofs, - MSDOS_THIS_DIR_ENTRY_EMPTY); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - fat_file_mark_removed(pathloc->mt_entry, fat_fd); - - rtems_semaphore_release(fs_info->vol_sema); - return rc; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_eval.c b/c/src/exec/libfs/src/dosfs/msdos_eval.c deleted file mode 100644 index 3eba0e63e8..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_eval.c +++ /dev/null @@ -1,435 +0,0 @@ -/* - * MSDOS evaluation routines - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* msdos_set_handlers -- - * Set handlers for the node with specified type(i.e. handlers for file - * or directory). - * - * PARAMETERS: - * loc - node description - * - * RETURNS: - * None - */ -static void -msdos_set_handlers(rtems_filesystem_location_info_t *loc) -{ - msdos_fs_info_t *fs_info = loc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = loc->node_access; - - if (fat_fd->fat_file_type == FAT_DIRECTORY) - loc->handlers = fs_info->directory_handlers; - else - loc->handlers = fs_info->file_handlers; -} - -/* msdos_eval_path -- - * - * The following routine evaluate path for a node that wishes to be - * accessed. Structure 'pathloc' is returned with a pointer to the - * node to be accessed. - * - * PARAMETERS: - * pathname - path for evaluation - * flags - flags - * pathloc - node description (IN/OUT) - * - * RETURNS: - * RC_OK and filled pathloc on success, or -1 if error occured - * (errno set appropriately) - * - */ -int -msdos_eval_path( - const char *pathname, - int flags, - rtems_filesystem_location_info_t *pathloc - ) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = NULL; - rtems_filesystem_location_info_t newloc; - int i = 0; - int len = 0; - msdos_token_types_t type = MSDOS_CURRENT_DIR; - char token[MSDOS_NAME_MAX + 1]; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - if (!pathloc->node_access) - { - errno = ENOENT; - rc = -1; - goto err; - } - - fat_fd = pathloc->node_access; - - rc = fat_file_reopen(fat_fd); - if (rc != RC_OK) - goto err; - - while ((type != MSDOS_NO_MORE_PATH) && (type != MSDOS_INVALID_TOKEN)) - { - type = msdos_get_token(&pathname[i], token, &len); - i += len; - - fat_fd = pathloc->node_access; - - switch (type) - { - case MSDOS_UP_DIR: - /* - * Only a directory can be decended into. - */ - if (fat_fd->fat_file_type != FAT_DIRECTORY) - { - errno = ENOTDIR; - rc = -1; - goto error; - } - - /* - * Am I at the root of this mounted filesystem? - */ - if (pathloc->node_access == - pathloc->mt_entry->mt_fs_root.node_access) - { - /* - * Am I at the root of all filesystems? - * XXX: MSDOS is not supposed to be base fs. - */ - if (pathloc->node_access == - rtems_filesystem_root.node_access) - { - break; /* Throw out the .. in this case */ - } - else - { - newloc = pathloc->mt_entry->mt_point_node; - *pathloc = newloc; - - rc = fat_file_close(pathloc->mt_entry, fat_fd); - if (rc != RC_OK) - goto err; - - rtems_semaphore_release(fs_info->vol_sema); - return (*pathloc->ops->evalpath_h)(&(pathname[i-len]), - flags, pathloc); - } - } - else - { - rc = msdos_find_name(pathloc, token); - if (rc != RC_OK) - { - if (rc == MSDOS_NAME_NOT_FOUND_ERR) - { - errno = ENOENT; - rc = -1; - } - goto error; - } - } - break; - - case MSDOS_NAME: - /* - * Only a directory can be decended into. - */ - if (fat_fd->fat_file_type != FAT_DIRECTORY) - { - errno = ENOTDIR; - rc = -1; - goto error; - } - - /* - * Otherwise find the token name in the present location and - * set the node access to the point we have found. - */ - rc = msdos_find_name(pathloc, token); - if (rc != RC_OK) - { - if (rc == MSDOS_NAME_NOT_FOUND_ERR) - { - errno = ENOENT; - rc = -1; - } - goto error; - } - break; - - case MSDOS_NO_MORE_PATH: - case MSDOS_CURRENT_DIR: - break; - - case MSDOS_INVALID_TOKEN: - errno = ENAMETOOLONG; - rc = -1; - goto error; - break; - - } - } - - /* - * Always return the root node. - * - * If we are at a node that is a mount point. Set loc to the - * new fs root node and let let the mounted filesystem set the handlers. - * - * NOTE: The behavior of stat() on a mount point appears to be - * questionable. - * NOTE: MSDOS filesystem currently doesn't support mount functionality -> - * action not implemented - */ - fat_fd = pathloc->node_access; - - msdos_set_handlers(pathloc); - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; - -error: - fat_file_close(pathloc->mt_entry, fat_fd); - -err: - rtems_semaphore_release(fs_info->vol_sema); - return rc; -} - -/* msdos_eval4make -- - * The following routine evaluate path for a new node to be created. - * 'pathloc' is returned with a pointer to the parent of the new node. - * 'name' is returned with a pointer to the first character in the - * new node name. The parent node is verified to be a directory. - * - * PARAMETERS: - * path - path for evaluation - * pathloc - IN/OUT (start point for evaluation/parent directory for - * creation) - * name - new node name - * - * RETURNS: - * RC_OK, filled pathloc for parent directory and name of new node on - * success, or -1 if error occured (errno set appropriately) - */ -int -msdos_eval4make( - const char *path, - rtems_filesystem_location_info_t *pathloc, - const char **name - ) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = NULL; - rtems_filesystem_location_info_t newloc; - msdos_token_types_t type; - int i = 0; - int len; - char token[ MSDOS_NAME_MAX + 1 ]; - rtems_boolean done = 0; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - if (!pathloc->node_access) - { - errno = ENOENT; - rc = -1; - goto err; - } - - fat_fd = pathloc->node_access; - - rc = fat_file_reopen(fat_fd); - if (rc != RC_OK) - goto err; - - while (!done) - { - type = msdos_get_token(&path[i], token, &len); - i += len; - fat_fd = pathloc->node_access; - - switch (type) - { - case MSDOS_UP_DIR: - /* - * Only a directory can be decended into. - */ - if (fat_fd->fat_file_type != FAT_DIRECTORY) - { - errno = ENOTDIR; - rc = -1; - goto error; - } - - /* - * Am I at the root of this mounted filesystem? - */ - if (pathloc->node_access == - pathloc->mt_entry->mt_fs_root.node_access) - { - /* - * Am I at the root of all filesystems? - * XXX: MSDOS is not supposed to be base fs. - */ - if (pathloc->node_access == - rtems_filesystem_root.node_access) - { - break; /* Throw out the .. in this case */ - } - else - { - newloc = pathloc->mt_entry->mt_point_node; - *pathloc = newloc; - - rc = fat_file_close(pathloc->mt_entry, fat_fd); - if (rc != RC_OK) - goto err; - - rtems_semaphore_release(fs_info->vol_sema); - return (*pathloc->ops->evalformake_h)(&path[i-len], - pathloc, name); - } - } - else - { - rc = msdos_find_name(pathloc, token); - if (rc != RC_OK) - { - if (rc == MSDOS_NAME_NOT_FOUND_ERR) - { - errno = ENOENT; - rc = -1; - } - goto error; - } - } - break; - - case MSDOS_NAME: - /* - * Only a directory can be decended into. - */ - if (fat_fd->fat_file_type != FAT_DIRECTORY) - { - errno = ENOTDIR; - rc = -1; - goto error; - } - - /* - * Otherwise find the token name in the present location and - * set the node access to the point we have found. - */ - rc = msdos_find_name(pathloc, token); - if (rc) - { - if (rc != MSDOS_NAME_NOT_FOUND_ERR) - { - errno = ENOENT; - rc = -1; - goto error; - } - else - done = TRUE; - } - break; - - case MSDOS_NO_MORE_PATH: - errno = EEXIST; - rc = -1; - goto error; - break; - - case MSDOS_CURRENT_DIR: - break; - - case MSDOS_INVALID_TOKEN: - errno = ENAMETOOLONG; - rc = -1; - goto error; - break; - - } - } - - *name = &path[i - len]; - - /* - * We have evaluated the path as far as we can. - * Verify there is not any invalid stuff at the end of the name. - */ - for( ; path[i] != '\0'; i++) - { - if (!msdos_is_separator(path[i])) - { - errno = ENOENT; - rc = -1; - goto error; - } - } - - fat_fd = pathloc->node_access; - - if (fat_fd->fat_file_type != FAT_DIRECTORY) - { - errno = ENOTDIR; - rc = -1; - goto error; - } - - msdos_set_handlers(pathloc); - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; - -error: - fat_file_close(pathloc->mt_entry, fat_fd); - -err: - rtems_semaphore_release(fs_info->vol_sema); - return rc; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_file.c b/c/src/exec/libfs/src/dosfs/msdos_file.c deleted file mode 100644 index da36827338..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_file.c +++ /dev/null @@ -1,485 +0,0 @@ -/* - * MSDOS file handlers implementation - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* msdos_file_open -- - * Open fat-file which correspondes to the file - * - * PARAMETERS: - * iop - file control block - * pathname - name - * flag - flags - * mode - mode - * - * RETURNS: - * RC_OK, if file opened successfully, or -1 if error occured - * and errno set appropriately - */ -int -msdos_file_open(rtems_libio_t *iop, const char *pathname, unsigned32 flag, - unsigned32 mode) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->file_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - rc = fat_file_reopen(fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - if (iop->flags & LIBIO_FLAGS_APPEND) - iop->offset = fat_fd->fat_file_size; - - iop->size = fat_fd->fat_file_size; - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} - -/* msdos_file_close -- - * Close fat-file which correspondes to the file. If fat-file descriptor - * which correspondes to the file is not marked "removed", synchronize - * size, first cluster number, write time and date fields of the file. - * - * PARAMETERS: - * iop - file control block - * - * RETURNS: - * RC_OK, if file closed successfully, or -1 if error occured (errno set - * appropriately) - */ -int -msdos_file_close(rtems_libio_t *iop) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->file_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - /* - * if fat-file descriptor is not marked as "removed", synchronize - * size, first cluster number, write time and date fields of the file - */ - if (!FAT_FILE_IS_REMOVED(fat_fd)) - { - rc = msdos_set_first_cluster_num(iop->pathinfo.mt_entry, fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - rc = msdos_set_file_size(iop->pathinfo.mt_entry, fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - rc = msdos_set_dir_wrt_time_and_date(iop->pathinfo.mt_entry, fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - } - - rc = fat_file_close(iop->pathinfo.mt_entry, fat_fd); - - rtems_semaphore_release(fs_info->vol_sema); - return rc; -} - -/* msdos_file_read -- - * This routine read from file pointed to by file control block into - * the specified data buffer provided by user - * - * PARAMETERS: - * iop - file control block - * buffer - buffer provided by user - * count - the number of bytes to read - * - * RETURNS: - * the number of bytes read on success, or -1 if error occured (errno set - * appropriately) - */ -ssize_t -msdos_file_read(rtems_libio_t *iop, void *buffer, unsigned32 count) -{ - ssize_t ret = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->file_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - ret = fat_file_read(iop->pathinfo.mt_entry, fat_fd, iop->offset, count, - buffer); - - rtems_semaphore_release(fs_info->vol_sema); - return ret; -} - -/* msdos_file_write -- - * This routine writes the specified data buffer into the file pointed to - * by file control block. - * - * PARAMETERS: - * iop - file control block - * buffer - data to write - * count - count of bytes to write - * - * RETURNS: - * the number of bytes written on success, or -1 if error occured - * and errno set appropriately - */ -ssize_t -msdos_file_write(rtems_libio_t *iop,const void *buffer, unsigned32 count) -{ - ssize_t ret = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->file_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - ret = fat_file_write(iop->pathinfo.mt_entry, fat_fd, iop->offset, count, - buffer); - if (ret < 0) - { - rtems_semaphore_release(fs_info->vol_sema); - return -1; - } - - /* - * update file size in both fat-file descriptor and file control block if - * file was extended - */ - if (iop->offset + ret > fat_fd->fat_file_size) - fat_fd->fat_file_size = iop->offset + ret; - - iop->size = fat_fd->fat_file_size; - - rtems_semaphore_release(fs_info->vol_sema); - return ret; -} - -/* msdos_file_lseek -- - * Process lseek call to the file: extend file if lseek is up to the end - * of the file. - * - * PARAMETERS: - * iop - file control block - * offset - new offset - * whence - predefine directive - * - * RETURNS: - * new offset on success, or -1 if error occured (errno set - * appropriately). - */ -int -msdos_file_lseek(rtems_libio_t *iop, off_t offset, int whence) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->file_info; - unsigned32 real_size = 0; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - rc = fat_file_extend(iop->pathinfo.mt_entry, fat_fd, iop->offset, - &real_size); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - if (real_size > fat_fd->fat_file_size) - fat_fd->fat_file_size = iop->offset = real_size; - - iop->size = fat_fd->fat_file_size; - - rtems_semaphore_release(fs_info->vol_sema); - return iop->offset; -} - -/* msdos_file_stat -- - * - * PARAMETERS: - * loc - node description - * buf - stat buffer provided by user - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -msdos_file_stat( - rtems_filesystem_location_info_t *loc, - struct stat *buf - ) -{ - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = loc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = loc->node_access; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - buf->st_dev = fs_info->fat.vol.dev; - buf->st_ino = fat_fd->ino; - buf->st_mode = S_IFREG; - buf->st_rdev = 0ll; - buf->st_size = fat_fd->fat_file_size; - buf->st_blocks = fat_fd->fat_file_size >> FAT_SECTOR512_BITS; - buf->st_blksize = fs_info->fat.vol.bps; - buf->st_mtime = fat_fd->mtime; - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} - -/* msdos_file_ftruncate -- - * Truncate the file (if new length is greater then current do nothing). - * - * PARAMETERS: - * iop - file control block - * length - new length - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately). - */ -int -msdos_file_ftruncate(rtems_libio_t *iop, off_t length) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - fat_file_fd_t *fat_fd = iop->file_info; - - if (length >= fat_fd->fat_file_size) - return RC_OK; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - rc = fat_file_truncate(iop->pathinfo.mt_entry, fat_fd, length); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - /* - * fat_file_truncate do nothing if new length >= fat-file size, so update - * file size only if length < fat-file size - */ - if (length < fat_fd->fat_file_size) - iop->size = fat_fd->fat_file_size = length; - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} - -/* msdos_file_sync -- - * Synchronize file - synchronize file data and if file is not removed - * synchronize file metadata. - * - * PARAMETERS: - * iop - file control block - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -msdos_file_sync(rtems_libio_t *iop) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - fat_file_fd_t *fat_fd = iop->file_info; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - /* synchronize file data */ - rc = fat_file_datasync(iop->pathinfo.mt_entry, fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - /* - * if fat-file descriptor is not marked "removed" - synchronize file - * metadata - */ - if (!FAT_FILE_IS_REMOVED(fat_fd)) - { - rc = msdos_set_first_cluster_num(iop->pathinfo.mt_entry, fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - rc = msdos_set_file_size(iop->pathinfo.mt_entry, fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - rc = msdos_set_dir_wrt_time_and_date(iop->pathinfo.mt_entry, fat_fd); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - } - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} - -/* msdos_file_datasync -- - * Synchronize file - synchronize only file data (metadata is letf intact). - * - * PARAMETERS: - * iop - file control block - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -msdos_file_datasync(rtems_libio_t *iop) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - fat_file_fd_t *fat_fd = iop->file_info; - msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - /* synchronize file data */ - rc = fat_file_datasync(iop->pathinfo.mt_entry, fat_fd); - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} - - -/* msdos_file_ioctl -- - * - * - * PARAMETERS: - * iop - file control block - * ... - * - * RETURNS: - * - */ -int -msdos_file_ioctl(rtems_libio_t *iop,unsigned32 command, void *buffer) -{ - int rc = RC_OK; - - return rc; -} - -/* msdos_file_rmnod -- - * Remove node associated with a file - set up first name character to - * predefined value(and write it to the disk), and mark fat-file which - * correspondes to the file as "removed" - * - * PARAMETERS: - * pathloc - node description - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = pathloc->node_access; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - /* mark file removed */ - rc = msdos_set_first_char4file_name(pathloc->mt_entry, fat_fd->info_cln, - fat_fd->info_ofs, - MSDOS_THIS_DIR_ENTRY_EMPTY); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - fat_file_mark_removed(pathloc->mt_entry, fat_fd); - - rtems_semaphore_release(fs_info->vol_sema); - return RC_OK; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_free.c b/c/src/exec/libfs/src/dosfs/msdos_free.c deleted file mode 100644 index c0d5938dbb..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_free.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Free node handler implementation for the filesystem - * operations table. - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* msdos_free_node_info -- - * Call fat-file close routine. - * - * PARAMETERS: - * pathloc - node description - * - * RETURNS: - * RC_OK on success, or -1 code if error occured - * - */ -int -msdos_free_node_info(rtems_filesystem_location_info_t *pathloc) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - rc = fat_file_close(pathloc->mt_entry, pathloc->node_access); - - rtems_semaphore_release(fs_info->vol_sema); - return rc; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_fsunmount.c b/c/src/exec/libfs/src/dosfs/msdos_fsunmount.c deleted file mode 100644 index 9072a2fad5..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_fsunmount.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * MSDOS shut down handler implementation - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* msdos_shut_down -- - * Shut down MSDOS filesystem - free all allocated resources (don't - * return if deallocation of some resource failed - free as much as - * possible). - * - * PARAMETERS: - * temp_mt_entry - mount table entry - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set apropriately). - * - */ -int -msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry) -{ - int rc = RC_OK; - msdos_fs_info_t *fs_info = temp_mt_entry->fs_info; - fat_file_fd_t *fat_fd = temp_mt_entry->mt_fs_root.node_access; - - /* close fat-file which correspondes to root directory */ - if (fat_file_close(temp_mt_entry, fat_fd) != RC_OK) - { - /* no return - try to free as much as possible */ - rc = -1; - } - - if (fat_shutdown_drive(temp_mt_entry) != RC_OK) - { - /* no return - try to free as much as possible */ - rc = -1; - } - - rtems_semaphore_delete(fs_info->vol_sema); - free(fs_info->cl_buf); - free(temp_mt_entry->fs_info); - - return rc; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_handlers_dir.c b/c/src/exec/libfs/src/dosfs/msdos_handlers_dir.c deleted file mode 100644 index e14d892add..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_handlers_dir.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Directory Handlers Table for MSDOS filesystem - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "msdos.h" - -rtems_filesystem_file_handlers_r msdos_dir_handlers = { - msdos_dir_open, - msdos_dir_close, - msdos_dir_read, - NULL, /* msdos_dir_write */ - NULL, /* msdos_dir_ioctl */ - msdos_dir_lseek, - msdos_dir_stat, - NULL, - NULL, /* msdos_dir_ftruncate */ - NULL, - msdos_dir_sync, - msdos_dir_sync, - NULL, /* msdos_dir_fcntl */ - msdos_dir_rmnod -}; diff --git a/c/src/exec/libfs/src/dosfs/msdos_handlers_file.c b/c/src/exec/libfs/src/dosfs/msdos_handlers_file.c deleted file mode 100644 index ae627066de..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_handlers_file.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * File Operations Table for MSDOS filesystem - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "msdos.h" - -rtems_filesystem_file_handlers_r msdos_file_handlers = { - msdos_file_open, - msdos_file_close, - msdos_file_read, - msdos_file_write, - msdos_file_ioctl, - msdos_file_lseek, - msdos_file_stat, - NULL, - msdos_file_ftruncate, - NULL, - msdos_file_sync, - msdos_file_datasync, - NULL, /* msdos_file_fcntl */ - msdos_file_rmnod -}; diff --git a/c/src/exec/libfs/src/dosfs/msdos_init.c b/c/src/exec/libfs/src/dosfs/msdos_init.c deleted file mode 100644 index 2d5bf6c9e0..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_init.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Init routine for MSDOS - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "msdos.h" - -rtems_filesystem_operations_table msdos_ops = { - msdos_eval_path, - msdos_eval4make, - NULL, /* msdos_link */ - msdos_file_rmnod, - msdos_node_type, - msdos_mknod, - NULL, /* msdos_chown */ - msdos_free_node_info, - NULL, - msdos_initialize, - NULL, - msdos_shut_down, /* msdos_shut_down */ - NULL, /* msdos_utime */ - NULL, - NULL, - NULL -}; - -/* msdos_initialize -- - * MSDOS filesystem initialization - * - * PARAMETERS: - * temp_mt_entry - mount table entry - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set apropriately). - * - */ -int -msdos_initialize(rtems_filesystem_mount_table_entry_t *temp_mt_entry) -{ - int rc = RC_OK; - - rc = msdos_initialize_support(temp_mt_entry, - &msdos_ops, - &msdos_file_handlers, - &msdos_dir_handlers); - return rc; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_initsupp.c b/c/src/exec/libfs/src/dosfs/msdos_initsupp.c deleted file mode 100644 index eee8a6f9b2..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_initsupp.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * MSDOS Initialization support routine implementation - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* msdos_initialize_support -- - * MSDOS filesystem initialization - * - * PARAMETERS: - * temp_mt_entry - mount table entry - * op_table - filesystem operations table - * file_handlers - file operations table - * directory_handlers - directory operations table - * - * RETURNS: - * RC_OK and filled temp_mt_entry on success, or -1 if error occured - * (errno set apropriately) - * - */ -int -msdos_initialize_support( - rtems_filesystem_mount_table_entry_t *temp_mt_entry, - rtems_filesystem_operations_table *op_table, - rtems_filesystem_file_handlers_r *file_handlers, - rtems_filesystem_file_handlers_r *directory_handlers - ) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = NULL; - fat_file_fd_t *fat_fd = NULL; - unsigned32 cl_buf_size; - - fs_info = (msdos_fs_info_t *)calloc(1, sizeof(msdos_fs_info_t)); - if (!fs_info) - set_errno_and_return_minus_one(ENOMEM); - - temp_mt_entry->fs_info = fs_info; - - rc = fat_init_volume_info(temp_mt_entry); - if (rc != RC_OK) - { - free(fs_info); - return rc; - } - - fs_info->file_handlers = file_handlers; - fs_info->directory_handlers = directory_handlers; - - /* - * open fat-file which correspondes to root directory - * (so inode number 0x00000010 is always used for root directory) - */ - rc = fat_file_open(temp_mt_entry, FAT_ROOTDIR_CLUSTER_NUM, 0, &fat_fd); - if (rc != RC_OK) - { - fat_shutdown_drive(temp_mt_entry); - free(fs_info); - return rc; - } - - /* again: unfortunately "fat-file" is just almost fat file :( */ - fat_fd->fat_file_type = FAT_DIRECTORY; - fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT; - fat_fd->info_cln = FAT_ROOTDIR_CLUSTER_NUM; - fat_fd->info_ofs = 0; - fat_fd->cln = fs_info->fat.vol.rdir_cl; - - fat_fd->map.file_cln = 0; - fat_fd->map.disk_cln = fat_fd->cln; - - /* if we have FAT12/16 */ - if ( fat_fd->cln == 0 ) - { - fat_fd->fat_file_size = fs_info->fat.vol.rdir_size; - cl_buf_size = (fs_info->fat.vol.bpc > fs_info->fat.vol.rdir_size) ? - fs_info->fat.vol.bpc : - fs_info->fat.vol.rdir_size; - } - else - { - rc = fat_file_size(temp_mt_entry, fat_fd); - if ( rc != RC_OK ) - { - fat_file_close(temp_mt_entry, fat_fd); - fat_shutdown_drive(temp_mt_entry); - free(fs_info); - return rc; - } - cl_buf_size = fs_info->fat.vol.bpc; - } - - fs_info->cl_buf = (char *)calloc(cl_buf_size, sizeof(char)); - if (fs_info->cl_buf == NULL) - { - fat_file_close(temp_mt_entry, fat_fd); - fat_shutdown_drive(temp_mt_entry); - free(fs_info); - set_errno_and_return_minus_one(ENOMEM); - } - - sc = rtems_semaphore_create(3, - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO, - RTEMS_INHERIT_PRIORITY, - &fs_info->vol_sema); - if (sc != RTEMS_SUCCESSFUL) - { - fat_file_close(temp_mt_entry, fat_fd); - fat_shutdown_drive(temp_mt_entry); - free(fs_info->cl_buf); - free(fs_info); - set_errno_and_return_minus_one( EIO ); - } - - temp_mt_entry->mt_fs_root.node_access = fat_fd; - temp_mt_entry->mt_fs_root.handlers = directory_handlers; - temp_mt_entry->mt_fs_root.ops = op_table; - - return rc; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_misc.c b/c/src/exec/libfs/src/dosfs/msdos_misc.c deleted file mode 100644 index fe2779f7a8..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_misc.c +++ /dev/null @@ -1,1087 +0,0 @@ -/* - * Miscellaneous routines implementation for MSDOS filesystem - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* This copied from Linux */ -static int day_n[] = { 0,31,59,90,120,151,181,212,243,273,304,334,0,0,0,0 }; - /* JanFebMarApr May Jun Jul Aug Sep Oct Nov Dec */ - -#undef CONFIG_ATARI - -/* MS-DOS "device special files" */ -static const char *reserved_names[] = { -#ifndef CONFIG_ATARI /* GEMDOS is less stupid */ - "CON ","PRN ","NUL ","AUX ", - "LPT1 ","LPT2 ","LPT3 ","LPT4 ", - "COM1 ","COM2 ","COM3 ","COM4 ", -#endif - NULL }; - -static char bad_chars[] = "*?<>|\""; -#ifdef CONFIG_ATARI -/* GEMDOS is less restrictive */ -static char bad_if_strict[] = " "; -#else -static char bad_if_strict[] = "+=,; "; -#endif - -/* The following three functions copied from Linux */ -/* - * Formats an MS-DOS file name. Rejects invalid names - * - * conv is relaxed/normal/strict, name is proposed name, - * len is the length of the proposed name, res is the result name, - * dotsOK is if hidden files get dots. - */ -int -msdos_format_name(char conv, const char *name, int len, char *res, - char dotsOK) -{ - char *walk; - const char **reserved; - unsigned char c; - int space; - if (name[0] == '.') { /* dotfile because . and .. already done */ - if (!dotsOK) return -EINVAL; - /* Get rid of dot - test for it elsewhere */ - name++; len--; - } -#ifndef CONFIG_ATARI - space = 1; /* disallow names that _really_ start with a dot */ -#else - space = 0; /* GEMDOS does not care */ -#endif - c = 0; - for (walk = res; len && walk-res < 8; walk++) { - c = *name++; - len--; - if (conv != 'r' && strchr(bad_chars,c)) return -EINVAL; - if (conv == 's' && strchr(bad_if_strict,c)) return -EINVAL; - if (c >= 'A' && c <= 'Z' && conv == 's') return -EINVAL; - if (c < ' ' || c == ':' || c == '\\') return -EINVAL; -/* 0xE5 is legal as a first character, but we must substitute 0x05 */ -/* because 0xE5 marks deleted files. Yes, DOS really does this. */ -/* It seems that Microsoft hacked DOS to support non-US characters */ -/* after the 0xE5 character was already in use to mark deleted files. */ - if((res==walk) && (c==0xE5)) c=0x05; - if (c == '.') break; - space = (c == ' '); - *walk = (c >= 'a' && c <= 'z') ? c-32 : c; - } - if (space) return -EINVAL; - if (conv == 's' && len && c != '.') { - c = *name++; - len--; - if (c != '.') return -EINVAL; - } - while (c != '.' && len--) c = *name++; - if (c == '.') { - while (walk-res < 8) *walk++ = ' '; - while (len > 0 && walk-res < MSDOS_NAME_MAX) { - c = *name++; - len--; - if (conv != 'r' && strchr(bad_chars,c)) return -EINVAL; - if (conv == 's' && strchr(bad_if_strict,c)) - return -EINVAL; - if (c < ' ' || c == ':' || c == '\\') - return -EINVAL; - if (c == '.') { - if (conv == 's') - return -EINVAL; - break; - } - if (c >= 'A' && c <= 'Z' && conv == 's') return -EINVAL; - space = c == ' '; - *walk++ = c >= 'a' && c <= 'z' ? c-32 : c; - } - if (space) return -EINVAL; - if (conv == 's' && len) return -EINVAL; - } - while (walk-res < MSDOS_NAME_MAX) *walk++ = ' '; - for (reserved = reserved_names; *reserved; reserved++) - if (!strncmp(res,*reserved,8)) return -EINVAL; - return 0; -} - -/* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70) */ -unsigned int -msdos_date_dos2unix(unsigned short time_val,unsigned short date) -{ - int month,year,secs; - - month = ((date >> 5) & 15)-1; - year = date >> 9; - secs = (time_val & 31)*2+60*((time_val >> 5) & 63)+ - (time_val >> 11)*3600+86400* - ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 && - month < 2 ? 1 : 0)+3653); - /* days since 1.1.70 plus 80's leap day */ - - return secs; -} - - -/* Convert linear UNIX date to a MS-DOS time/date pair */ -void msdos_date_unix2dos(int unix_date, - unsigned short *time_val, - unsigned short *date) -{ - int day,year,nl_day,month; - - *time_val = (unix_date % 60)/2+(((unix_date/60) % 60) << 5)+ - (((unix_date/3600) % 24) << 11); - day = unix_date/86400-3652; - year = day/365; - if ((year+3)/4+365*year > day) year--; - day -= (year+3)/4+365*year; - if (day == 59 && !(year & 3)) { - nl_day = day; - month = 2; - } - else { - nl_day = (year & 3) || day <= 59 ? day : day-1; - for (month = 0; month < 12; month++) - if (day_n[month] > nl_day) break; - } - *date = nl_day-day_n[month-1]+1+(month << 5)+(year << 9); -} - - -/* msdos_get_token -- - * Routine to get a token (name or separator) from the path. - * - * PARAMETERS: - * path - path to get token from - * ret_token - returned token - * token_len - length of returned token - * - * RETURNS: - * token type, token and token length - * - */ -msdos_token_types_t -msdos_get_token(const char *path, char *ret_token, int *token_len) -{ - int rc = RC_OK; - register int i = 0; - msdos_token_types_t type = MSDOS_NAME; - char token[MSDOS_NAME_MAX_WITH_DOT+1]; - register char c; - - /* - * Copy a name into token. (Remember NULL is a token.) - */ - c = path[i]; - while ( (!msdos_is_separator(c)) && (i <= MSDOS_NAME_MAX_WITH_DOT) ) - { - token[i] = c; - if ( i == MSDOS_NAME_MAX_WITH_DOT ) - return MSDOS_INVALID_TOKEN; - if ( !msdos_is_valid_name_char(c) ) - return MSDOS_INVALID_TOKEN; - c = path [++i]; - } - - /* - * Copy a seperator into token. - */ - if ( i == 0 ) - { - token[i] = c; - if ( token[i] != '\0' ) - { - i++; - type = MSDOS_CURRENT_DIR; - } - else - type = MSDOS_NO_MORE_PATH; - } - else if (token[ i-1 ] != '\0') - token[i] = '\0'; - - /* - * Set token_len to the number of characters copied. - */ - *token_len = i; - - /* - * If we copied something that was not a seperator see if - * it was a special name. - */ - if ( type == MSDOS_NAME ) - { - if ( strcmp( token, "..") == 0 ) - { - strcpy(ret_token, MSDOS_DOTDOT_NAME); - type = MSDOS_UP_DIR; - return type; - } - - if ( strcmp( token, "." ) == 0 ) - { - strcpy(ret_token, MSDOS_DOT_NAME); - type = MSDOS_CURRENT_DIR; - return type; - } - - rc = msdos_format_name('r', token, *token_len, ret_token, 0); - if ( rc != RC_OK ) - return MSDOS_INVALID_TOKEN; - } - ret_token[MSDOS_NAME_MAX] = '\0'; - return type; -} - - -/* msdos_find_name -- - * Find the node which correspondes to the name, open fat-file which - * correspondes to the found node and close fat-file which correspondes - * to the node we searched in. - * - * PARAMETERS: - * parent_loc - parent node description - * name - name to find - * - * RETURNS: - * RC_OK and updated 'parent_loc' on success, or -1 if error - * occured (errno set apropriately) - * - */ -int -msdos_find_name( - rtems_filesystem_location_info_t *parent_loc, - char *name - ) -{ - int rc = RC_OK; - msdos_fs_info_t *fs_info = parent_loc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = NULL; - fat_auxiliary_t aux; - unsigned short time_val = 0; - unsigned short date = 0; - unsigned char node_entry[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE]; - - memset(node_entry, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE); - - /* - * find the node which correspondes to the name in the directory pointed by - * 'parent_loc' - */ - rc = msdos_get_name_node(parent_loc, name, &aux, node_entry); - if (rc != RC_OK) - return rc; - - /* open fat-file corresponded to the found node */ - rc = fat_file_open(parent_loc->mt_entry, aux.cln, aux.ofs, &fat_fd); - if (rc != RC_OK) - return rc; - - /* - * I don't like this if, but: we should do it , or should write new file - * size and first cluster num to the disk after each write operation - * (even if one byte is written - that is TOO non-optimize) because - * otherwise real values of these fields stored in fat-file descriptor - * may be accidentely rewritten with wrong values stored on the disk - */ - if (fat_fd->links_num == 1) - { - fat_fd->info_cln = aux.cln; - fat_fd->info_ofs = aux.ofs; - fat_fd->cln = MSDOS_EXTRACT_CLUSTER_NUM(node_entry); - fat_fd->first_char = *MSDOS_DIR_NAME(node_entry); - - time_val = *MSDOS_DIR_WRITE_TIME(node_entry); - date = *MSDOS_DIR_WRITE_DATE(node_entry); - - fat_fd->mtime = msdos_date_dos2unix(CF_LE_W(time_val), CF_LE_W(date)); - - if ((*MSDOS_DIR_ATTR(node_entry)) & MSDOS_ATTR_DIRECTORY) - { - fat_fd->fat_file_type = FAT_DIRECTORY; - fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT; - - rc = fat_file_size(parent_loc->mt_entry, fat_fd); - if (rc != RC_OK) - { - fat_file_close(parent_loc->mt_entry, fat_fd); - return rc; - } - } - else - { - fat_fd->fat_file_size = CF_LE_L(*MSDOS_DIR_FILE_SIZE(node_entry)); - fat_fd->fat_file_type = FAT_FILE; - fat_fd->size_limit = MSDOS_MAX_FILE_SIZE; - } - - /* these data is not actual for zero-length fat-file */ - fat_fd->map.file_cln = 0; - fat_fd->map.disk_cln = fat_fd->cln; - - if ((fat_fd->fat_file_size != 0) && - (fat_fd->fat_file_size <= fs_info->fat.vol.bpc)) - { - fat_fd->map.last_cln = fat_fd->cln; - } - else - { - fat_fd->map.last_cln = FAT_UNDEFINED_VALUE; - } - } - - /* close fat-file corresponded to the node we searched in */ - rc = fat_file_close(parent_loc->mt_entry, parent_loc->node_access); - if (rc != RC_OK) - { - fat_file_close(parent_loc->mt_entry, fat_fd); - return rc; - } - - /* update node_info_ptr field */ - parent_loc->node_access = fat_fd; - - return rc; -} - -/* msdos_get_name_node -- - * This routine is used in two ways: for a new mode creation (a) or for - * search the node which correspondes to the name parameter (b). - * In case (a) 'name' should be set up to NULL and 'name_dir_entry' should - * point to initialized 32 bytes structure described a new node. - * In case (b) 'name' should contain a valid string. - * - * (a): reading fat-file which correspondes to directory we are going to - * create node in. If free slot is found write contents of - * 'name_dir_entry' into it. If reach end of fat-file and no free - * slot found, write 32 bytes to the end of fat-file. - * - * (b): reading fat-file which correspondes to directory and trying to - * find slot with the name field == 'name' parameter - * - * - * PARAMETERS: - * parent_loc - node description to create node in or to find name in - * name - NULL or name to find - * paux - identify a node location on the disk - - * cluster num and offset inside the cluster - * name_dir_entry - node to create/placeholder for found node (IN/OUT) - * - * RETURNS: - * RC_OK, filled aux_struct_ptr and name_dir_entry on success, or -1 if - * error occured (errno set apropriately) - * - */ -int -msdos_get_name_node( - rtems_filesystem_location_info_t *parent_loc, - char *name, - fat_auxiliary_t *paux, - char *name_dir_entry - ) -{ - int rc = RC_OK; - ssize_t ret = 0; - msdos_fs_info_t *fs_info = parent_loc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = parent_loc->node_access; - unsigned32 dotdot_cln = 0; - - /* find name in fat-file which correspondes to the directory */ - rc = msdos_find_name_in_fat_file(parent_loc->mt_entry, fat_fd, name, paux, - name_dir_entry); - if ((rc != RC_OK) && (rc != MSDOS_NAME_NOT_FOUND_ERR)) - return rc; - - /* if we search for valid name and name not found -> return */ - if ((rc == MSDOS_NAME_NOT_FOUND_ERR) && (name != NULL)) - return rc; - - /* - * if we try to create new entry and the directory is not big enough - * currently - try to enlarge directory - */ - if ((rc == MSDOS_NAME_NOT_FOUND_ERR) && (name == NULL)) - { - ret = fat_file_write(parent_loc->mt_entry, fat_fd, - fat_fd->fat_file_size, - MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE, - name_dir_entry); - if (ret == -1) - return -1; - - /* on success directory is enlarged by a new cluster */ - fat_fd->fat_file_size += fs_info->fat.vol.bpc; - - /* get cluster num where a new node located */ - rc = fat_file_ioctl(parent_loc->mt_entry, fat_fd, F_CLU_NUM, - fat_fd->fat_file_size - 1, &paux->cln); - - if (rc != RC_OK) - return rc; - - /* - * if new cluster allocated succesfully then new node is at very - * beginning of the cluster (offset is computed in bytes) - */ - paux->ofs = 0; - return RC_OK; - } - - /* - * if we have deal with ".." - it is a special case :((( - * - * Really, we should return cluster num and offset not of ".." slot, but - * slot which correspondes to real directory name. - */ - if ((rc == RC_OK) && (name != NULL)) - { - if (strncmp(name, MSDOS_DOTDOT_NAME, MSDOS_SHORT_NAME_LEN) == 0) - { - dotdot_cln = MSDOS_EXTRACT_CLUSTER_NUM((name_dir_entry)); - - /* are we right under root dir ? */ - if (dotdot_cln == 0) - { - /* - * we can relax about first_char field - it never should be - * used for root dir - */ - paux->cln = FAT_ROOTDIR_CLUSTER_NUM; - paux->ofs = 0; - } - else - { - rc = msdos_get_dotdot_dir_info_cluster_num_and_offset( - parent_loc->mt_entry, - dotdot_cln, - paux, - name_dir_entry - ); - if (rc != RC_OK) - return rc; - } - } - } - return rc; -} - -/* - * msdos_get_dotdot_dir_info_cluster_num_and_offset - * - * Unfortunately, in general, we cann't work here in fat-file ideologic - * (open fat_file "..", get ".." and ".", open "..", find an entry ...) - * because if we open - * fat-file ".." it may happend that we have two different fat-file - * descriptors ( for real name of directory and ".." name ) for a single - * file ( cluster num of both pointers to the same cluster ) - * But...we do it because we protected by semaphore - * - */ - -/* msdos_get_dotdot_dir_info_cluster_num_and_offset -- - * Get cluster num and offset not of ".." slot, but slot which correspondes - * to real directory name. - * - * PARAMETERS: - * mt_entry - mount table entry - * cln - data cluster num extracted drom ".." slot - * paux - identify a node location on the disk - - * number of cluster and offset inside the cluster - * dir_entry - placeholder for found node - * - * RETURNS: - * RC_OK, filled 'paux' and 'dir_entry' on success, or -1 if error occured - * (errno set apropriately) - * - */ -int -msdos_get_dotdot_dir_info_cluster_num_and_offset( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cln, - fat_auxiliary_t *paux, - char *dir_entry - ) -{ - int rc = RC_OK; - msdos_fs_info_t *fs_info = mt_entry->fs_info; - fat_file_fd_t *fat_fd = NULL; - unsigned char dot_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE]; - unsigned char dotdot_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE]; - unsigned char cur_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE]; - unsigned32 cl4find = 0; - - memset(dot_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE); - memset(dotdot_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE); - memset(cur_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE); - - /* - * open fat-file corresponded to ".." - */ - rc = fat_file_open(mt_entry, paux->cln, paux->ofs, &fat_fd); - if (rc != RC_OK) - return rc; - - fat_fd->info_cln = paux->cln; - fat_fd->info_ofs = paux->ofs; - fat_fd->cln = cln; - fat_fd->fat_file_type = FAT_DIRECTORY; - fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT; - - fat_fd->map.file_cln = 0; - fat_fd->map.disk_cln = fat_fd->cln; - - rc = fat_file_size(mt_entry, fat_fd); - if (rc != RC_OK) - { - fat_file_close(mt_entry, fat_fd); - return rc; - } - - /* find "." node in opened directory */ - rc = msdos_find_name_in_fat_file(mt_entry, fat_fd, MSDOS_DOT_NAME, paux, - dot_node); - - if (rc != RC_OK) - { - fat_file_close(mt_entry, fat_fd); - return rc; - } - - /* find ".." node in opened directory */ - rc = msdos_find_name_in_fat_file(mt_entry, fat_fd, MSDOS_DOTDOT_NAME, paux, - dotdot_node); - - if (rc != RC_OK) - { - fat_file_close(mt_entry, fat_fd); - return rc; - } - - cl4find = MSDOS_EXTRACT_CLUSTER_NUM(dot_node); - - /* close fat-file corresponded to ".." directory */ - rc = fat_file_close(mt_entry, fat_fd); - if ( rc != RC_OK ) - return rc; - - if ( (MSDOS_EXTRACT_CLUSTER_NUM(dotdot_node)) == 0) - { - /* - * we handle root dir for all FAT types in the same way with the - * ordinary directories ( through fat_file_* calls ) - */ - paux->cln = FAT_ROOTDIR_CLUSTER_NUM; - paux->ofs = 0; - } - - /* open fat-file corresponded to second ".." */ - rc = fat_file_open(mt_entry, paux->cln, paux->ofs, &fat_fd); - if (rc != RC_OK) - return rc; - - fat_fd->info_cln = paux->cln; - fat_fd->info_ofs = paux->ofs; - - if ((MSDOS_EXTRACT_CLUSTER_NUM(dotdot_node)) == 0) - fat_fd->cln = fs_info->fat.vol.rdir_cl; - else - fat_fd->cln = MSDOS_EXTRACT_CLUSTER_NUM(dotdot_node); - - fat_fd->fat_file_type = FAT_DIRECTORY; - fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT; - - fat_fd->map.file_cln = 0; - fat_fd->map.disk_cln = fat_fd->cln; - - rc = fat_file_size(mt_entry, fat_fd); - if (rc != RC_OK) - { - fat_file_close(mt_entry, fat_fd); - return rc; - } - - /* in this directory find slot with specified cluster num */ - rc = msdos_find_node_by_cluster_num_in_fat_file(mt_entry, fat_fd, cl4find, - paux, dir_entry); - if (rc != RC_OK) - { - fat_file_close(mt_entry, fat_fd); - return rc; - } - rc = fat_file_close(mt_entry, fat_fd); - return rc; -} - - -/* msdos_set_dir_wrt_time_and_date -- - * Write last write date and time for a file to the disk (to corresponded - * 32bytes node) - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set apropriately). - * - */ -int -msdos_set_dir_wrt_time_and_date( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd - ) -{ - ssize_t ret1 = 0, ret2 = 0; - msdos_fs_info_t *fs_info = mt_entry->fs_info; - unsigned short time_val; - unsigned short date; - unsigned32 sec = 0; - unsigned32 byte = 0; - - msdos_date_unix2dos(fat_fd->mtime, &time_val, &date); - - /* - * calculate input for _fat_block_write: convert (cluster num, offset) to - * (sector num, new offset) - */ - sec = fat_cluster_num_to_sector_num(mt_entry, fat_fd->info_cln); - sec += (fat_fd->info_ofs >> fs_info->fat.vol.sec_log2); - /* byte points to start of 32bytes structure */ - byte = fat_fd->info_ofs & (fs_info->fat.vol.bps - 1); - - time_val = CT_LE_W(time_val); - ret1 = _fat_block_write(mt_entry, sec, byte + MSDOS_FILE_WTIME_OFFSET, - 2, (char *)(&time_val)); - date = CT_LE_W(date); - ret2 = _fat_block_write(mt_entry, sec, byte + MSDOS_FILE_WDATE_OFFSET, - 2, (char *)(&date)); - - if ( (ret1 < 0) || (ret2 < 0) ) - return -1; - - return RC_OK; -} - -/* msdos_set_first_cluster_num -- - * Write number of first cluster of the file to the disk (to corresponded - * 32bytes slot) - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * - * RETURNS: - * RC_OK on success, or -1 if error occured - * - */ -int -msdos_set_first_cluster_num( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd - ) -{ - ssize_t ret1 = 0, ret2 = 0; - msdos_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 new_cln = fat_fd->cln; - unsigned16 le_cl_low = 0; - unsigned16 le_cl_hi = 0; - unsigned32 sec = 0; - unsigned32 byte = 0; - - /* - * calculate input for _fat_block_write: convert (cluster num, offset) to - * (sector num, new offset) - */ - sec = fat_cluster_num_to_sector_num(mt_entry, fat_fd->info_cln); - sec += (fat_fd->info_ofs >> fs_info->fat.vol.sec_log2); - /* byte from points to start of 32bytes structure */ - byte = fat_fd->info_ofs & (fs_info->fat.vol.bps - 1); - - le_cl_low = CT_LE_W((unsigned16)(new_cln & 0x0000FFFF)); - ret1 = _fat_block_write(mt_entry, sec, - byte + MSDOS_FIRST_CLUSTER_LOW_OFFSET, 2, - (char *)(&le_cl_low)); - le_cl_hi = CT_LE_W((unsigned16)((new_cln & 0xFFFF0000) >> 16)); - ret2 = _fat_block_write(mt_entry, sec, - byte + MSDOS_FIRST_CLUSTER_HI_OFFSET, 2, - (char *)(&le_cl_hi)); - if ( (ret1 < 0) || (ret2 < 0) ) - return -1; - - return RC_OK; -} - - -/* msdos_set_file size -- - * Write file size of the file to the disk (to corresponded 32bytes slot) - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set apropriately). - * - */ -int -msdos_set_file_size( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd - ) -{ - ssize_t ret = 0; - msdos_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 le_new_length = 0; - unsigned32 sec = 0; - unsigned32 byte = 0; - - sec = fat_cluster_num_to_sector_num(mt_entry, fat_fd->info_cln); - sec += (fat_fd->info_ofs >> fs_info->fat.vol.sec_log2); - byte = (fat_fd->info_ofs & (fs_info->fat.vol.bps - 1)); - - le_new_length = CT_LE_L((fat_fd->fat_file_size)); - ret = _fat_block_write(mt_entry, sec, byte + MSDOS_FILE_SIZE_OFFSET, 4, - (char *)(&le_new_length)); - if ( ret < 0 ) - return -1; - - return RC_OK; -} - -/* - * We should not check whether this routine is called for root dir - it - * never can happend - */ - -/* msdos_set_first_char4file_name -- - * Write first character of the name of the file to the disk (to - * corresponded 32bytes slot) - * - * PARAMETERS: - * mt_entry - mount table entry - * cl - number of cluster - * ofs - offset inside cluster - * fchar - character to set up - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set apropriately) - * - */ -int -msdos_set_first_char4file_name( - rtems_filesystem_mount_table_entry_t *mt_entry, - unsigned32 cl, - unsigned32 ofs, - unsigned char fchar - ) -{ - ssize_t ret = 0; - msdos_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 sec = 0; - unsigned32 byte = 0; - - sec = fat_cluster_num_to_sector_num(mt_entry, cl); - sec += (ofs >> fs_info->fat.vol.sec_log2); - byte = (ofs & (fs_info->fat.vol.bps - 1)); - - ret = _fat_block_write(mt_entry, sec, byte + MSDOS_FILE_NAME_OFFSET, 1, - &fchar); - if ( ret < 0) - return -1; - - return RC_OK; -} - -/* msdos_dir_is_empty -- - * Check whether directory which correspondes to the fat-file descriptor is - * empty. - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * ret_val - placeholder for result - * - * RETURNS: - * RC_OK on success, or -1 if error occured - * - */ -int -msdos_dir_is_empty( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - rtems_boolean *ret_val - ) -{ - ssize_t ret = 0; - msdos_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 j = 0, i = 0; - - /* dir is not empty */ - *ret_val = FALSE; - - while ((ret = fat_file_read(mt_entry, fat_fd, j * fs_info->fat.vol.bps, - fs_info->fat.vol.bps, - fs_info->cl_buf)) != FAT_EOF) - { - if (ret < MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE) - return -1; - - assert(ret == fs_info->fat.vol.bps); - - for (i = 0; - i < fs_info->fat.vol.bps; - i += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE) - { - if (((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) == - MSDOS_THIS_DIR_ENTRY_EMPTY) || - (strncmp(MSDOS_DIR_NAME((fs_info->cl_buf + i)), MSDOS_DOT_NAME, - MSDOS_SHORT_NAME_LEN) == 0) || - (strncmp(MSDOS_DIR_NAME((fs_info->cl_buf + i)), - MSDOS_DOTDOT_NAME, - MSDOS_SHORT_NAME_LEN) == 0)) - continue; - - if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) == - MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY) - { - *ret_val = TRUE; - return RC_OK; - } - return RC_OK; - } - j++; - } - *ret_val = TRUE; - return RC_OK; -} - - -/* msdos_find_name_in_fat_file -- - * This routine is used in two ways: for a new mode creation (a) or for - * search the node which correspondes to the 'name' parameter (b). - * In case (a) name should be set up to NULL and 'name_dir_entry' should - * point to initialized 32 bytes structure described a new node. - * In case (b) 'name' should contain a valid string. - * - * (a): reading fat-file corresponded to directory we are going to create - * node in. If found free slot write contents of name_dir_entry into - * it. - * - * (b): reading fat-file corresponded to directory and trying to find slot - * with the name field == name parameter - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * name - NULL or name to find - * paux - identify a node location on the disk - - * number of cluster and offset inside the cluster - * name_dir_entry - node to create/placeholder for found node - * - * RETURNS: - * RC_OK on success, or error code if error occured (errno set - * appropriately) - * - */ -int -msdos_find_name_in_fat_file( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - char *name, - fat_auxiliary_t *paux, - char *name_dir_entry - ) -{ - int rc = RC_OK; - ssize_t ret = 0; - msdos_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 i = 0, j = 0; - unsigned32 bts2rd = 0; - - if (FAT_FD_OF_ROOT_DIR(fat_fd) && - (fs_info->fat.vol.type & (FAT_FAT12 | FAT_FAT16))) - bts2rd = fat_fd->fat_file_size; - else - bts2rd = fs_info->fat.vol.bpc; - - while ((ret = fat_file_read(mt_entry, fat_fd, (j * bts2rd), bts2rd, - fs_info->cl_buf)) != FAT_EOF) - { - if (ret < MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE) - set_errno_and_return_minus_one(EIO); - - assert(ret == bts2rd); - - for (i = 0; i < bts2rd; i += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE) - { - /* is the entry empty ? */ - if (((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) == - MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY) || - ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) == - MSDOS_THIS_DIR_ENTRY_EMPTY)) - { - /* whether we are looking for an empty entry */ - if (name == NULL) - { - /* get current cluster number */ - rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM, - j * bts2rd, &paux->cln); - if (rc != RC_OK) - return rc; - - /* offset is computed in bytes */ - paux->ofs = i; - - /* write new node entry */ - ret = fat_file_write(mt_entry, fat_fd, j * bts2rd + i, - MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE, - name_dir_entry); - if (ret != MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE) - return -1; - - /* - * we don't update fat_file_size here - it should not - * increase - */ - return RC_OK; - } - - /* - * if name != NULL and there is no more entries in the - * directory - return name-not-found - */ - if (((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) == - MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY)) - return MSDOS_NAME_NOT_FOUND_ERR; - } - else - { - /* entry not empty and name != NULL -> compare names */ - if (name != NULL) - { - if (strncmp(MSDOS_DIR_NAME((fs_info->cl_buf + i)), name, - MSDOS_SHORT_NAME_LEN) == 0) - { - /* - * we get the entry we looked for - fill auxiliary - * structure and copy all 32 bytes of the entry - */ - rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM, - j * bts2rd, &paux->cln); - if (rc != RC_OK) - return rc; - - /* offset is computed in bytes */ - paux->ofs = i; - memcpy(name_dir_entry,(fs_info->cl_buf + i), - MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE); - return RC_OK; - } - } - } - } - j++; - } - return MSDOS_NAME_NOT_FOUND_ERR; -} - -/* msdos_find_node_by_cluster_num_in_fat_file -- - * Find node with specified number of cluster in fat-file. - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * cl4find - number of cluster to find - * paux - identify a node location on the disk - - * cluster num and offset inside the cluster - * dir_entry - placeholder for found node - * - * RETURNS: - * RC_OK on success, or error code if error occured - * - */ -int -msdos_find_node_by_cluster_num_in_fat_file( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd, - unsigned32 cl4find, - fat_auxiliary_t *paux, - char *dir_entry - ) -{ - int rc = RC_OK; - ssize_t ret = 0; - msdos_fs_info_t *fs_info = mt_entry->fs_info; - unsigned32 bts2rd = 0; - unsigned32 i = 0, j = 0; - - if (FAT_FD_OF_ROOT_DIR(fat_fd) && - (fs_info->fat.vol.type & (FAT_FAT12 | FAT_FAT16))) - bts2rd = fat_fd->fat_file_size; - else - bts2rd = fs_info->fat.vol.bpc; - - while ((ret = fat_file_read(mt_entry, fat_fd, j * bts2rd, bts2rd, - fs_info->cl_buf)) != FAT_EOF) - { - if ( ret < MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE ) - set_errno_and_return_minus_one( EIO ); - - assert(ret == bts2rd); - - for (i = 0; i < bts2rd; i += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE) - { - /* if this and all rest entries are empty - return not-found */ - if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) == - MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY) - return MSDOS_NAME_NOT_FOUND_ERR; - - /* if this entry is empty - skip it */ - if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) == - MSDOS_THIS_DIR_ENTRY_EMPTY) - continue; - - /* if get a non-empty entry - compare clusters num */ - if (MSDOS_EXTRACT_CLUSTER_NUM((fs_info->cl_buf + i)) == cl4find) - { - /* on success fill aux structure and copy all 32 bytes */ - rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM, j * bts2rd, - &paux->cln); - if (rc != RC_OK) - return rc; - - paux->ofs = i; - memcpy(dir_entry, fs_info->cl_buf + i, - MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE); - return RC_OK; - } - } - j++; - } - return MSDOS_NAME_NOT_FOUND_ERR; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_mknod.c b/c/src/exec/libfs/src/dosfs/msdos_mknod.c deleted file mode 100644 index 5e32dbf3bf..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_mknod.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Routine for node creation in MSDOS filesystem. - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* msdos_mknod -- - * The following function checks spelling and formats name for a new node, - * determines type of the node to be created and creates it. - * - * PARAMETERS: - * token - non-formatted name of a new node - * mode - node type - * dev - dev - * pathloc - parent directory description - * - * RETURNS: - * RC_OK on succes, or -1 if error occured and set errno - * - */ -int -msdos_mknod( - const char *token, - mode_t mode, - dev_t dev, - rtems_filesystem_location_info_t *pathloc - ) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info; - msdos_token_types_t type = 0; - char new_name[ MSDOS_NAME_MAX + 1 ]; - int len; - - /* check spelling and format new node name */ - msdos_get_token(token, new_name, &len); - - /* - * Figure out what type of msdos node this is. - */ - if (S_ISDIR(mode)) - { - type = MSDOS_DIRECTORY; - } - else if (S_ISREG(mode)) - { - type = MSDOS_REGULAR_FILE; - } - else - set_errno_and_return_minus_one(EINVAL); - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one(EIO); - - /* Create an MSDOS node */ - rc = msdos_creat_node(pathloc, type, new_name, mode); - - rtems_semaphore_release(fs_info->vol_sema); - return rc; -} diff --git a/c/src/exec/libfs/src/dosfs/msdos_node_type.c b/c/src/exec/libfs/src/dosfs/msdos_node_type.c deleted file mode 100644 index 517dabda3f..0000000000 --- a/c/src/exec/libfs/src/dosfs/msdos_node_type.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * The following returns the type of node that the loc refers to. - * - * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia - * Author: Eugeny S. Mints - * - * 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 "fat.h" -#include "fat_fat_operations.h" -#include "fat_file.h" - -#include "msdos.h" - -/* msdos_node_type -- - * Determine type of the node that the pathloc refers to. - * - * PARAMETERS: - * pathloc - node description - * - * RETURNS: - * node type - * - */ -rtems_filesystem_node_types_t -msdos_node_type(rtems_filesystem_location_info_t *pathloc) -{ - fat_file_fd_t *fat_fd; - - /* - * we don't need to obtain the volume semaphore here because node_type_h - * call always follows evalpath_h call(hence link increment occured) and - * hence node_access memory can't be freed during processing node_type_h - * call - */ - fat_fd = pathloc->node_access; - - return fat_fd->fat_file_type; -} diff --git a/c/src/exec/libfs/src/imfs/.cvsignore b/c/src/exec/libfs/src/imfs/.cvsignore deleted file mode 100644 index acbf393fde..0000000000 --- a/c/src/exec/libfs/src/imfs/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -Makefile.in -config.h -config.h.in -stamp-h -stamp-h.in -stamp-h1.in diff --git a/c/src/exec/libfs/src/imfs/Makefile.am b/c/src/exec/libfs/src/imfs/Makefile.am deleted file mode 100644 index 760e29025b..0000000000 --- a/c/src/exec/libfs/src/imfs/Makefile.am +++ /dev/null @@ -1,66 +0,0 @@ -## -## $Id$ -## - - -INCLUDES = -I../.. - -LIBNAME = libimfs -LIB = ${ARCH}/${LIBNAME}.a - -IMFS_C_FILES = imfs_chown.c imfs_config.c imfs_creat.c imfs_directory.c \ - imfs_eval.c imfs_free.c imfs_fsunmount.c imfs_gtkn.c imfs_init.c \ - imfs_initsupp.c imfs_link.c imfs_mknod.c imfs_mount.c imfs_fchmod.c \ - imfs_unlink.c imfs_unmount.c imfs_utime.c imfs_ntype.c imfs_stat.c \ - imfs_getchild.c memfile.c linearfile.c deviceio.c imfs_handlers_device.c \ - imfs_handlers_directory.c imfs_handlers_link.c imfs_handlers_memfile.c \ - imfs_debug.c imfs_rmnod.c imfs_symlink.c imfs_readlink.c imfs_fdatasync.c \ - imfs_fcntl.c ioman.c miniimfs_init.c imfs_load_tar.c - -UNIX_C_FILES = imfs_unixstub.c - -EMBEDDED_C_FILES = $(IMFS_C_FILES) - -COMMON_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) - -include_HEADERS = imfs.h - -include $(top_srcdir)/../automake/multilib.am -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/lib.am - -PREINSTALL_FILES = $(PROJECT_INCLUDE) \ - $(include_HEADERS:%=$(PROJECT_INCLUDE)/%) - -$(PROJECT_INCLUDE): - @$(mkinstalldirs) $@ - -$(PROJECT_INCLUDE)/%.h: %.h - $(INSTALL_DATA) $< $@ - -OBJS = $(C_O_FILES) - -# -# Add local stuff here using += -# - -AM_CFLAGS += $(LIBC_DEFINES) - -all-local: ${ARCH} $(LIB) - -$(LIB): ${OBJS} - $(make-library) - -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/exec/libfs/src/imfs/deviceio.c b/c/src/exec/libfs/src/imfs/deviceio.c deleted file mode 100644 index eafc48ec4e..0000000000 --- a/c/src/exec/libfs/src/imfs/deviceio.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * IMFS Device Node Handlers - * - * This file contains the set of handlers used to map operations on - * IMFS device nodes onto calls to the RTEMS Classic API IO Manager. - * - * 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 /* assoc.h not included by rtems.h */ -#include - -#include "imfs.h" - -/* - * Convert RTEMS status to a UNIX errno - */ - -rtems_assoc_t errno_assoc[] = { - { "OK", RTEMS_SUCCESSFUL, 0 }, - { "BUSY", RTEMS_RESOURCE_IN_USE, EBUSY }, - { "INVALID NAME", RTEMS_INVALID_NAME, EINVAL }, - { "NOT IMPLEMENTED", RTEMS_NOT_IMPLEMENTED, ENOSYS }, - { "TIMEOUT", RTEMS_TIMEOUT, ETIMEDOUT }, - { "NO MEMORY", RTEMS_NO_MEMORY, ENOMEM }, - { "NO DEVICE", RTEMS_UNSATISFIED, ENODEV }, - { "INVALID NUMBER", RTEMS_INVALID_NUMBER, EBADF}, - { "NOT RESOURCE OWNER", RTEMS_NOT_OWNER_OF_RESOURCE, EPERM}, - { "IO ERROR", RTEMS_IO_ERROR, EIO}, - { 0, 0, 0 }, -}; - -static unsigned32 -rtems_deviceio_errno(rtems_status_code code) -{ - int rc; - - if ((rc = rtems_assoc_remote_by_local(errno_assoc, (unsigned32) code))) - { - errno = rc; - return -1; - } - return -1; -} - -/* - * device_open - * - * This handler maps an open() operation onto rtems_io_open(). - */ - -int device_open( - rtems_libio_t *iop, - const char *pathname, - unsigned32 flag, - unsigned32 mode -) -{ - rtems_libio_open_close_args_t args; - rtems_status_code status; - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - args.iop = iop; - args.flags = iop->flags; - args.mode = mode; - - status = rtems_io_open( - the_jnode->info.device.major, - the_jnode->info.device.minor, - (void *) &args - ); - if ( status ) { - rtems_deviceio_errno(status); - return RTEMS_UNSATISFIED; - } - - return 0; -} - -/* - * device_close - * - * This handler maps a close() operation onto rtems_io_close(). - */ - -int device_close( - rtems_libio_t *iop -) -{ - rtems_libio_open_close_args_t args; - rtems_status_code status; - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - args.iop = iop; - args.flags = 0; - args.mode = 0; - - status = rtems_io_close( - the_jnode->info.device.major, - the_jnode->info.device.minor, - (void *) &args - ); - if ( status ) { - rtems_deviceio_errno(status); - return RTEMS_UNSATISFIED; - } - return 0; -} - -/* - * device_read - * - * This handler maps a read() operation onto rtems_io_read(). - */ - -int device_read( - rtems_libio_t *iop, - void *buffer, - unsigned32 count -) -{ - rtems_libio_rw_args_t args; - rtems_status_code status; - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - args.iop = iop; - args.offset = iop->offset; - args.buffer = buffer; - args.count = count; - args.flags = iop->flags; - args.bytes_moved = 0; - - status = rtems_io_read( - the_jnode->info.device.major, - the_jnode->info.device.minor, - (void *) &args - ); - - if ( status ) - return rtems_deviceio_errno(status); - - return args.bytes_moved; -} - -/* - * device_write - * - * This handler maps a write() operation onto rtems_io_write(). - */ - -int device_write( - rtems_libio_t *iop, - const void *buffer, - unsigned32 count -) -{ - rtems_libio_rw_args_t args; - rtems_status_code status; - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - args.iop = iop; - args.offset = iop->offset; - args.buffer = (void *) buffer; - args.count = count; - args.flags = iop->flags; - args.bytes_moved = 0; - - status = rtems_io_write( - the_jnode->info.device.major, - the_jnode->info.device.minor, - (void *) &args - ); - - if ( status ) - return rtems_deviceio_errno(status); - - return args.bytes_moved; -} - -/* - * device_ioctl - * - * This handler maps an ioctl() operation onto rtems_io_ioctl(). - */ - -int device_ioctl( - rtems_libio_t *iop, - unsigned32 command, - void *buffer -) -{ - rtems_libio_ioctl_args_t args; - rtems_status_code status; - IMFS_jnode_t *the_jnode; - - args.iop = iop; - args.command = command; - args.buffer = buffer; - - the_jnode = iop->file_info; - - status = rtems_io_control( - the_jnode->info.device.major, - the_jnode->info.device.minor, - (void *) &args - ); - - if ( status ) - return rtems_deviceio_errno(status); - - return args.ioctl_return; -} - -/* - * device_lseek - * - * This handler eats all lseek() operations. - */ - -int device_lseek( - rtems_libio_t *iop, - off_t offset, - int whence -) -{ - return 0; -} - -/* - * device_stat - * - * The IMFS_stat() is used. - */ - -/* - * device_rmnod - * - * The IMFS_rmnod() is used. - */ diff --git a/c/src/exec/libfs/src/imfs/imfs.h b/c/src/exec/libfs/src/imfs/imfs.h deleted file mode 100644 index 4113553768..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs.h +++ /dev/null @@ -1,546 +0,0 @@ -/* - * Header file for the In-Memory File System - * - * 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 __IMFS_h -#define __IMFS_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include -#include -#include - -/* - * File name macros - */ - -#define IMFS_is_valid_name_char( _ch ) ( 1 ) - -#define IMFS_is_separator( _ch ) \ - rtems_filesystem_is_separator( _ch ) - -/* - * Data types - */ - -struct IMFS_jnode_tt; -typedef struct IMFS_jnode_tt IMFS_jnode_t; - -typedef struct { - Chain_Control Entries; - rtems_filesystem_mount_table_entry_t *mt_fs; -} IMFS_directory_t; - -typedef struct { - rtems_device_major_number major; - rtems_device_minor_number minor; -} IMFS_device_t; - -typedef struct { - IMFS_jnode_t *link_node; -} IMFS_link_t; - -typedef struct { - const char *name; -} IMFS_sym_link_t; - -/* - * IMFS "memfile" information - * - * The data structure for the in-memory "memfiles" is based on classic UNIX. - * - * block_ptr is a pointer to a block of IMFS_MEMFILE_BYTES_PER_BLOCK in - * length which could be data or a table of pointers to blocks. - * - * Setting IMFS_MEMFILE_BYTES_PER_BLOCK to different values has a significant - * impact on the maximum file size supported as well as the amount of - * memory wasted due to internal file fragmentation. The following - * is a list of maximum file sizes based on various settings - * - * max_filesize with blocks of 16 is 1,328 - * max_filesize with blocks of 32 is 18,656 - * max_filesize with blocks of 64 is 279,488 - * max_filesize with blocks of 128 is 4,329,344 - * max_filesize with blocks of 256 is 68,173,568 - * max_filesize with blocks of 512 is 1,082,195,456 - */ - -#define IMFS_MEMFILE_BYTES_PER_BLOCK 128 -#define IMFS_MEMFILE_BLOCK_SLOTS \ - (IMFS_MEMFILE_BYTES_PER_BLOCK / sizeof(void *)) - -typedef unsigned char * block_p; -typedef block_p *block_ptr; - -typedef struct { - off_t size; /* size of file in bytes */ - block_ptr indirect; /* array of 128 data blocks pointers */ - block_ptr doubly_indirect; /* 128 indirect blocks */ - block_ptr triply_indirect; /* 128 doubly indirect blocks */ -} IMFS_memfile_t; - -typedef struct { - off_t size; /* size of file in bytes */ - block_p direct; /* pointer to file image */ -} IMFS_linearfile_t; - -/* - * Important block numbers for "memfiles" - */ - -#define FIRST_INDIRECT (0) -#define LAST_INDIRECT (IMFS_MEMFILE_BLOCK_SLOTS - 1) - -#define FIRST_DOUBLY_INDIRECT (LAST_INDIRECT + 1) -#define LAST_DOUBLY_INDIRECT \ - (LAST_INDIRECT + \ - (IMFS_MEMFILE_BLOCK_SLOTS * IMFS_MEMFILE_BLOCK_SLOTS)) - -#define FIRST_TRIPLY_INDIRECT (LAST_DOUBLY_INDIRECT + 1) -#define LAST_TRIPLY_INDIRECT \ - (LAST_DOUBLY_INDIRECT +\ - (IMFS_MEMFILE_BLOCK_SLOTS * \ - IMFS_MEMFILE_BLOCK_SLOTS * IMFS_MEMFILE_BLOCK_SLOTS)) - -#define IMFS_MEMFILE_MAXIMUM_SIZE \ - (LAST_TRIPLY_INDIRECT * IMFS_MEMFILE_BYTES_PER_BLOCK) - -/* - * What types of IMFS file systems entities there can be. - */ - -#define IMFS_jnode_types_t rtems_filesystem_node_types_t -#define IMFS_DIRECTORY RTEMS_FILESYSTEM_DIRECTORY -#define IMFS_DEVICE RTEMS_FILESYSTEM_DEVICE -#define IMFS_HARD_LINK RTEMS_FILESYSTEM_HARD_LINK -#define IMFS_SYM_LINK RTEMS_FILESYSTEM_SYM_LINK -#define IMFS_MEMORY_FILE RTEMS_FILESYSTEM_MEMORY_FILE -#define IMFS_LINEAR_FILE (IMFS_MEMORY_FILE + 1) - -#define IMFS_NUMBER_OF_TYPES (IMFS_LINEAR_FILE + 1) - -typedef union { - IMFS_directory_t directory; - IMFS_device_t device; - IMFS_link_t hard_link; - IMFS_sym_link_t sym_link; - IMFS_memfile_t file; - IMFS_linearfile_t linearfile; -} IMFS_types_union; - -/* - * Maximum length of a "basename" of an IMFS file/node. - */ - -#define IMFS_NAME_MAX 32 - -/* - * The control structure for an IMFS jnode. - */ - -struct IMFS_jnode_tt { - Chain_Node Node; /* for chaining them together */ - IMFS_jnode_t *Parent; /* Parent node */ - char name[IMFS_NAME_MAX+1]; /* "basename" */ - mode_t st_mode; /* File mode */ - nlink_t st_nlink; /* Link count */ - ino_t st_ino; /* inode */ - - uid_t st_uid; /* User ID of owner */ - gid_t st_gid; /* Group ID of owner */ - - time_t stat_atime; /* Time of last access */ - time_t stat_mtime; /* Time of last modification */ - time_t stat_ctime; /* Time of last status change */ - IMFS_jnode_types_t type; /* Type of this entry */ - IMFS_types_union info; -}; - -#define IMFS_update_atime( _jnode ) \ - do { \ - struct timeval tv; \ - gettimeofday( &tv, 0 ); \ - _jnode->stat_atime = (time_t) tv.tv_sec; \ - } while (0) - -#define IMFS_update_mtime( _jnode ) \ - do { \ - struct timeval tv; \ - gettimeofday( &tv, 0 ); \ - _jnode->stat_mtime = (time_t) tv.tv_sec; \ - } while (0) - -#define IMFS_update_ctime( _jnode ) \ - do { \ - struct timeval tv; \ - gettimeofday( &tv, 0 ); \ - _jnode->stat_ctime = (time_t) tv.tv_sec; \ - } while (0) - -#define IMFS_atime_mtime_update( _jnode ) \ - do { \ - struct timeval tv; \ - gettimeofday( &tv, 0 ); \ - _jnode->stat_mtime = (time_t) tv.tv_sec; \ - _jnode->stat_atime = (time_t) tv.tv_sec; \ - } while (0) - -typedef struct { - ino_t ino_count; - rtems_filesystem_file_handlers_r *linearfile_handlers; - rtems_filesystem_file_handlers_r *memfile_handlers; - rtems_filesystem_file_handlers_r *directory_handlers; -} IMFS_fs_info_t; - -#if UNUSED -/* FIXME: Unused, we might want to remove it */ -#define increment_and_check_linkcounts( _fs_info ) \ - ((IMFS_fs_info_t * )_fs_info)->link_counts++; \ - if ( ((IMFS_fs_info_t * )_fs_info)->link_counts > MAXSYMLINKS ) \ - rtems_set_errno_and_return_minus_one( ELOOP ) -#endif - -#define decrement_linkcounts( _fs_info ) \ - ((IMFS_fs_info_t * )_fs_info)->link_counts--; - -/* - * Type defination for tokens returned from IMFS_get_token - */ - -typedef enum { - IMFS_NO_MORE_PATH, - IMFS_CURRENT_DIR, - IMFS_UP_DIR, - IMFS_NAME, - IMFS_INVALID_TOKEN -} IMFS_token_types; - -/* - * Shared Data - */ - -extern rtems_filesystem_file_handlers_r IMFS_directory_handlers; -extern rtems_filesystem_file_handlers_r IMFS_device_handlers; -extern rtems_filesystem_file_handlers_r IMFS_link_handlers; -extern rtems_filesystem_file_handlers_r IMFS_linearfile_handlers; -extern rtems_filesystem_file_handlers_r IMFS_memfile_handlers; -extern rtems_filesystem_operations_table IMFS_ops; -extern rtems_filesystem_operations_table miniIMFS_ops; -extern rtems_filesystem_limits_and_options_t IMFS_LIMITS_AND_OPTIONS; - -/* - * Routines - */ - -int IMFS_initialize( - rtems_filesystem_mount_table_entry_t *mt_entry -); - -int miniIMFS_initialize( - rtems_filesystem_mount_table_entry_t *mt_entry -); - -int IMFS_initialize_support( - rtems_filesystem_mount_table_entry_t *mt_entry, - rtems_filesystem_operations_table *op_table, - rtems_filesystem_file_handlers_r *linearfile_handlers, - rtems_filesystem_file_handlers_r *memfile_handlers, - rtems_filesystem_file_handlers_r *directory_handlers -); - -int IMFS_fsunmount( - rtems_filesystem_mount_table_entry_t *mt_entry -); - -int rtems_tarfs_load( - char *mountpoint, - unsigned char *addr, - unsigned long length -); - -/* - * Returns the number of characters copied from path to token. - */ -IMFS_token_types IMFS_get_token( - const char *path, - char *token, - int *token_len -); - -void IMFS_dump( void ); - -void IMFS_initialize_jnode( - IMFS_jnode_t *the_jnode, - IMFS_jnode_types_t type, - IMFS_jnode_t *the_parent, - char *name, - mode_t mode -); - -IMFS_jnode_t *IMFS_find_match_in_dir( - IMFS_jnode_t *directory, /* IN */ - char *name /* IN */ -); - -rtems_filesystem_node_types_t IMFS_node_type( - rtems_filesystem_location_info_t *pathloc /* IN */ -); - -int IMFS_stat( - rtems_filesystem_location_info_t *loc, /* IN */ - struct stat *buf /* OUT */ -); - -int IMFS_Set_handlers( - rtems_filesystem_location_info_t *loc -); - -int IMFS_evaluate_link( - rtems_filesystem_location_info_t *node, /* IN/OUT */ - int flags /* IN */ -); - -int IMFS_eval_path( - const char *pathname, /* IN */ - int flags, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */ -); - - -int IMFS_link( - rtems_filesystem_location_info_t *to_loc, /* IN */ - rtems_filesystem_location_info_t *parent_loc, /* IN */ - const char *token /* IN */ -); - -int IMFS_unlink( - rtems_filesystem_location_info_t *pathloc /* IN */ -); - -int IMFS_chown( - rtems_filesystem_location_info_t *pathloc, /* IN */ - uid_t owner, /* IN */ - gid_t group /* IN */ -); - -int IMFS_freenodinfo( - rtems_filesystem_location_info_t *pathloc /* IN */ -); - -int IMFS_mknod( - const char *path, /* IN */ - mode_t mode, /* IN */ - dev_t dev, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */ -); - -IMFS_jnode_t *IMFS_create_node( - rtems_filesystem_location_info_t *parent_loc, /* IN */ - IMFS_jnode_types_t type, /* IN */ - char *name, /* IN */ - mode_t mode, /* IN */ - IMFS_types_union *info /* IN */ -); - -int IMFS_evaluate_for_make( - const char *path, /* IN */ - rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ - const char **name /* OUT */ -); - -int IMFS_mount( - rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ -); - -int IMFS_unmount( - rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ -); - -int IMFS_freenod( - rtems_filesystem_location_info_t *node /* IN/OUT */ -); - -int IMFS_memfile_remove( - IMFS_jnode_t *the_jnode /* IN/OUT */ -); - -int memfile_ftruncate( - rtems_libio_t *iop, /* IN */ - off_t length /* IN */ -); - -int imfs_dir_open( - rtems_libio_t *iop, /* IN */ - const char *pathname, /* IN */ - unsigned32 flag, /* IN */ - unsigned32 mode /* IN */ -); - -int imfs_dir_close( - rtems_libio_t *iop /* IN */ -); - -int imfs_dir_read( - rtems_libio_t *iop, /* IN */ - void *buffer, /* IN */ - unsigned32 count /* IN */ -); - -int imfs_dir_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - -int imfs_dir_fstat( - rtems_filesystem_location_info_t *loc, /* IN */ - struct stat *buf /* OUT */ -); - -int imfs_dir_rmnod( - rtems_filesystem_location_info_t *pathloc /* IN */ -); - -int linearfile_read( - rtems_libio_t *iop, /* IN */ - void *buffer, /* IN */ - unsigned32 count /* IN */ -); - -int linearfile_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - -int memfile_open( - rtems_libio_t *iop, /* IN */ - const char *pathname, /* IN */ - unsigned32 flag, /* IN */ - unsigned32 mode /* IN */ -); - -int memfile_close( - rtems_libio_t *iop /* IN */ -); - -int memfile_read( - rtems_libio_t *iop, /* IN */ - void *buffer, /* IN */ - unsigned32 count /* IN */ -); - -int memfile_write( - rtems_libio_t *iop, /* IN */ - const void *buffer, /* IN */ - unsigned32 count /* IN */ -); - -int memfile_ioctl( - rtems_libio_t *iop, /* IN */ - unsigned32 command, /* IN */ - void *buffer /* IN */ -); - -int memfile_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - -int memfile_rmnod( - rtems_filesystem_location_info_t *pathloc /* IN */ -); - -int device_open( - rtems_libio_t *iop, /* IN */ - const char *pathname, /* IN */ - unsigned32 flag, /* IN */ - unsigned32 mode /* IN */ -); - -int device_close( - rtems_libio_t *iop /* IN */ -); - -int device_read( - rtems_libio_t *iop, /* IN */ - void *buffer, /* IN */ - unsigned32 count /* IN */ -); - -int device_write( - rtems_libio_t *iop, /* IN */ - const void *buffer, /* IN */ - unsigned32 count /* IN */ -); - -int device_ioctl( - rtems_libio_t *iop, /* IN */ - unsigned32 command, /* IN */ - void *buffer /* IN */ -); - -int device_lseek( - rtems_libio_t *iop, /* IN */ - off_t offset, /* IN */ - int whence /* IN */ -); - -int IMFS_utime( - rtems_filesystem_location_info_t *pathloc, /* IN */ - time_t actime, /* IN */ - time_t modtime /* IN */ -); - -int IMFS_fchmod( - rtems_filesystem_location_info_t *loc, - mode_t mode -); - -int IMFS_symlink( - rtems_filesystem_location_info_t *parent_loc, /* IN */ - const char *link_name, - const char *node_name -); - -int IMFS_readlink( - rtems_filesystem_location_info_t *loc, /* IN */ - char *buf, /* OUT */ - size_t bufsize -); - -int IMFS_fdatasync( - rtems_libio_t *iop -); - -int IMFS_fcntl( - int cmd, - rtems_libio_t *iop -); - -int IMFS_rmnod( - rtems_filesystem_location_info_t *pathloc /* IN */ -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/exec/libfs/src/imfs/imfs_chown.c b/c/src/exec/libfs/src/imfs/imfs_chown.c deleted file mode 100644 index 2db58052ee..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_chown.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * IMFS_chown - * - * This routine is the implementation of the chown() system - * call for the IMFS. - * - * 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 "imfs.h" - -int IMFS_chown( - rtems_filesystem_location_info_t *pathloc, /* IN */ - uid_t owner, /* IN */ - gid_t group /* IN */ -) -{ - IMFS_jnode_t *jnode; -#if defined(RTEMS_POSIX_API) - uid_t st_uid; -#endif - - jnode = (IMFS_jnode_t *) pathloc->node_access; - - /* - * Verify I am the owner of the node or the super user. - */ - -#if defined(RTEMS_POSIX_API) - st_uid = geteuid(); - - if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) ) - rtems_set_errno_and_return_minus_one( EPERM ); -#endif - - jnode->st_uid = owner; - jnode->st_gid = group; - - IMFS_update_ctime( jnode ); - - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_config.c b/c/src/exec/libfs/src/imfs/imfs_config.c deleted file mode 100644 index af9d1d1f16..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_config.c +++ /dev/null @@ -1,37 +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 -#include -#include "imfs.h" - -/* XXX this structure should use real constants */ - -rtems_filesystem_limits_and_options_t IMFS_LIMITS_AND_OPTIONS = { - 5, /* link_max */ - 6, /* max_canon */ - 7, /* max_input */ - IMFS_NAME_MAX, /* name_max */ - 255, /* path_max */ - 2, /* pipe_buf */ - 1, /* posix_async_io */ - 2, /* posix_chown_restrictions */ - 3, /* posix_no_trunc */ - 4, /* posix_prio_io */ - 5, /* posix_sync_io */ - 6 /* posix_vdisable */ -}; - - diff --git a/c/src/exec/libfs/src/imfs/imfs_creat.c b/c/src/exec/libfs/src/imfs/imfs_creat.c deleted file mode 100644 index cc7449b12d..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_creat.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * IMFS_create_node() - * - * Routine to create a new in memory file system node. - * - * 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 "imfs.h" -#include - -IMFS_jnode_t *IMFS_create_node( - rtems_filesystem_location_info_t *parent_loc, - IMFS_jnode_types_t type, - char *name, - mode_t mode, - IMFS_types_union *info -) -{ - IMFS_jnode_t *node; - struct timeval tv; - IMFS_jnode_t *parent = NULL; - IMFS_fs_info_t *fs_info; - char *sym_name; - - if ( parent_loc != NULL ) - parent = parent_loc->node_access; - - /* - * Allocate an IMFS jnode - */ - - node = calloc( 1, sizeof( IMFS_jnode_t ) ); - if ( !node ) - return NULL; - - /* - * Fill in the basic information - */ - - node->st_nlink = 1; - node->type = type; - strncpy( node->name, name, IMFS_NAME_MAX ); - - /* - * Fill in the mode and permission information for the jnode structure. - */ - - node->st_mode = mode & ~rtems_filesystem_umask; - -#if defined(RTEMS_POSIX_API) - node->st_uid = geteuid(); - node->st_gid = getegid(); -#else - node->st_uid = 0; - node->st_gid = 0; -#endif - - /* - * Now set all the times. - */ - - gettimeofday( &tv, 0 ); - - node->stat_atime = (time_t) tv.tv_sec; - node->stat_mtime = (time_t) tv.tv_sec; - node->stat_ctime = (time_t) tv.tv_sec; - - /* - * Set the type specific information - */ - - switch (type) { - case IMFS_DIRECTORY: - Chain_Initialize_empty(&node->info.directory.Entries); - break; - - case IMFS_HARD_LINK: - node->info.hard_link.link_node = info->hard_link.link_node; - break; - - case IMFS_SYM_LINK: - sym_name = calloc( 1, strlen( info->sym_link.name ) + 1 ); - strcpy( sym_name, info->sym_link.name ); - node->info.sym_link.name = sym_name; - break; - - case IMFS_DEVICE: - node->info.device.major = info->device.major; - node->info.device.minor = info->device.minor; - break; - - case IMFS_LINEAR_FILE: - node->info.linearfile.size = 0; - node->info.linearfile.direct = 0; - - case IMFS_MEMORY_FILE: - node->info.file.size = 0; - node->info.file.indirect = 0; - node->info.file.doubly_indirect = 0; - node->info.file.triply_indirect = 0; - break; - - default: - assert(0); - break; - } - - /* - * If this node has a parent, then put it in that directory list. - */ - - if ( parent ) { - Chain_Append( &parent->info.directory.Entries, &node->Node ); - node->Parent = parent; - - fs_info = parent_loc->mt_entry->fs_info; - node->st_ino = ++fs_info->ino_count; - } - - - return node; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_debug.c b/c/src/exec/libfs/src/imfs/imfs_debug.c deleted file mode 100644 index f852c81d8b..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_debug.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * IMFS debug support routines - * - * 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 /* for close */ - -#include -#include - -#include "imfs.h" -#include - -/* - * IMFS_types - * - * Printable names for each of the IMFS file system types. - */ - -char *IMFS_types[ IMFS_NUMBER_OF_TYPES ] = { - "directory", - "device", - "link", - "memory file", - "linear file" -}; - -/* - * IMFS_print_jnode - * - * This routine prints the contents of the specified jnode. - */ - -void IMFS_print_jnode( - IMFS_jnode_t *the_jnode -) -{ - assert( the_jnode ); - - printf( "%s", the_jnode->name ); - switch( the_jnode->type ) { - case IMFS_DIRECTORY: - printf( "/" ); - break; - - case IMFS_DEVICE: - printf( " (device %d, %d)", - the_jnode->info.device.major, the_jnode->info.device.minor ); - break; - - case IMFS_LINEAR_FILE: - printf( " (file %d %p)", - (int)the_jnode->info.linearfile.size, - the_jnode->info.linearfile.direct - ); - break; - - case IMFS_MEMORY_FILE: - /* Useful when debugging .. varies between targets */ -#if 0 - printf( " (file %d %p %p %p)", - (int)the_jnode->info.file.size, - the_jnode->info.file.indirect, - the_jnode->info.file.doubly_indirect, - the_jnode->info.file.triply_indirect - ); -#else - printf( " (file %d)", (int)the_jnode->info.file.size ); -#endif - break; - - case IMFS_HARD_LINK: - printf( " links not printed\n" ); - assert(0); - break; - - case IMFS_SYM_LINK: - printf( " links not printed\n" ); - assert(0); - break; - - default: - printf( " bad type %d\n", the_jnode->type ); - assert(0); - break; - } - puts(""); -} - -/* - * IMFS_dump_directory - * - * This routine prints the contents of a directory in the IMFS. If a - * directory is encountered, then this routine will recurse to process - * the subdirectory. - */ - -void IMFS_dump_directory( - IMFS_jnode_t *the_directory, - int level -) -{ - Chain_Node *the_node; - Chain_Control *the_chain; - IMFS_jnode_t *the_jnode; - int i; - - assert( the_directory ); - - assert( level >= 0 ); - - assert( the_directory->type == IMFS_DIRECTORY ); - - the_chain = &the_directory->info.directory.Entries; - - for ( the_node = the_chain->first; - !_Chain_Is_tail( the_chain, the_node ); - the_node = the_node->next ) { - - the_jnode = (IMFS_jnode_t *) the_node; - - for ( i=0 ; i<=level ; i++ ) - printf( "...." ); - IMFS_print_jnode( the_jnode ); - if ( the_jnode->type == IMFS_DIRECTORY ) - IMFS_dump_directory( the_jnode, level + 1 ); - } -} - -/* - * IMFS_dump - * - * This routine dumps the entire IMFS that is mounted at the root - * directory. - * - * NOTE: Assuming the "/" directory is bad. - * Not checking that the starting directory is in an IMFS is bad. - */ - -void IMFS_dump( void ) -{ - printf( "*************** Dump of Entire IMFS ***************\n" ); - printf( "/\n" ); - IMFS_dump_directory( rtems_filesystem_root.node_access, 0 ); - printf( "*************** End of Dump ***************\n" ); -} - -/* - * IMFS_memfile_maximum_size() - * - * This routine returns the size of the largest file which can be created - * using the IMFS memory file type. - * - */ - -int IMFS_memfile_maximum_size( void ) -{ - return IMFS_MEMFILE_MAXIMUM_SIZE; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_directory.c b/c/src/exec/libfs/src/imfs/imfs_directory.c deleted file mode 100644 index dec1e0ec2d..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_directory.c +++ /dev/null @@ -1,353 +0,0 @@ -/* - * IMFS Directory Access Routines - * - * 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 "imfs.h" -#include -#include - -/* - * imfs_dir_open - * - * This rountine will verify that the node being opened as a directory is - * in fact a directory node. If it is then the offset into the directory - * will be set to 0 to position to the first directory entry. - */ - -int imfs_dir_open( - rtems_libio_t *iop, - const char *pathname, - unsigned32 flag, - unsigned32 mode -) -{ - IMFS_jnode_t *the_jnode; - - /* Is the node a directory ? */ - the_jnode = (IMFS_jnode_t *) iop->file_info; - - if ( the_jnode->type != IMFS_DIRECTORY ) - return -1; /* It wasn't a directory --> return error */ - - iop->offset = 0; - return 0; -} - -/* - * imfs_dir_read - * - * This routine will read the next directory entry based on the directory - * offset. The offset should be equal to -n- time the size of an individual - * dirent structure. If n is not an integer multiple of the sizeof a - * dirent structure, an integer division will be performed to determine - * directory entry that will be returned in the buffer. Count should reflect - * -m- times the sizeof dirent bytes to be placed in the buffer. - * If there are not -m- dirent elements from the current directory position - * to the end of the exisiting file, the remaining entries will be placed in - * the buffer and the returned value will be equal to -m actual- times the - * size of a directory entry. - */ - -int imfs_dir_read( - rtems_libio_t *iop, - void *buffer, - unsigned32 count -) -{ - /* - * Read up to element iop->offset in the directory chain of the - * imfs_jnode_t struct for this file descriptor. - */ - Chain_Node *the_node; - Chain_Control *the_chain; - IMFS_jnode_t *the_jnode; - int bytes_transferred; - int current_entry; - int first_entry; - int last_entry; - struct dirent tmp_dirent; - - the_jnode = (IMFS_jnode_t *)iop->file_info; - the_chain = &the_jnode->info.directory.Entries; - - if ( Chain_Is_empty( the_chain ) ) - return 0; - - /* Move to the first of the desired directory entries */ - the_node = the_chain->first; - - bytes_transferred = 0; - first_entry = iop->offset; - /* protect against using sizes that are not exact multiples of the */ - /* -dirent- size. These could result in unexpected results */ - last_entry = first_entry + (count/sizeof(struct dirent)) * sizeof(struct dirent); - - /* The directory was not empty so try to move to the desired entry in chain*/ - for ( - current_entry = 0; - current_entry < last_entry; - current_entry = current_entry + sizeof(struct dirent) ){ - - if ( Chain_Is_tail( the_chain, the_node ) ){ - /* We hit the tail of the chain while trying to move to the first */ - /* entry in the read */ - return bytes_transferred; /* Indicate that there are no more */ - /* entries to return */ - } - - if( current_entry >= first_entry ) { - /* Move the entry to the return buffer */ - tmp_dirent.d_off = current_entry; - tmp_dirent.d_reclen = sizeof( struct dirent ); - the_jnode = (IMFS_jnode_t *) the_node; - tmp_dirent.d_ino = the_jnode->st_ino; - tmp_dirent.d_namlen = strlen( the_jnode->name ); - strcpy( tmp_dirent.d_name, the_jnode->name ); - memcpy( - buffer + bytes_transferred, - (void *)&tmp_dirent, - sizeof( struct dirent ) - ); - iop->offset = iop->offset + sizeof(struct dirent); - bytes_transferred = bytes_transferred + sizeof( struct dirent ); - } - - the_node = the_node->next; - } - - /* Success */ - return bytes_transferred; -} - - - -/* - * imfs_dir_close - * - * This routine will be called by the generic close routine to cleanup any - * resources that have been allocated for the management of the file - */ - -int imfs_dir_close( - rtems_libio_t *iop -) -{ - /* - * The generic close routine handles the deallocation of the file control - * and associated memory. At present the imfs_dir_close simply - * returns a successful completion status. - */ - - return 0; -} - - - -/* - * imfs_dir_lseek - * - * This routine will behave in one of three ways based on the state of - * argument whence. Based on the state of its value the offset argument will - * be interpreted using one of the following methods: - * - * SEEK_SET - offset is the absolute byte offset from the start of the - * logical start of the dirent sequence that represents the - * directory - * SEEK_CUR - offset is used as the relative byte offset from the current - * directory position index held in the iop structure - * SEEK_END - N/A --> This will cause an assert. - */ - -int imfs_dir_lseek( - rtems_libio_t *iop, - off_t offset, - int whence -) -{ - switch( whence ) { - case SEEK_SET: /* absolute move from the start of the file */ - case SEEK_CUR: /* relative move */ - iop->offset = (iop->offset/sizeof(struct dirent)) * - sizeof(struct dirent); - break; - - case SEEK_END: /* Movement past the end of the directory via lseek */ - /* is not a permitted operation */ - default: - rtems_set_errno_and_return_minus_one( EINVAL ); - break; - } - - return 0; -} - - - -/* - * imfs_dir_fstat - * - * This routine will obtain the following information concerning the current - * directory: - * st_dev 0ll - * st_ino 1 - * st_mode mode extracted from the jnode - * st_nlink number of links to this node - * st_uid uid extracted from the jnode - * st_gid gid extracted from the jnode - * st_rdev 0ll - * st_size the number of bytes in the directory - * This is calculated by taking the number of entries - * in the directory and multiplying by the size of a - * dirent structure - * st_blksize 0 - * st_blocks 0 - * stat_atime time of last access - * stat_mtime time of last modification - * stat_ctime time of the last change - * - * This information will be returned to the calling function in a -stat- struct - * - */ - -int imfs_dir_fstat( - rtems_filesystem_location_info_t *loc, - struct stat *buf -) -{ - Chain_Node *the_node; - Chain_Control *the_chain; - IMFS_jnode_t *the_jnode; - - - the_jnode = (IMFS_jnode_t *) loc->node_access; - - buf->st_dev = 0ll; - buf->st_ino = the_jnode->st_ino; - buf->st_mode = the_jnode->st_mode; - buf->st_nlink = the_jnode->st_nlink; - buf->st_uid = the_jnode->st_uid; - buf->st_gid = the_jnode->st_gid; - buf->st_rdev = 0ll; - buf->st_blksize = 0; - buf->st_blocks = 0; - buf->st_atime = the_jnode->stat_atime; - buf->st_mtime = the_jnode->stat_mtime; - buf->st_ctime = the_jnode->stat_ctime; - - buf->st_size = 0; - - the_chain = &the_jnode->info.directory.Entries; - - /* Run through the chain and count the number of directory entries */ - /* that are subordinate to this directory node */ - for ( the_node = the_chain->first ; - !_Chain_Is_tail( the_chain, the_node ) ; - the_node = the_node->next ) { - - buf->st_size = buf->st_size + sizeof( struct dirent ); - } - - return 0; -} - -/* - * IMFS_dir_rmnod - * - * This routine is available from the optable to remove a node - * from the IMFS file system. - */ - -int imfs_dir_rmnod( - rtems_filesystem_location_info_t *pathloc /* IN */ -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = (IMFS_jnode_t *) pathloc->node_access; - - /* - * You cannot remove a node that still has children - */ - - if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) ) - rtems_set_errno_and_return_minus_one( ENOTEMPTY ); - - /* - * You cannot remove the file system root node. - */ - - if ( pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access ) - rtems_set_errno_and_return_minus_one( EBUSY ); - - /* - * You cannot remove a mountpoint. - */ - - if ( the_jnode->info.directory.mt_fs != NULL ) - rtems_set_errno_and_return_minus_one( EBUSY ); - - /* - * Take the node out of the parent's chain that contains this node - */ - - if ( the_jnode->Parent != NULL ) { - Chain_Extract( (Chain_Node *) the_jnode ); - the_jnode->Parent = NULL; - } - - /* - * Decrement the link counter and see if we can free the space. - */ - - the_jnode->st_nlink--; - IMFS_update_ctime( the_jnode ); - - /* - * The file cannot be open and the link must be less than 1 to free. - */ - - if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { - - /* - * Is the rtems_filesystem_current is this node? - */ - - if ( rtems_filesystem_current.node_access == pathloc->node_access ) - rtems_filesystem_current.node_access = NULL; - - /* - * Free memory associated with a memory file. - */ - - free( the_jnode ); - } - - return 0; - -} - - diff --git a/c/src/exec/libfs/src/imfs/imfs_eval.c b/c/src/exec/libfs/src/imfs/imfs_eval.c deleted file mode 100644 index 09838230cb..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_eval.c +++ /dev/null @@ -1,660 +0,0 @@ -/* - * Evaluation IMFS Node Support Routines - * - * 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 "imfs.h" -#include -#include - -#define RTEMS_LIBIO_PERMS_RX (RTEMS_LIBIO_PERMS_SEARCH | RTEMS_LIBIO_PERMS_READ) -#define RTEMS_LIBIO_PERMS_WX (RTEMS_LIBIO_PERMS_SEARCH | RTEMS_LIBIO_PERMS_WRITE) - -#define MAXSYMLINK 5 - -int IMFS_Set_handlers( - rtems_filesystem_location_info_t *loc -) -{ - IMFS_jnode_t *node = loc->node_access; - IMFS_fs_info_t *fs_info; - - fs_info = loc->mt_entry->fs_info; - switch( node->type ) { - case IMFS_DIRECTORY: - loc->handlers = fs_info->directory_handlers; - break; - case IMFS_DEVICE: - loc->handlers = &IMFS_device_handlers; - break; - case IMFS_SYM_LINK: - case IMFS_HARD_LINK: - loc->handlers = &IMFS_link_handlers; - break; - case IMFS_LINEAR_FILE: - loc->handlers = fs_info->linearfile_handlers; - break; - case IMFS_MEMORY_FILE: - loc->handlers = fs_info->memfile_handlers; - break; - } - - return 0; -} - -/* - * IMFS_evaluate_permission - * - * The following routine evaluates that we have permission - * to do flags on the node. - */ - -int IMFS_evaluate_permission( - rtems_filesystem_location_info_t *node, - int flags -) -{ - uid_t st_uid; - gid_t st_gid; - IMFS_jnode_t *jnode; - int flags_to_test; - - if ( !rtems_libio_is_valid_perms( flags ) ) { - assert( 0 ); - rtems_set_errno_and_return_minus_one( EIO ); - } - - jnode = node->node_access; - -#if defined(RTEMS_POSIX_API) - st_uid = geteuid(); - st_gid = getegid(); -#else - st_uid = jnode->st_uid; - st_gid = jnode->st_gid; -#endif - - /* - * Check if I am owner or a group member or someone else. - */ - - flags_to_test = flags; - - if ( st_uid == jnode->st_uid ) - flags_to_test <<= 6; - else if ( st_gid == jnode->st_gid ) - flags_to_test <<= 3; - else - /* must be other - do nothing */; - - /* - * If all of the flags are set we have permission - * to do this. - */ - if ( ( flags_to_test & jnode->st_mode) == flags_to_test ) - return 1; - - return 0; -} - -/* - * IMFS_evaluate_hard_link - * - * The following routine evaluates a hardlink to the actual node. - */ - -int IMFS_evaluate_hard_link( - rtems_filesystem_location_info_t *node, /* IN/OUT */ - int flags /* IN */ -) -{ - IMFS_jnode_t *jnode = node->node_access; - int result = 0; - - /* - * Check for things that should never happen. - */ - - if ( jnode->type != IMFS_HARD_LINK ) - rtems_fatal_error_occurred (0xABCD0000); - - /* - * Set the hard link value and the handlers. - */ - - node->node_access = jnode->info.hard_link.link_node; - - IMFS_Set_handlers( node ); - - /* - * Verify we have the correct permissions for this node. - */ - - if ( !IMFS_evaluate_permission( node, flags ) ) - rtems_set_errno_and_return_minus_one( EACCES ); - - return result; -} - - -/* - * IMFS_evaluate_sym_link - * - * The following routine evaluates a symbolic link to the actual node. - */ - -int IMFS_evaluate_sym_link( - rtems_filesystem_location_info_t *node, /* IN/OUT */ - int flags /* IN */ -) -{ - IMFS_jnode_t *jnode = node->node_access; - int result = 0; - int i; - - /* - * Check for things that should never happen. - */ - - if ( jnode->type != IMFS_SYM_LINK ) - rtems_fatal_error_occurred (0xABCD0000); - - if ( !jnode->Parent ) - rtems_fatal_error_occurred( 0xBAD00000 ); - - - /* - * Move the node_access to either the symbolic links parent or - * root depending on the symbolic links path. - */ - - node->node_access = jnode->Parent; - - rtems_filesystem_get_sym_start_loc( - jnode->info.sym_link.name, - &i, - node - ); - - /* - * Use eval path to evaluate the path of the symbolic link. - */ - - result = IMFS_eval_path( - &jnode->info.sym_link.name[i], - flags, - node - ); - - IMFS_Set_handlers( node ); - - /* - * Verify we have the correct permissions for this node. - */ - - if ( !IMFS_evaluate_permission( node, flags ) ) - rtems_set_errno_and_return_minus_one( EACCES ); - - return result; -} - -/* - * IMFS_evaluate_link - * - * The following routine returns the real node pointed to by a link. - */ - -int IMFS_evaluate_link( - rtems_filesystem_location_info_t *node, /* IN/OUT */ - int flags /* IN */ -) -{ - IMFS_jnode_t *jnode; - int result = 0; - - do { - jnode = node->node_access; - - /* - * Increment and check the link counter. - */ - - rtems_filesystem_link_counts ++; - if ( rtems_filesystem_link_counts > MAXSYMLINK ) { - rtems_filesystem_link_counts = 0; - rtems_set_errno_and_return_minus_one( ELOOP ); - } - - /* - * Follow the Link node. - */ - - if ( jnode->type == IMFS_HARD_LINK ) - result = IMFS_evaluate_hard_link( node, flags ); - - else if (jnode->type == IMFS_SYM_LINK ) - result = IMFS_evaluate_sym_link( node, flags ); - - } while ( ( result == 0 ) && ( ( jnode->type == IMFS_SYM_LINK ) || - ( jnode->type == IMFS_HARD_LINK ) ) ); - - /* - * Clear link counter. - */ - - rtems_filesystem_link_counts = 0; - - return result; -} - - -/* - * IMFS_evaluate_for_make - * - * The following routine evaluate path for a new node to be created. - * pathloc is returned with a pointer to the parent of the new node. - * name is returned with a pointer to the first character in the - * new node name. The parent node is verified to be a directory. - */ - -int IMFS_evaluate_for_make( - const char *path, /* IN */ - rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ - const char **name /* OUT */ -) -{ - int i = 0; - int len; - IMFS_token_types type; - char token[ IMFS_NAME_MAX + 1 ]; - rtems_filesystem_location_info_t newloc; - IMFS_jnode_t *node; - int done = 0; - int result; - - /* - * This was filled in by the caller and is valid in the - * mount table. - */ - node = pathloc->node_access; - - /* - * Evaluate all tokens until we are done or an error occurs. - */ - - while( !done ) { - - type = IMFS_get_token( &path[i], token, &len ); - i += len; - - if ( !pathloc->node_access ) - rtems_set_errno_and_return_minus_one( ENOENT ); - - /* - * I cannot move out of this directory without execute permission. - */ - - if ( type != IMFS_NO_MORE_PATH ) - if ( node->type == IMFS_DIRECTORY ) - if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) - rtems_set_errno_and_return_minus_one( EACCES ); - - node = pathloc->node_access; - - switch( type ) { - - case IMFS_UP_DIR: - /* - * Am I at the root of all filesystems? (chroot'ed?) - */ - - if ( pathloc->node_access == rtems_filesystem_root.node_access ) - break; /* Throw out the .. in this case */ - - - /* - * Am I at the root of this mounted filesystem? - */ - - if (pathloc->node_access == pathloc->mt_entry->mt_fs_root.node_access){ - - /* - * Am I at the root of all filesystems? - */ - - if ( pathloc->node_access == rtems_filesystem_root.node_access ) { - break; - - } else { - newloc = pathloc->mt_entry->mt_point_node; - *pathloc = newloc; - return (*pathloc->ops->evalformake_h)( &path[i-len], pathloc, name ); - } - } else { - - if ( !node->Parent ) - rtems_set_errno_and_return_minus_one( ENOENT ); - - node = node->Parent; - } - - pathloc->node_access = node; - break; - - case IMFS_NAME: - - if ( node->type == IMFS_HARD_LINK ) { - - result = IMFS_evaluate_link( pathloc, 0 ); - if ( result == -1 ) - return -1; - - } else if ( node->type == IMFS_SYM_LINK ) { - - result = IMFS_evaluate_link( pathloc, 0 ); - - if ( result == -1 ) - return -1; - } - - node = pathloc->node_access; - if ( !node ) - rtems_set_errno_and_return_minus_one( ENOTDIR ); - - /* - * Only a directory can be decended into. - */ - - if ( node->type != IMFS_DIRECTORY ) - rtems_set_errno_and_return_minus_one( ENOTDIR ); - - /* - * If we are at a node that is a mount point. Set loc to the - * new fs root node and let them finish evaluating the path. - */ - - if ( node->info.directory.mt_fs != NULL ) { - newloc = node->info.directory.mt_fs->mt_fs_root; - *pathloc = newloc; - return (*pathloc->ops->evalformake_h)( &path[i-len], pathloc, name ); - } - - /* - * Otherwise find the token name in the present location. - */ - - node = IMFS_find_match_in_dir( node, token ); - - /* - * If there is no node we have found the name of the node we - * wish to create. - */ - - if ( ! node ) - done = TRUE; - else - pathloc->node_access = node; - - break; - - case IMFS_NO_MORE_PATH: - rtems_set_errno_and_return_minus_one( EEXIST ); - break; - - case IMFS_INVALID_TOKEN: - rtems_set_errno_and_return_minus_one( ENAMETOOLONG ); - break; - - case IMFS_CURRENT_DIR: - break; - } - } - - *name = &path[ i - len ]; - - /* - * We have evaluated the path as far as we can. - * Verify there is not any invalid stuff at the end of the name. - */ - - for( ; path[i] != '\0'; i++) { - if ( !IMFS_is_separator( path[ i ] ) ) - rtems_set_errno_and_return_minus_one( ENOENT ); - } - - /* - * Verify we can execute and write to this directory. - */ - - result = IMFS_Set_handlers( pathloc ); - - /* - * The returned node must be a directory - */ - node = pathloc->node_access; - if ( node->type != IMFS_DIRECTORY ) - rtems_set_errno_and_return_minus_one( ENOTDIR ); - - /* - * We must have Write and execute permission on the returned node. - */ - - if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) ) - rtems_set_errno_and_return_minus_one( EACCES ); - - return result; -} - - -/* - * IMFS_eval_path - * - * The following routine evaluate path for a node that wishes to be - * accessed with mode. pathloc is returned with a pointer to the - * node to be accessed. - */ - -int IMFS_eval_path( - const char *pathname, /* IN */ - int flags, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */ -) -{ - int i = 0; - int len; - IMFS_token_types type = IMFS_CURRENT_DIR; - char token[ IMFS_NAME_MAX + 1 ]; - rtems_filesystem_location_info_t newloc; - IMFS_jnode_t *node; - int result; - - if ( !rtems_libio_is_valid_perms( flags ) ) { - assert( 0 ); - rtems_set_errno_and_return_minus_one( EIO ); - } - - /* - * This was filled in by the caller and is valid in the - * mount table. - */ - - node = pathloc->node_access; - - /* - * Evaluate all tokens until we are done or an error occurs. - */ - - while( (type != IMFS_NO_MORE_PATH) && (type != IMFS_INVALID_TOKEN) ) { - - type = IMFS_get_token( &pathname[i], token, &len ); - i += len; - - if ( !pathloc->node_access ) - rtems_set_errno_and_return_minus_one( ENOENT ); - - /* - * I cannot move out of this directory without execute permission. - */ - if ( type != IMFS_NO_MORE_PATH ) - if ( node->type == IMFS_DIRECTORY ) - if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) - rtems_set_errno_and_return_minus_one( EACCES ); - - node = pathloc->node_access; - - switch( type ) { - case IMFS_UP_DIR: - /* - * Am I at the root of all filesystems? (chroot'ed?) - */ - - if ( pathloc->node_access == rtems_filesystem_root.node_access ) - break; /* Throw out the .. in this case */ - - /* - * Am I at the root of this mounted filesystem? - */ - - if (pathloc->node_access == - pathloc->mt_entry->mt_fs_root.node_access) { - - /* - * Am I at the root of all filesystems? - */ - - if ( pathloc->node_access == rtems_filesystem_root.node_access ) { - break; /* Throw out the .. in this case */ - } else { - newloc = pathloc->mt_entry->mt_point_node; - *pathloc = newloc; - return (*pathloc->ops->evalpath_h)(&(pathname[i-len]),flags,pathloc); - } - } else { - - if ( !node->Parent ) - rtems_set_errno_and_return_minus_one( ENOENT ); - - node = node->Parent; - pathloc->node_access = node; - - } - - pathloc->node_access = node; - break; - - case IMFS_NAME: - /* - * If we are at a link follow it. - */ - - if ( node->type == IMFS_HARD_LINK ) { - - IMFS_evaluate_hard_link( pathloc, 0 ); - - node = pathloc->node_access; - if ( !node ) - rtems_set_errno_and_return_minus_one( ENOTDIR ); - - } else if ( node->type == IMFS_SYM_LINK ) { - - result = IMFS_evaluate_sym_link( pathloc, 0 ); - - node = pathloc->node_access; - if ( result == -1 ) - return -1; - } - - /* - * Only a directory can be decended into. - */ - - if ( node->type != IMFS_DIRECTORY ) - rtems_set_errno_and_return_minus_one( ENOTDIR ); - - /* - * If we are at a node that is a mount point. Set loc to the - * new fs root node and let them finish evaluating the path. - */ - - if ( node->info.directory.mt_fs != NULL ) { - newloc = node->info.directory.mt_fs->mt_fs_root; - *pathloc = newloc; - return (*pathloc->ops->evalpath_h)( &pathname[i-len], flags, pathloc ); - } - - /* - * Otherwise find the token name in the present location. - */ - - node = IMFS_find_match_in_dir( node, token ); - if ( !node ) - rtems_set_errno_and_return_minus_one( ENOENT ); - - /* - * Set the node access to the point we have found. - */ - - pathloc->node_access = node; - break; - - case IMFS_NO_MORE_PATH: - case IMFS_CURRENT_DIR: - break; - - case IMFS_INVALID_TOKEN: - rtems_set_errno_and_return_minus_one( ENAMETOOLONG ); - break; - - } - } - - /* - * Always return the root node. - * - * If we are at a node that is a mount point. Set loc to the - * new fs root node and let let the mounted filesystem set the handlers. - * - * NOTE: The behavior of stat() on a mount point appears to be questionable. - */ - - if ( node->type == IMFS_DIRECTORY ) { - if ( node->info.directory.mt_fs != NULL ) { - newloc = node->info.directory.mt_fs->mt_fs_root; - *pathloc = newloc; - return (*pathloc->ops->evalpath_h)( &pathname[i-len], flags, pathloc ); - } else { - result = IMFS_Set_handlers( pathloc ); - } - } else { - result = IMFS_Set_handlers( pathloc ); - } - - /* - * Verify we have the correct permissions for this node. - */ - - if ( !IMFS_evaluate_permission( pathloc, flags ) ) - rtems_set_errno_and_return_minus_one( EACCES ); - - return result; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_fchmod.c b/c/src/exec/libfs/src/imfs/imfs_fchmod.c deleted file mode 100644 index cf7c644793..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_fchmod.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * IMFS file change mode 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 -#include "imfs.h" - -int IMFS_fchmod( - rtems_filesystem_location_info_t *loc, - mode_t mode -) -{ - IMFS_jnode_t *jnode; -#if defined(RTEMS_POSIX_API) - uid_t st_uid; -#endif - - jnode = loc->node_access; - - /* - * Verify I am the owner of the node or the super user. - */ -#if defined(RTEMS_POSIX_API) - st_uid = geteuid(); - - if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) ) - rtems_set_errno_and_return_minus_one( EPERM ); -#endif - - /* - * Change only the RWX permissions on the jnode to mode. - */ - if ( mode & (~ (S_IRWXU | S_IRWXG | S_IRWXO ) ) ) - rtems_set_errno_and_return_minus_one( EPERM ); - - /* - * If we make a linear-file writeable, construct a block file - * from it first. - */ - if ( (jnode->type == IMFS_LINEAR_FILE) && - (mode & (S_IWUSR | S_IWGRP | S_IWOTH)) ) - { - unsigned32 count = jnode->info.linearfile.size; - const unsigned char *buffer = jnode->info.linearfile.direct; - - jnode->type = IMFS_MEMORY_FILE; - jnode->info.file.size = 0; - jnode->info.file.indirect = 0; - jnode->info.file.doubly_indirect = 0; - jnode->info.file.triply_indirect = 0; - if (IMFS_memfile_write(jnode, 0, buffer, count) == -1) - return(-1); - } - - jnode->st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO); - jnode->st_mode |= mode; - - IMFS_update_ctime( jnode ); - - return 0; -} - diff --git a/c/src/exec/libfs/src/imfs/imfs_fcntl.c b/c/src/exec/libfs/src/imfs/imfs_fcntl.c deleted file mode 100644 index a21d5a5720..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_fcntl.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * IMFS_fcntl - * - * The following routine does a fcntl on an IMFS node. - * - * 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 "imfs.h" - -int IMFS_fcntl( - int cmd, - rtems_libio_t *iop -) -{ - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_fdatasync.c b/c/src/exec/libfs/src/imfs/imfs_fdatasync.c deleted file mode 100644 index 1a5b9fdcd1..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_fdatasync.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * IMFS_fdatasync - * - * The following routine does a sync on an IMFS node. The In Memory - * File System is always in sync, therefore this routine always returns - * pass. - * - * 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 "imfs.h" - -int IMFS_fdatasync( - rtems_libio_t *iop -) -{ - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_free.c b/c/src/exec/libfs/src/imfs/imfs_free.c deleted file mode 100644 index 01e07d9bf2..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_free.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Free IMFS Node Support Routines - * - * - * 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 "imfs.h" - -/* - * IMFS_freenodinfo - * - * This routine is the IMFS free node handler for the file system - * operations table. - * - * The In Memory File System keeps its nodes in memory. This routine - * is for file sytems that do not. - */ - -int IMFS_freenodinfo( - rtems_filesystem_location_info_t *pathloc /* IN */ -) -{ - return 0; -} - diff --git a/c/src/exec/libfs/src/imfs/imfs_fsunmount.c b/c/src/exec/libfs/src/imfs/imfs_fsunmount.c deleted file mode 100644 index 3425d6cfa2..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_fsunmount.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * IMFS 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 /* for mkdir */ -#include -#include -#include - -#include - -#include "imfs.h" -#include - -#if defined(IMFS_DEBUG) -#include -#endif - -/* - * IMFS_fsunmount - */ - -#define jnode_get_control( jnode ) \ - (&jnode->info.directory.Entries) - -#define jnode_has_no_children( jnode ) \ - Chain_Is_empty( jnode_get_control( jnode ) ) - -#define jnode_has_children( jnode ) \ - ( ! jnode_has_no_children( jnode ) ) - -#define jnode_get_first_child( jnode ) \ - ((IMFS_jnode_t *)( Chain_Head( jnode_get_control( jnode ) )->next)) - -int IMFS_fsunmount( - rtems_filesystem_mount_table_entry_t *temp_mt_entry -) -{ - IMFS_jnode_t *jnode; - IMFS_jnode_t *next; - rtems_filesystem_location_info_t loc; - int result = 0; - - /* - * Traverse tree that starts at the mt_fs_root and deallocate memory - * associated memory space - */ - - jnode = (IMFS_jnode_t *)temp_mt_entry->mt_fs_root.node_access; - loc = temp_mt_entry->mt_fs_root; - - /* - * Set this to null to indicate that it is being unmounted. - */ - - temp_mt_entry->mt_fs_root.node_access = NULL; - - do { - next = jnode->Parent; - loc.node_access = (void *)jnode; - IMFS_Set_handlers( &loc ); - - if ( jnode->type != IMFS_DIRECTORY ) { - result = IMFS_unlink( &loc ); - if (result != 0) - return -1; - jnode = next; - } else if ( jnode_has_no_children( jnode ) ) { - result = IMFS_unlink( &loc ); - if (result != 0) - return -1; - jnode = next; - } - if ( jnode != NULL ) { - if ( jnode->type == IMFS_DIRECTORY ) { - if ( jnode_has_children( jnode ) ) - jnode = jnode_get_first_child( jnode ); - } - } - } while (jnode != NULL); - - return 0; -} - - - - diff --git a/c/src/exec/libfs/src/imfs/imfs_getchild.c b/c/src/exec/libfs/src/imfs/imfs_getchild.c deleted file mode 100644 index 8b173afc91..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_getchild.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * IMFS_find_match_in_dir() - * - * This routine returns the child name in the given 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 "imfs.h" - -static char dotname[2] = "."; -static char dotdotname[3] = ".."; - -IMFS_jnode_t *IMFS_find_match_in_dir( - IMFS_jnode_t *directory, - char *name -) -{ - Chain_Node *the_node; - Chain_Control *the_chain; - IMFS_jnode_t *the_jnode; - - /* - * Check for fatal errors. A NULL directory show a problem in the - * the IMFS code. - */ - - assert( directory ); - if ( !name ) - return 0; - - assert( name ); - if ( !directory ) - return 0; - - /* - * Check for "." and ".." - */ - - if ( !strcmp( name, dotname ) ) - return directory; - - if ( !strcmp( name, dotdotname ) ) - return directory->Parent; - - the_chain = &directory->info.directory.Entries; - - for ( the_node = the_chain->first; - !_Chain_Is_tail( the_chain, the_node ); - the_node = the_node->next ) { - - the_jnode = (IMFS_jnode_t *) the_node; - - if ( !strcmp( name, the_jnode->name ) ) - return the_jnode; - } - - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_gtkn.c b/c/src/exec/libfs/src/imfs/imfs_gtkn.c deleted file mode 100644 index c5e51c182b..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_gtkn.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * IMFS_get_token - * - * Routine to get a token (name or separator) from the path - * the length of the token is returned in token_len. - * - * 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 "imfs.h" -#include - -IMFS_token_types IMFS_get_token( - const char *path, - char *token, - int *token_len -) -{ - register int i = 0; - IMFS_token_types type = IMFS_NAME; - register char c; - - /* - * Copy a name into token. (Remember NULL is a token.) - */ - c = path[i]; - while ( (!IMFS_is_separator(c)) && (i <= IMFS_NAME_MAX) ) { - - token[i] = c; - - if ( i == IMFS_NAME_MAX ) - return IMFS_INVALID_TOKEN; - - if ( !IMFS_is_valid_name_char(c) ) - type = IMFS_INVALID_TOKEN; - - c = path [++i]; - } - - /* - * Copy a seperator into token. - */ - - if ( i == 0 ) { - token[i] = c; - - if ( token[i] != '\0' ) { - i++; - type = IMFS_CURRENT_DIR; - } else { - type = IMFS_NO_MORE_PATH; - } - } else if (token[ i-1 ] != '\0') { - token[i] = '\0'; - } - - /* - * Set token_len to the number of characters copied. - */ - - *token_len = i; - - /* - * If we copied something that was not a seperator see if - * it was a special name. - */ - - if ( type == IMFS_NAME ) { - if ( strcmp( token, "..") == 0 ) - type = IMFS_UP_DIR; - else if ( strcmp( token, "." ) == 0 ) - type = IMFS_CURRENT_DIR; - } - - return type; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_handlers_device.c b/c/src/exec/libfs/src/imfs/imfs_handlers_device.c deleted file mode 100644 index 753c7f50c4..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_handlers_device.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Device Operations Table for the IMFS - * - * 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 "imfs.h" - -/* - * Handler table for IMFS device nodes - */ - -rtems_filesystem_file_handlers_r IMFS_device_handlers = { - device_open, - device_close, - device_read, - device_write, - device_ioctl, - device_lseek, - IMFS_stat, - IMFS_fchmod, - NULL, /* ftruncate */ - NULL, /* fpathconf */ - NULL, /* fsync */ - NULL, /* fdatasync */ - NULL, /* fcntl */ - IMFS_rmnod -}; diff --git a/c/src/exec/libfs/src/imfs/imfs_handlers_directory.c b/c/src/exec/libfs/src/imfs/imfs_handlers_directory.c deleted file mode 100644 index 21528711a4..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_handlers_directory.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Operations Table for Directories for the IMFS - * - * 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 "imfs.h" - -/* - * Set of operations handlers for operations on directories. - */ - -rtems_filesystem_file_handlers_r IMFS_directory_handlers = { - imfs_dir_open, - imfs_dir_close, - imfs_dir_read, - NULL, /* write */ - NULL, /* ioctl */ - imfs_dir_lseek, - imfs_dir_fstat, - IMFS_fchmod, - NULL, /* ftruncate */ - NULL, /* fpathconf */ - NULL, /* fsync */ - IMFS_fdatasync, - IMFS_fcntl, - imfs_dir_rmnod -}; - diff --git a/c/src/exec/libfs/src/imfs/imfs_handlers_link.c b/c/src/exec/libfs/src/imfs/imfs_handlers_link.c deleted file mode 100644 index a8383db605..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_handlers_link.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Link Operations Table for the IMFS - * - * 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 "imfs.h" - -/* - * Handler table for IMFS device nodes - */ - -rtems_filesystem_file_handlers_r IMFS_link_handlers = { - NULL, /* open */ - NULL, /* close */ - NULL, /* read */ - NULL, /* write */ - NULL, /* ioctl */ - NULL, /* lseek */ - IMFS_stat, /* stat */ - NULL, /* fchmod */ - NULL, /* ftruncate */ - NULL, /* fpathconf */ - NULL, /* fsync */ - NULL, /* fdatasync */ - NULL, /* fcntl */ - IMFS_rmnod -}; diff --git a/c/src/exec/libfs/src/imfs/imfs_handlers_memfile.c b/c/src/exec/libfs/src/imfs/imfs_handlers_memfile.c deleted file mode 100644 index 4458d09dc9..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_handlers_memfile.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Memfile Operations Tables for the IMFS - * - * 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 "imfs.h" - -/* - * Set of operations handlers for operations on memfile entities. - */ - -rtems_filesystem_file_handlers_r IMFS_linearfile_handlers = { - memfile_open, - memfile_close, - memfile_read, - NULL, /* write */ - memfile_ioctl, - memfile_lseek, - IMFS_stat, - IMFS_fchmod, - NULL, /* ftruncate */ - NULL, /* fpathconf */ - IMFS_fdatasync, /* fsync */ - IMFS_fdatasync, - IMFS_fcntl, - memfile_rmnod -}; - -rtems_filesystem_file_handlers_r IMFS_memfile_handlers = { - memfile_open, - memfile_close, - memfile_read, - memfile_write, - memfile_ioctl, - memfile_lseek, - IMFS_stat, - IMFS_fchmod, - memfile_ftruncate, - NULL, /* fpathconf */ - IMFS_fdatasync, /* fsync */ - IMFS_fdatasync, - IMFS_fcntl, - memfile_rmnod -}; diff --git a/c/src/exec/libfs/src/imfs/imfs_init.c b/c/src/exec/libfs/src/imfs/imfs_init.c deleted file mode 100644 index 01f02ae406..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_init.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * IMFS 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 /* for mkdir */ -#include -#include -#include - -#include - -#include "imfs.h" -#include - -#if defined(IMFS_DEBUG) -#include -#endif - -/* - * IMFS file system operations table - */ - -rtems_filesystem_operations_table IMFS_ops = { - IMFS_eval_path, - IMFS_evaluate_for_make, - IMFS_link, - IMFS_unlink, - IMFS_node_type, - IMFS_mknod, - IMFS_chown, - IMFS_freenodinfo, - IMFS_mount, - IMFS_initialize, - IMFS_unmount, - IMFS_fsunmount, - IMFS_utime, - IMFS_evaluate_link, - IMFS_symlink, - IMFS_readlink -}; - -/* - * IMFS_initialize - */ - -int IMFS_initialize( - rtems_filesystem_mount_table_entry_t *temp_mt_entry -) -{ - IMFS_initialize_support( - temp_mt_entry, - &IMFS_ops, - &IMFS_linearfile_handlers, - &IMFS_memfile_handlers, - &IMFS_directory_handlers - ); - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_initsupp.c b/c/src/exec/libfs/src/imfs/imfs_initsupp.c deleted file mode 100644 index bf0cb8ccdc..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_initsupp.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * IMFS 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 /* for mkdir */ -#include -#include -#include - -#include - -#include "imfs.h" -#include - -#if defined(IMFS_DEBUG) -#include -#endif - -/* - * IMFS_initialize - */ - -int IMFS_initialize_support( - rtems_filesystem_mount_table_entry_t *temp_mt_entry, - rtems_filesystem_operations_table *op_table, - rtems_filesystem_file_handlers_r *linearfile_handlers, - rtems_filesystem_file_handlers_r *memfile_handlers, - rtems_filesystem_file_handlers_r *directory_handlers -) -{ - IMFS_fs_info_t *fs_info; - IMFS_jnode_t *jnode; - - /* - * Create the root node - * - * NOTE: UNIX root is 755 and owned by root/root (0/0). - */ - - temp_mt_entry->mt_fs_root.node_access = IMFS_create_node( - NULL, - IMFS_DIRECTORY, - "", - ( S_IFDIR | 0755 ), - NULL - ); - - temp_mt_entry->mt_fs_root.handlers = directory_handlers; - temp_mt_entry->mt_fs_root.ops = op_table; - temp_mt_entry->pathconf_limits_and_options = IMFS_LIMITS_AND_OPTIONS; - - /* - * Create custom file system data. - */ - fs_info = calloc( 1, sizeof( IMFS_fs_info_t ) ); - if ( !fs_info ){ - free(temp_mt_entry->mt_fs_root.node_access); - return 1; - } - temp_mt_entry->fs_info = fs_info; - - /* - * Set st_ino for the root to 1. - */ - - fs_info->ino_count = 1; - fs_info->linearfile_handlers = linearfile_handlers; - fs_info->memfile_handlers = memfile_handlers; - fs_info->directory_handlers = directory_handlers; - - jnode = temp_mt_entry->mt_fs_root.node_access; - jnode->st_ino = fs_info->ino_count; - - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_link.c b/c/src/exec/libfs/src/imfs/imfs_link.c deleted file mode 100644 index 610c3cb831..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_link.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * IMFS_link - * - * The following rouine creates a new link node under parent with the - * name given in name. The link node is set to point to the node at - * to_loc. - * - * 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 "imfs.h" -#include -#include - -int IMFS_link( - rtems_filesystem_location_info_t *to_loc, /* IN */ - rtems_filesystem_location_info_t *parent_loc, /* IN */ - const char *token /* IN */ -) -{ - IMFS_types_union info; - IMFS_jnode_t *new_node; - char new_name[ IMFS_NAME_MAX + 1 ]; - int i; - - /* - * Verify this node can be linked to. - */ - - info.hard_link.link_node = to_loc->node_access; - if ( info.hard_link.link_node->st_nlink >= LINK_MAX ) - rtems_set_errno_and_return_minus_one( EMLINK ); - - /* - * Remove any separators at the end of the string. - */ - - IMFS_get_token( token, new_name, &i ); - - /* - * Create a new link node. - */ - - new_node = IMFS_create_node( - parent_loc, - IMFS_HARD_LINK, - new_name, - ( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )), - &info - ); - - if ( !new_node ) - rtems_set_errno_and_return_minus_one( ENOMEM ); - - /* - * Increment the link count of the node being pointed to. - */ - - info.hard_link.link_node->st_nlink++; - IMFS_update_ctime( info.hard_link.link_node ); - - return 0; -} - diff --git a/c/src/exec/libfs/src/imfs/imfs_load_tar.c b/c/src/exec/libfs/src/imfs/imfs_load_tar.c deleted file mode 100644 index afbf2b0291..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_load_tar.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -/************************************************************************** - * This file implements the "mount" procedure for tar-based IMFS - * extensions. The TAR is not actually mounted under the IMFS. - * Directories from the TAR file are created as usual in the IMFS. - * File entries are created as IMFS_LINEAR_FILE nodes with their nods - * pointing to addresses in the TAR image. - *************************************************************************/ - -#include -#include -#include - -#include - -#include -#include -#include -#include - - -/************************************************************************** - * TAR file format: - * - * Offset Length Contents - * 0 100 bytes File name ('\0' terminated, 99 maxmum length) - * 100 8 bytes File mode (in octal ascii) - * 108 8 bytes User ID (in octal ascii) - * 116 8 bytes Group ID (in octal ascii) - * 124 12 bytes File size (s) (in octal ascii) - * 136 12 bytes Modify time (in octal ascii) - * 148 8 bytes Header checksum (in octal ascii) - * 156 1 bytes Link flag - * 157 100 bytes Linkname ('\0' terminated, 99 maxmum length) - * 257 8 bytes Magic ("ustar \0") - * 265 32 bytes User name ('\0' terminated, 31 maxmum length) - * 297 32 bytes Group name ('\0' terminated, 31 maxmum length) - * 329 8 bytes Major device ID (in octal ascii) - * 337 8 bytes Minor device ID (in octal ascii) - * 345 167 bytes Padding - * 512 (s+p)bytes File contents (s+p) := (((s) + 511) & ~511), - * round up to 512 bytes - * - * Checksum: - * int i, sum; - * char* header = tar_header_pointer; - * sum = 0; - * for(i = 0; i < 512; i++) - * sum += 0xFF & header[i]; - *************************************************************************/ - -#define LF_OLDNORMAL '\0' /* Normal disk file, Unix compatible */ -#define LF_NORMAL '0' /* Normal disk file */ -#define LF_LINK '1' /* Link to previously dumped file */ -#define LF_SYMLINK '2' /* Symbolic link */ -#define LF_CHR '3' /* Character special file */ -#define LF_BLK '4' /* Block special file */ -#define LF_DIR '5' /* Directory */ -#define LF_FIFO '6' /* FIFO special file */ -#define LF_CONFIG '7' /* Contiguous file */ - -#define MAX_NAME_FIELD_SIZE 99 - -#define MIN(a,b) ((a)>(b)?(b):(a)) - -static unsigned long octal2ulong(char *octascii, int len); -static int compute_tar_header_checksum(char *bufr); - -/************************************************************************** - * rtems_tarfs_load - * - * Here we create the mountpoint directory and load the tarfs at - * that node. Once the IMFS has been mounted, we work through the - * tar image and perform as follows: - * - For directories, simply call mkdir(). The IMFS creates nodes as - * needed. - * - For files, we make our own calls to IMFS eval_for_make and - * create_node. - *************************************************************************/ -int -rtems_tarfs_load(char *mountpoint, - unsigned char *tar_image, - unsigned long tar_size) -{ - rtems_filesystem_location_info_t root_loc; - rtems_filesystem_location_info_t loc; - char *hdr_ptr; - char filename[100]; - char full_filename[256]; - int hdr_chksum; - unsigned char linkflag; - unsigned long file_size; - unsigned long file_mode; - int offset; - unsigned long nblocks; - IMFS_jnode_t *node; - int status; - - - status = rtems_filesystem_evaluate_path(mountpoint, 0, &root_loc, 0); - if (status != 0) - return(-1); - - if (root_loc.ops != &IMFS_ops) - return(-1); - - /*********************************************************************** - * Create an IMFS node structure pointing to tar image memory. - **********************************************************************/ - offset = 0; - while (1) - { - if (offset + 512 > tar_size) - break; - - /****************************************************************** - * Read a header. - ******************************************************************/ - hdr_ptr = &tar_image[offset]; - offset += 512; - if (strncmp(&hdr_ptr[257], "ustar ", 7)) - break; - - strncpy(filename, hdr_ptr, MAX_NAME_FIELD_SIZE); - filename[MAX_NAME_FIELD_SIZE] = '\0'; - - linkflag = hdr_ptr[156]; - file_mode = octal2ulong(&hdr_ptr[100], 8); - file_size = octal2ulong(&hdr_ptr[124], 12); - hdr_chksum = (int)octal2ulong(&hdr_ptr[148], 8); - - if (compute_tar_header_checksum(hdr_ptr) != hdr_chksum) - break; - - /****************************************************************** - * Generate an IMFS node depending on the file type. - * - For directories, just create directories as usual. IMFS - * will take care of the rest. - * - For files, create a file node with special tarfs properties. - *****************************************************************/ - if (linkflag == LF_DIR) - { - strcpy(full_filename, mountpoint); - if (full_filename[strlen(full_filename)-1] != '/') - strcat(full_filename, "/"); - strcat(full_filename, filename); - mkdir(full_filename, S_IRWXU | S_IRWXG | S_IRWXO); - } - /****************************************************************** - * Create a LINEAR_FILE node if no user write permission. - *****************************************************************/ - else if ((linkflag == LF_NORMAL) && - ((file_mode & 0200) == 0000)) - { - const char *name; - - loc = root_loc; - if (IMFS_evaluate_for_make(filename, &loc, &name) == 0) - { - node = IMFS_create_node(&loc, - IMFS_LINEAR_FILE, (char *)name, - (S_IRUSR | S_IRGRP | S_IROTH) | S_IFREG, - NULL); - node->info.linearfile.size = file_size; - node->info.linearfile.direct = &tar_image[offset]; - } - - nblocks = (((file_size) + 511) & ~511) / 512; - offset += 512 * nblocks; - } - /****************************************************************** - * Create a regular MEMORY_FILE if write permission exists. - *****************************************************************/ - else if ((linkflag == LF_NORMAL) && - ((file_mode & 0200) == 0200)) - { - int fd; - int n, left, ptr; - - strcpy(full_filename, mountpoint); - if (full_filename[strlen(full_filename)-1] != '/') - strcat(full_filename, "/"); - strcat(full_filename, filename); - - fd = creat(full_filename, S_IRUSR|S_IWUSR | S_IRGRP|S_IWGRP); - if (fd != -1) - { - left = file_size; - ptr = offset; - while ((n = write(fd, &tar_image[ptr], left)) > 0) - { - left -= n; - ptr += n; - } - close(fd); - } - - nblocks = (((file_size) + 511) & ~511) / 512; - offset += 512 * nblocks; - } - } - - return(status); -} - -/************************************************************************** - * This converts octal ASCII number representations into an - * unsigned long. Only support 32-bit numbers for now. - *************************************************************************/ -static unsigned long -octal2ulong(char *octascii, int len) -{ - int i; - unsigned long num; - unsigned long mult; - - num = 0; - mult = 1; - for (i=len-1; i>=0; i--) - { - if (octascii[i] < '0') - continue; - if (octascii[i] > '9') - continue; - - num += mult*((unsigned long)(octascii[i] - '0')); - mult *= 8; - } - return(num); -} - - -/************************************************************************ - * Compute the TAR checksum and check with the value in - * the archive. The checksum is computed over the entire - * header, but the checksum field is substituted with blanks. - ************************************************************************/ -static int -compute_tar_header_checksum(char *bufr) -{ - int i, sum; - - - sum = 0; - for (i=0; i<512; i++) - { - if ((i >= 148) && (i < 156)) - sum += 0xff & ' '; - else - sum += 0xff & bufr[i]; - } - return(sum); -} diff --git a/c/src/exec/libfs/src/imfs/imfs_mknod.c b/c/src/exec/libfs/src/imfs/imfs_mknod.c deleted file mode 100644 index 670f71fe7d..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_mknod.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * IMFS_mknod - * - * Routine to create a node in the IMFS file system. - * - * 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 "imfs.h" -#include -#include - -int IMFS_mknod( - const char *token, /* IN */ - mode_t mode, /* IN */ - dev_t dev, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */ -) -{ - IMFS_token_types type = 0; - IMFS_jnode_t *new_node; - int result; - char new_name[ IMFS_NAME_MAX + 1 ]; - IMFS_types_union info; - - IMFS_get_token( token, new_name, &result ); - - /* - * Figure out what type of IMFS node this is. - */ - - if ( S_ISDIR(mode) ) - type = IMFS_DIRECTORY; - else if ( S_ISREG(mode) ) - type = IMFS_MEMORY_FILE; - else if ( S_ISBLK(mode) || S_ISCHR(mode) ) { - type = IMFS_DEVICE; - rtems_filesystem_split_dev_t( dev, info.device.major, info.device.minor ); - } else { - rtems_set_errno_and_return_minus_one( EINVAL ); - } - - /* - * Allocate and fill in an IMFS jnode - */ - - new_node = IMFS_create_node( - pathloc, - type, - new_name, - mode, - &info - ); - - if ( !new_node ) - rtems_set_errno_and_return_minus_one( ENOMEM ); - - return 0; -} - diff --git a/c/src/exec/libfs/src/imfs/imfs_mount.c b/c/src/exec/libfs/src/imfs/imfs_mount.c deleted file mode 100644 index 1674d9a60d..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_mount.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * IMFS_mount - * - * This routine will look at a mount table entry that we are going to - * add to the mount table. If the mount point rtems_filesystem - * location_info_t struct refers to a node that is a directory, - * the node will be marked as a mount point by setting its directory.mt_fs - * pointer to point to the mount table entry that we are about to add - * to the mount table chain. - * - * 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 "imfs.h" -#include -#include - -int IMFS_mount( - rtems_filesystem_mount_table_entry_t *mt_entry -) -{ - IMFS_jnode_t *node; - - node = mt_entry->mt_point_node.node_access; - - /* - * Is the node that we are mounting onto a directory node ? - */ - - if ( node->type != IMFS_DIRECTORY ) - rtems_set_errno_and_return_minus_one( ENOTDIR ); - - /* - * Set mt_fs pointer to point to the mount table entry for - * the mounted file system. - */ - - node->info.directory.mt_fs = mt_entry; - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_ntype.c b/c/src/exec/libfs/src/imfs/imfs_ntype.c deleted file mode 100644 index baa69f15e4..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_ntype.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * IMFS_node_type - * - * The following verifies that returns the type of node that the - * loc refers to. - * - * 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 "imfs.h" - -rtems_filesystem_node_types_t IMFS_node_type( - rtems_filesystem_location_info_t *pathloc /* IN */ -) -{ - IMFS_jnode_t *node; - - node = pathloc->node_access; - return node->type; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_readlink.c b/c/src/exec/libfs/src/imfs/imfs_readlink.c deleted file mode 100644 index 89ef715086..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_readlink.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * IMFS_readlink - * - * The following rouine puts the symblic links destination name into - * buff. - * - * 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 "imfs.h" -#include -#include - -int IMFS_readlink( - rtems_filesystem_location_info_t *loc, - char *buf, /* OUT */ - size_t bufsize -) -{ - IMFS_jnode_t *node; - int i; - - node = loc->node_access; - - if ( node->type != IMFS_SYM_LINK ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - for( i=0; ((iinfo.sym_link.name[i] != '\0')); i++ ) - buf[i] = node->info.sym_link.name[i]; - - return i; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_rmnod.c b/c/src/exec/libfs/src/imfs/imfs_rmnod.c deleted file mode 100644 index 8257ace5ca..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_rmnod.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * IMFS Node Removal Handler - * - * This file contains the handler used to remove a node when a file type - * does not require special actions. - * - * 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 "imfs.h" - -/* - * IMFS_rmnod - */ - -int IMFS_rmnod( - rtems_filesystem_location_info_t *pathloc /* IN */ -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = (IMFS_jnode_t *) pathloc->node_access; - - /* - * Take the node out of the parent's chain that contains this node - */ - - if ( the_jnode->Parent != NULL ) { - Chain_Extract( (Chain_Node *) the_jnode ); - the_jnode->Parent = NULL; - } - - /* - * Decrement the link counter and see if we can free the space. - */ - - the_jnode->st_nlink--; - IMFS_update_ctime( the_jnode ); - - /* - * The file cannot be open and the link must be less than 1 to free. - */ - - if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { - - /* - * Is rtems_filesystem_current this node? - */ - - if ( rtems_filesystem_current.node_access == pathloc->node_access ) - rtems_filesystem_current.node_access = NULL; - - /* - * Free memory associated with a memory file. - */ - - free( the_jnode ); - } - - return 0; - -} - - - diff --git a/c/src/exec/libfs/src/imfs/imfs_stat.c b/c/src/exec/libfs/src/imfs/imfs_stat.c deleted file mode 100644 index bd1e319d0b..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_stat.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * IMFS_stat - * - * This routine provides a stat for the IMFS file system. - * - * 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 "imfs.h" -#include -#include - -int IMFS_stat( - rtems_filesystem_location_info_t *loc, - struct stat *buf -) -{ - IMFS_jnode_t *the_jnode; - IMFS_device_t *io; - - the_jnode = loc->node_access; - - - switch ( the_jnode->type ) { - - case IMFS_DEVICE: - io = &the_jnode->info.device; - buf->st_dev = rtems_filesystem_make_dev_t( io->major, io->minor ); - break; - - case IMFS_LINEAR_FILE: - case IMFS_MEMORY_FILE: - buf->st_size = the_jnode->info.file.size; - break; - - case IMFS_SYM_LINK: - buf->st_size = 0; - break; - - default: - rtems_set_errno_and_return_minus_one( ENOTSUP ); - break; - } - - buf->st_mode = the_jnode->st_mode; - buf->st_nlink = the_jnode->st_nlink; - buf->st_ino = the_jnode->st_ino; - buf->st_uid = the_jnode->st_uid; - buf->st_gid = the_jnode->st_gid; - - buf->st_atime = the_jnode->stat_atime; - buf->st_mtime = the_jnode->stat_mtime; - buf->st_ctime = the_jnode->stat_ctime; - - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_symlink.c b/c/src/exec/libfs/src/imfs/imfs_symlink.c deleted file mode 100644 index 5a062f3439..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_symlink.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * IMFS_symlink - * - * The following rouine creates a new symbolic link node under parent - * with the name given in name. The node is set to point to the node at - * to_loc. - * - * 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 "imfs.h" -#include -#include - -int IMFS_symlink( - rtems_filesystem_location_info_t *parent_loc, - const char *link_name, - const char *node_name -) -{ - IMFS_types_union info; - IMFS_jnode_t *new_node; - char new_name[ IMFS_NAME_MAX + 1 ]; - int i; - - /* - * Remove any separators at the end of the string. - */ - - IMFS_get_token( node_name, new_name, &i ); - - info.sym_link.name = link_name; - - /* - * Create a new link node. - */ - - new_node = IMFS_create_node( - parent_loc, - IMFS_SYM_LINK, - new_name, - ( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )), - &info - ); - - if ( !new_node ) - rtems_set_errno_and_return_minus_one( ENOMEM ); - - return 0; -} - - diff --git a/c/src/exec/libfs/src/imfs/imfs_unixstub.c b/c/src/exec/libfs/src/imfs/imfs_unixstub.c deleted file mode 100644 index 3af9cee647..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_unixstub.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * IMFS Stub for UNIX configuration - * - * 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 /* for mkdir */ -#include -#include -#include - -#include - -#include "imfs.h" -#include - -#include - -/* - * IMFS file system operations table - */ - -rtems_filesystem_operations_table IMFS_ops = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -/* - * IMFS file system operations table - */ - -rtems_filesystem_operations_table miniIMFS_ops = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; diff --git a/c/src/exec/libfs/src/imfs/imfs_unlink.c b/c/src/exec/libfs/src/imfs/imfs_unlink.c deleted file mode 100644 index 9e0861b53a..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_unlink.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * IMFS_unlink - * - * Routine to remove a link node from the tree. - * - * 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 "imfs.h" -#include -#include - -int IMFS_unlink( - rtems_filesystem_location_info_t *loc /* IN */ -) -{ - IMFS_jnode_t *node; - rtems_filesystem_location_info_t the_link; - int result = 0; - - node = loc->node_access; - - /* - * Decrement the link counter of node pointed to and free the - * space. - */ - - /* - * If this is the last last pointer to the node - * free the node. - */ - - if ( node->type == IMFS_HARD_LINK ) { - - if ( !node->info.hard_link.link_node ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - the_link = *loc; - the_link.node_access = node->info.hard_link.link_node; - IMFS_Set_handlers( &the_link ); - - /* - * If removing the last hard link to a node, then we need - * to remove the node that is a link and the node itself. - */ - - node->info.hard_link.link_node->st_nlink --; - IMFS_update_ctime( node->info.hard_link.link_node ); - if ( node->info.hard_link.link_node->st_nlink < 1) { - result = (*the_link.handlers->rmnod_h)( &the_link ); - if ( result != 0 ) - return -1; - } - } - - /* - * Now actually free the node we were asked to free. - */ - - result = (*loc->handlers->rmnod_h)( loc ); - - return result; -} - diff --git a/c/src/exec/libfs/src/imfs/imfs_unmount.c b/c/src/exec/libfs/src/imfs/imfs_unmount.c deleted file mode 100644 index ea40def946..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_unmount.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * IMFS_unmount - * - * This routine will look at a mount table entry that we are going to - * add to the mount table. If the mount point - * rtems_filesystem_location_info_t struct refers to a node that is a - * directory that has a file system mounted on it, the node will be - * marked as a mount point by * setting its directory.mt_fs pointer - * to NULL. This indicates that a directory is no longer mounted on - * this node. - * - * 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 "imfs.h" -#include -#include - -int IMFS_unmount( - rtems_filesystem_mount_table_entry_t *mt_entry -) -{ - IMFS_jnode_t *node; - - node = mt_entry->mt_point_node.node_access; - - /* - * Is the node that we are mounting onto a directory node ? - */ - - if ( node->type != IMFS_DIRECTORY ) - rtems_set_errno_and_return_minus_one( ENOTDIR ); - - /* - * Did the node indicate that there was a directory mounted here? - */ - - if ( node->info.directory.mt_fs == NULL ) - rtems_set_errno_and_return_minus_one( EINVAL ); /* XXX */ - - /* - * Set the mt_fs pointer to indicate that there is no longer - * a file system mounted to this point. - */ - - node->info.directory.mt_fs = NULL; - - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/imfs_utime.c b/c/src/exec/libfs/src/imfs/imfs_utime.c deleted file mode 100644 index 2000d8791e..0000000000 --- a/c/src/exec/libfs/src/imfs/imfs_utime.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * IMFS_utime - * - * This routine is the implementation of the utime() system - * call for the IMFS. - * - * 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 "imfs.h" - -int IMFS_utime( - rtems_filesystem_location_info_t *pathloc, /* IN */ - time_t actime, /* IN */ - time_t modtime /* IN */ -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = (IMFS_jnode_t *) pathloc->node_access; - - the_jnode->stat_atime = actime; - the_jnode->stat_mtime = modtime; - - return 0; -} diff --git a/c/src/exec/libfs/src/imfs/ioman.c b/c/src/exec/libfs/src/imfs/ioman.c deleted file mode 100644 index ffddc89928..0000000000 --- a/c/src/exec/libfs/src/imfs/ioman.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file emulates the old Classic RTEMS IO manager directives - * which register and lookup names using the in-memory filesystem. - * - * 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 "imfs.h" - -#if defined(__linux__) -#define S_IFCHR __S_IFCHR -#endif - -/* - * rtems_io_register_name - * - * This assumes that all registered devices are character devices. - */ - -rtems_status_code rtems_io_register_name( - char *device_name, - rtems_device_major_number major, - rtems_device_minor_number minor -) -{ -#if !defined(RTEMS_UNIX) - int status; - dev_t dev; - - dev = rtems_filesystem_make_dev_t( major, minor ); - status = mknod( device_name, 0777 | S_IFCHR, dev ); - - /* this is the only error returned by the old version */ - if ( status ) - return RTEMS_TOO_MANY; - -#endif - return RTEMS_SUCCESSFUL; -} - -/* - * rtems_io_lookup_name - * - * This version is not reentrant. - * - * XXX - This is dependent upon IMFS and should not be. - * Suggest adding a filesystem routine to fill in the device_info. - */ - -rtems_status_code rtems_io_lookup_name( - const char *name, - rtems_driver_name_t **device_info -) -{ -#if !defined(RTEMS_UNIX) - IMFS_jnode_t *the_jnode; - rtems_filesystem_location_info_t loc; - static rtems_driver_name_t device; - int result; - rtems_filesystem_node_types_t node_type; - - result = rtems_filesystem_evaluate_path( name, 0x00, &loc, TRUE ); - the_jnode = loc.node_access; - - if ( !loc.ops->node_type_h ) { - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - node_type = (*loc.ops->node_type_h)( &loc ); - - if ( (result != 0) || node_type != RTEMS_FILESYSTEM_DEVICE ) { - *device_info = 0; - rtems_filesystem_freenode( &loc ); - return RTEMS_UNSATISFIED; - } - - device.device_name = (char *) name; - device.device_name_length = strlen( name ); - device.major = the_jnode->info.device.major; - device.minor = the_jnode->info.device.minor; - *device_info = &device; - - rtems_filesystem_freenode( &loc ); - -#endif - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/exec/libfs/src/imfs/linearfile.c b/c/src/exec/libfs/src/imfs/linearfile.c deleted file mode 100644 index 3d6593dfce..0000000000 --- a/c/src/exec/libfs/src/imfs/linearfile.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * IMFS Linear File Handlers - * - * This file contains the set of handlers used to process operations on - * IMFS linear memory file nodes. Linear memory files are contiguous - * blocks of memory created from a TAR or other filesystem image. - * The blocks are nonwriteable and nonresizeable. - * - * 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 "imfs.h" -#include -#include - -/* - * linearfile_read - * - * This routine processes the read() system call. - */ - -int linearfile_read( - rtems_libio_t *iop, - void *buffer, - unsigned32 count -) -{ - IMFS_jnode_t *the_jnode; - unsigned char *dest; - unsigned char *file_ptr; - int file_offset; - - - the_jnode = iop->file_info; - - /* - * Perform internal consistency checks - */ - - assert( the_jnode ); - if ( !the_jnode ) - rtems_set_errno_and_return_minus_one( EIO ); - - assert( the_jnode->type == IMFS_LINEAR_FILE ); - if ( the_jnode->type != IMFS_LINEAR_FILE ) - rtems_set_errno_and_return_minus_one( EIO ); - - /* - * Error checks on arguments - */ - - dest = (unsigned char *)buffer; - assert( dest ); - if ( !dest ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - /* - * Perform a simple memory copy. - */ - - if (count == 0) - return(0); - - the_jnode = iop->file_info; - file_ptr = (unsigned char *)the_jnode->info.linearfile.direct; - file_offset = (unsigned long)iop->offset; - - if (count > (the_jnode->info.linearfile.size - file_offset)) - count = the_jnode->info.linearfile.size - file_offset; - - memcpy(dest, &file_ptr[file_offset], count); - - return(count); -} - - -/* - * linearfile_lseek - * - * This routine processes the lseek() system call. - */ - -int linearfile_lseek( - rtems_libio_t *iop, - off_t offset, - int whence -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - if (iop->offset > the_jnode->info.linearfile.size) - iop->offset = the_jnode->info.linearfile.size; - - return iop->offset; -} - diff --git a/c/src/exec/libfs/src/imfs/memfile.c b/c/src/exec/libfs/src/imfs/memfile.c deleted file mode 100644 index cfa37c20c6..0000000000 --- a/c/src/exec/libfs/src/imfs/memfile.c +++ /dev/null @@ -1,1137 +0,0 @@ -/* - * IMFS Device Node Handlers - * - * This file contains the set of handlers used to process operations on - * IMFS memory file nodes. The memory files are created in memory using - * malloc'ed memory. Thus any data stored in one of these files is lost - * at system shutdown unless special arrangements to copy the data to - * some type of non-volailte storage are made by the application. - * - * 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 "imfs.h" -#include -#include - -#define MEMFILE_STATIC - -/* - * Prototypes of private routines - */ - -MEMFILE_STATIC int IMFS_memfile_extend( - IMFS_jnode_t *the_jnode, - off_t new_length -); - -MEMFILE_STATIC int IMFS_memfile_addblock( - IMFS_jnode_t *the_jnode, - unsigned int block -); - -MEMFILE_STATIC int IMFS_memfile_remove_block( - IMFS_jnode_t *the_jnode, - unsigned int block -); - -MEMFILE_STATIC block_p *IMFS_memfile_get_block_pointer( - IMFS_jnode_t *the_jnode, - unsigned int block, - int malloc_it -); - -MEMFILE_STATIC int IMFS_memfile_read( - IMFS_jnode_t *the_jnode, - off_t start, - unsigned char *destination, - unsigned int length -); - -MEMFILE_STATIC int IMFS_memfile_write( - IMFS_jnode_t *the_jnode, - off_t start, - const unsigned char *source, - unsigned int length -); - -void *memfile_alloc_block(void); - -void memfile_free_block( - void *memory -); - -/* - * memfile_open - * - * This routine processes the open() system call. Note that there is - * nothing special to be done at open() time. - */ - -int memfile_open( - rtems_libio_t *iop, - const char *pathname, - unsigned32 flag, - unsigned32 mode -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - if (iop->flags & LIBIO_FLAGS_APPEND) - iop->offset = the_jnode->info.file.size; - - iop->size = the_jnode->info.file.size; - return 0; -} - -/* - * memfile_close - * - * This routine processes the close() system call. Note that there is - * nothing to flush or memory to free at this point. - */ - -int memfile_close( - rtems_libio_t *iop -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - if (iop->flags & LIBIO_FLAGS_APPEND) - iop->offset = the_jnode->info.file.size; - - return 0; -} - -/* - * memfile_read - * - * This routine processes the read() system call. - */ - -int memfile_read( - rtems_libio_t *iop, - void *buffer, - unsigned32 count -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - return IMFS_memfile_read( the_jnode, iop->offset, buffer, count ); -} - -/* - * memfile_write - * - * This routine processes the write() system call. - */ - -int memfile_write( - rtems_libio_t *iop, - const void *buffer, - unsigned32 count -) -{ - IMFS_jnode_t *the_jnode; - int status; - - the_jnode = iop->file_info; - - status = IMFS_memfile_write( the_jnode, iop->offset, buffer, count ); - iop->size = the_jnode->info.file.size; - - return status; -} - -/* - * memfile_ioctl - * - * This routine processes the ioctl() system call. - * - * NOTE: No ioctl()'s are supported for in-memory files. - */ - -int memfile_ioctl( - rtems_libio_t *iop, - unsigned32 command, - void *buffer -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - return 0; -} - -/* - * memfile_lseek - * - * This routine processes the lseek() system call. - */ - -int memfile_lseek( - rtems_libio_t *iop, - off_t offset, - int whence -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - if (the_jnode->type == IMFS_LINEAR_FILE) { - if (iop->offset > the_jnode->info.linearfile.size) - iop->offset = the_jnode->info.linearfile.size; - } - else { /* Must be a block file (IMFS_MEMORY_FILE). */ - if (IMFS_memfile_extend( the_jnode, iop->offset )) - rtems_set_errno_and_return_minus_one( ENOSPC ); - - iop->size = the_jnode->info.file.size; - } - return iop->offset; -} - -/* - * memfile_stat - * - * This IMFS_stat() can be used. - */ - -/* - * memfile_ftruncate - * - * This routine processes the ftruncate() system call. - */ - -int memfile_ftruncate( - rtems_libio_t *iop, - off_t length -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = iop->file_info; - - /* - * POSIX 1003.1b does not specify what happens if you truncate a file - * and the new length is greater than the current size. We treat this - * as an extend operation. - */ - - if ( length > the_jnode->info.file.size ) - return IMFS_memfile_extend( the_jnode, length ); - - /* - * The in-memory files do not currently reclaim memory until the file is - * deleted. So we leave the previously allocated blocks in place for - * future use and just set the length. - */ - - the_jnode->info.file.size = length; - iop->size = the_jnode->info.file.size; - - IMFS_update_atime( the_jnode ); - - return 0; -} - -/* - * IMFS_memfile_extend - * - * This routine insures that the in-memory file is of the length - * specified. If necessary, it will allocate memory blocks to - * extend the file. - */ - -MEMFILE_STATIC int IMFS_memfile_extend( - IMFS_jnode_t *the_jnode, - off_t new_length -) -{ - unsigned int block; - unsigned int new_blocks; - unsigned int old_blocks; - - /* - * Perform internal consistency checks - */ - - assert( the_jnode ); - if ( !the_jnode ) - rtems_set_errno_and_return_minus_one( EIO ); - - assert( the_jnode->type == IMFS_MEMORY_FILE ); - if ( the_jnode->type != IMFS_MEMORY_FILE ) - rtems_set_errno_and_return_minus_one( EIO ); - - if ( new_length >= IMFS_MEMFILE_MAXIMUM_SIZE ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - if ( new_length <= the_jnode->info.file.size ) - return 0; - - /* - * Calculate the number of range of blocks to allocate - */ - - new_blocks = new_length / IMFS_MEMFILE_BYTES_PER_BLOCK; - old_blocks = the_jnode->info.file.size / IMFS_MEMFILE_BYTES_PER_BLOCK; - - /* - * Now allocate each of those blocks. - */ - - for ( block=old_blocks ; block<=new_blocks ; block++ ) { - if ( IMFS_memfile_addblock( the_jnode, block ) ) { - for ( ; block>=old_blocks ; block-- ) { - IMFS_memfile_remove_block( the_jnode, block ); - } - rtems_set_errno_and_return_minus_one( ENOSPC ); - } - } - - /* - * Set the new length of the file. - */ - - the_jnode->info.file.size = new_length; - return 0; -} - -/* - * IMFS_memfile_addblock - * - * This routine adds a single block to the specified in-memory file. - */ - -MEMFILE_STATIC int IMFS_memfile_addblock( - IMFS_jnode_t *the_jnode, - unsigned int block -) -{ - block_p memory; - block_p *block_entry_ptr; - - assert( the_jnode ); - if ( !the_jnode ) - rtems_set_errno_and_return_minus_one( EIO ); - - assert( the_jnode->type == IMFS_MEMORY_FILE ); - if ( the_jnode->type != IMFS_MEMORY_FILE ) - rtems_set_errno_and_return_minus_one( EIO ); - - block_entry_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 1 ); - if ( *block_entry_ptr ) - return 0; - -#if 0 - printf( "%d %p", block, block_entry_ptr ); - fflush(stdout); -#endif - - memory = memfile_alloc_block(); - if ( !memory ) - return 1; - *block_entry_ptr = memory; - - return 0; -} - -/* - * IMFS_memfile_remove_block - * - * This routine removes the specified block from the in-memory file. - * - * NOTE: This is a support routine and is called only to remove - * the last block or set of blocks in a file. Removing a - * block from the middle of a file would be exceptionally - * dangerous and the results unpredictable. - */ - -MEMFILE_STATIC int IMFS_memfile_remove_block( - IMFS_jnode_t *the_jnode, - unsigned int block -) -{ - block_p *block_entry_ptr; - block_p ptr; - - block_entry_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 ); - ptr = *block_entry_ptr; - *block_entry_ptr = 0; - - memfile_free_block( ptr ); - - return 1; -} - -/* - * memfile_free_blocks_in_table - * - * This is a support routine for IMFS_memfile_remove. It frees all the - * blocks in one of the indirection tables. - */ - -void memfile_free_blocks_in_table( - block_p **block_table, - int entries -) -{ - int i; - block_p *b; - - /* - * Perform internal consistency checks - */ - - assert( block_table ); - if ( !block_table ) - return; - - /* - * Now go through all the slots in the table and free the memory. - */ - - b = *block_table; - - for ( i=0 ; itype == IMFS_MEMORY_FILE ); - if ( the_jnode->type != IMFS_MEMORY_FILE ) - rtems_set_errno_and_return_minus_one( EIO ); - - /* - * Eventually this could be set smarter at each call to - * memfile_free_blocks_in_table to greatly speed this up. - */ - - to_free = IMFS_MEMFILE_BLOCK_SLOTS; - - /* - * Now start freeing blocks in this order: - * + indirect - * + doubly indirect - * + triply indirect - */ - - info = &the_jnode->info.file; - - if ( info->indirect ) { - memfile_free_blocks_in_table( &info->indirect, to_free ); - } - - if ( info->doubly_indirect ) { - - for ( i=0 ; idoubly_indirect[i] ) { - memfile_free_blocks_in_table( - (block_p **)&info->doubly_indirect[i], to_free ); - } - } - memfile_free_blocks_in_table( &info->doubly_indirect, to_free ); - - } - - if ( info->triply_indirect ) { - for ( i=0 ; itriply_indirect[i]; - if ( !p ) /* ensure we have a valid pointer */ - break; - for ( j=0 ; jtriply_indirect[i], to_free ); - } - memfile_free_blocks_in_table( - (block_p **)&info->triply_indirect, to_free ); - } - - return 0; -} - -/* - * IMFS_memfile_read - * - * This routine read from memory file pointed to by the_jnode into - * the specified data buffer specified by destination. The file - * is NOT extended. An offset greater than the length of the file - * is considered an error. Read from an offset for more bytes than - * are between the offset and the end of the file will result in - * reading the data between offset and the end of the file (truncated - * read). - */ - -MEMFILE_STATIC int IMFS_memfile_read( - IMFS_jnode_t *the_jnode, - off_t start, - unsigned char *destination, - unsigned int length -) -{ - block_p *block_ptr; - unsigned int block; - unsigned int my_length; - unsigned int to_copy = 0; - unsigned int last_byte; - unsigned int copied; - unsigned int start_offset; - unsigned char *dest; - - dest = destination; - - /* - * Perform internal consistency checks - */ - - assert( the_jnode ); - if ( !the_jnode ) - rtems_set_errno_and_return_minus_one( EIO ); - - assert( the_jnode->type == IMFS_MEMORY_FILE || - the_jnode->type == IMFS_LINEAR_FILE ); - if ( the_jnode->type != IMFS_MEMORY_FILE && - the_jnode->type != IMFS_LINEAR_FILE ) - rtems_set_errno_and_return_minus_one( EIO ); - - /* - * Error checks on arguments - */ - - assert( dest ); - if ( !dest ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - /* - * If there is nothing to read, then quick exit. - */ - - my_length = length; - if ( !my_length ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - /* - * Linear files (as created from a tar file are easier to handle - * than block files). - */ - if (the_jnode->type == IMFS_LINEAR_FILE) { - unsigned char *file_ptr; - - file_ptr = (unsigned char *)the_jnode->info.linearfile.direct; - - if (my_length > (the_jnode->info.linearfile.size - start)) - my_length = the_jnode->info.linearfile.size - start; - - memcpy(dest, &file_ptr[start], my_length); - - IMFS_update_atime( the_jnode ); - - return my_length; - } - - /* - * If the last byte we are supposed to read is past the end of this - * in memory file, then shorten the length to read. - */ - - last_byte = start + length; - if ( last_byte > the_jnode->info.file.size ) - my_length = the_jnode->info.file.size - start; - - copied = 0; - - /* - * Three phases to the read: - * + possibly the last part of one block - * + all of zero of more blocks - * + possibly the first part of one block - */ - - /* - * Phase 1: possibly the last part of one block - */ - - start_offset = start % IMFS_MEMFILE_BYTES_PER_BLOCK; - block = start / IMFS_MEMFILE_BYTES_PER_BLOCK; - if ( start_offset ) { - to_copy = IMFS_MEMFILE_BYTES_PER_BLOCK - start_offset; - if ( to_copy > my_length ) - to_copy = my_length; - block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 ); - assert( block_ptr ); - if ( !block_ptr ) - return copied; - memcpy( dest, &(*block_ptr)[ start_offset ], to_copy ); - dest += to_copy; - block++; - my_length -= to_copy; - copied += to_copy; - } - - /* - * Phase 2: all of zero of more blocks - */ - - to_copy = IMFS_MEMFILE_BYTES_PER_BLOCK; - while ( my_length >= IMFS_MEMFILE_BYTES_PER_BLOCK ) { - block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 ); - assert( block_ptr ); - if ( !block_ptr ) - return copied; - memcpy( dest, &(*block_ptr)[ 0 ], to_copy ); - dest += to_copy; - block++; - my_length -= to_copy; - copied += to_copy; - } - - /* - * Phase 3: possibly the first part of one block - */ - - assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK ); - - if ( my_length ) { - block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 ); - assert( block_ptr ); - if ( !block_ptr ) - return copied; - memcpy( dest, &(*block_ptr)[ 0 ], my_length ); - copied += my_length; - } - - IMFS_update_atime( the_jnode ); - - return copied; -} - -/* - * IMFS_memfile_write - * - * This routine writes the specified data buffer into the in memory - * file pointed to by the_jnode. The file is extended as needed. - */ - -MEMFILE_STATIC int IMFS_memfile_write( - IMFS_jnode_t *the_jnode, - off_t start, - const unsigned char *source, - unsigned int length -) -{ - block_p *block_ptr; - unsigned int block; - int status; - unsigned int my_length; - unsigned int to_copy = 0; - unsigned int last_byte; - unsigned int start_offset; - int copied; - const unsigned char *src; - - src = source; - - /* - * Perform internal consistency checks - */ - - assert( the_jnode ); - if ( !the_jnode ) - rtems_set_errno_and_return_minus_one( EIO ); - - assert( the_jnode->type == IMFS_MEMORY_FILE ); - if ( the_jnode->type != IMFS_MEMORY_FILE ) - rtems_set_errno_and_return_minus_one( EIO ); - - /* - * Error check arguments - */ - - assert( source ); - if ( !source ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - - /* - * If there is nothing to write, then quick exit. - */ - - my_length = length; - if ( !my_length ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - /* - * If the last byte we are supposed to write is past the end of this - * in memory file, then extend the length. - */ - - last_byte = start + length; - if ( last_byte > the_jnode->info.file.size ) { - status = IMFS_memfile_extend( the_jnode, last_byte ); - if ( status ) - rtems_set_errno_and_return_minus_one( ENOSPC ); - } - - copied = 0; - - /* - * Three phases to the write: - * + possibly the last part of one block - * + all of zero of more blocks - * + possibly the first part of one block - */ - - /* - * Phase 1: possibly the last part of one block - */ - - start_offset = start % IMFS_MEMFILE_BYTES_PER_BLOCK; - block = start / IMFS_MEMFILE_BYTES_PER_BLOCK; - if ( start_offset ) { - to_copy = IMFS_MEMFILE_BYTES_PER_BLOCK - start_offset; - if ( to_copy > my_length ) - to_copy = my_length; - block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 ); - assert( block_ptr ); - if ( !block_ptr ) - return copied; -#if 0 -printf( "write %d at %d in %d: %*s\n", to_copy, start_offset, block, to_copy, src ); -#endif - memcpy( &(*block_ptr)[ start_offset ], src, to_copy ); - src += to_copy; - block++; - my_length -= to_copy; - copied += to_copy; - } - - /* - * Phase 2: all of zero of more blocks - */ - - to_copy = IMFS_MEMFILE_BYTES_PER_BLOCK; - while ( my_length >= IMFS_MEMFILE_BYTES_PER_BLOCK ) { - block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 ); - assert( block_ptr ); - if ( !block_ptr ) - return copied; -#if 0 -printf( "write %d in %d: %*s\n", to_copy, block, to_copy, src ); -#endif - memcpy( &(*block_ptr)[ 0 ], src, to_copy ); - src += to_copy; - block++; - my_length -= to_copy; - copied += to_copy; - } - - /* - * Phase 3: possibly the first part of one block - */ - - assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK ); - - to_copy = my_length; - if ( my_length ) { - block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 ); - assert( block_ptr ); - if ( !block_ptr ) - return copied; -#if 0 -printf( "write %d in %d: %*s\n", to_copy, block, to_copy, src ); -#endif - memcpy( &(*block_ptr)[ 0 ], src, my_length ); - my_length = 0; - copied += to_copy; - } - - IMFS_atime_mtime_update( the_jnode ); - - return copied; -} - -/* - * IMFS_memfile_get_block_pointer - * - * This routine looks up the block pointer associated with the given block - * number. If that block has not been allocated and "malloc_it" is - * TRUE, then the block is allocated. Otherwise, it is an error. - */ - -#if 0 -block_p *IMFS_memfile_get_block_pointer_DEBUG( - IMFS_jnode_t *the_jnode, - unsigned int block, - int malloc_it -); - -block_p *IMFS_memfile_get_block_pointer( - IMFS_jnode_t *the_jnode, - unsigned int block, - int malloc_it -) -{ - block_p *p; - - p = IMFS_memfile_get_block_pointer_DEBUG( the_jnode, block, malloc_it ); - printf( "(%d -> %p) ", block, p ); - return p; -} - -block_p *IMFS_memfile_get_block_pointer_DEBUG( -#else -block_p *IMFS_memfile_get_block_pointer( -#endif - IMFS_jnode_t *the_jnode, - unsigned int block, - int malloc_it -) -{ - unsigned int my_block; - IMFS_memfile_t *info; - unsigned int singly; - unsigned int doubly; - unsigned int triply; - block_p *p; - block_p *p1; - block_p *p2; - - /* - * Perform internal consistency checks - */ - - assert( the_jnode ); - if ( !the_jnode ) - return NULL; - - assert( the_jnode->type == IMFS_MEMORY_FILE ); - if ( the_jnode->type != IMFS_MEMORY_FILE ) - return NULL; - - info = &the_jnode->info.file; - - my_block = block; - - /* - * Is the block number in the simple indirect portion? - */ - - if ( my_block <= LAST_INDIRECT ) { -#if 0 -printf( "(s %d) ", block ); -fflush(stdout); -#endif - p = info->indirect; - - if ( malloc_it ) { - - if ( !p ) { - p = memfile_alloc_block(); - if ( !p ) - return 0; - info->indirect = p; - } - return &info->indirect[ my_block ]; - } - - if ( !p ) - return 0; - - return &info->indirect[ my_block ]; - } - - /* - * Is the block number in the doubly indirect portion? - */ - - if ( my_block <= LAST_DOUBLY_INDIRECT ) { -#if 0 -printf( "(d %d) ", block ); -fflush(stdout); -#endif - - my_block -= FIRST_DOUBLY_INDIRECT; - - singly = my_block % IMFS_MEMFILE_BLOCK_SLOTS; - doubly = my_block / IMFS_MEMFILE_BLOCK_SLOTS; - - p = info->doubly_indirect; - if ( malloc_it ) { - - if ( !p ) { - p = memfile_alloc_block(); - if ( !p ) - return 0; - info->doubly_indirect = p; - } - - p1 = (block_p *)p[ doubly ]; - if ( !p1 ) { - p1 = memfile_alloc_block(); - if ( !p1 ) - return 0; - p[ doubly ] = (block_p) p1; - } - - return (block_p *)&p1[ singly ]; - } - - if ( !p ) - return 0; - - p = (block_p *)p[ doubly ]; - if ( !p ) - return 0; - -#if 0 -printf( "(d %d %d %d %d %p %p) ", block, my_block, doubly, - singly, p, &p[singly] ); -fflush(stdout); -#endif - return (block_p *)&p[ singly ]; - } - -#if 0 -printf( "(t %d) ", block ); -fflush(stdout); -#endif - /* - * Is the block number in the triply indirect portion? - */ - - if ( my_block <= LAST_TRIPLY_INDIRECT ) { - my_block -= FIRST_TRIPLY_INDIRECT; - - singly = my_block % IMFS_MEMFILE_BLOCK_SLOTS; - doubly = my_block / IMFS_MEMFILE_BLOCK_SLOTS; - triply = doubly / IMFS_MEMFILE_BLOCK_SLOTS; - doubly %= IMFS_MEMFILE_BLOCK_SLOTS; - - p = info->triply_indirect; - - if ( malloc_it ) { - if ( !p ) { - p = memfile_alloc_block(); - if ( !p ) - return 0; - info->triply_indirect = p; - } - - p1 = (block_p *) p[ triply ]; - if ( !p1 ) { - p1 = memfile_alloc_block(); - if ( !p1 ) - return 0; - p[ triply ] = (block_p) p1; - } - - p2 = (block_p *)p1[ doubly ]; - if ( !p2 ) { - p2 = memfile_alloc_block(); - if ( !p2 ) - return 0; - p1[ doubly ] = (block_p) p2; - } - return (block_p *)&p2[ singly ]; - } - - if ( !p ) - return 0; - -#if 0 -printf( "(t %d %d %d %d %d) ", block, my_block, triply, doubly, singly ); -fflush(stdout); -#endif - p1 = (block_p *) p[ triply ]; - if ( !p1 ) - return 0; - - p2 = (block_p *)p1[ doubly ]; - if ( !p ) - return 0; - - return (block_p *)&p2[ singly ]; - } - - /* - * This means the requested block number is out of range. - */ - - return 0; -} - -/* - * memfile_alloc_block - * - * Allocate a block for an in-memory file. - */ - -int memfile_blocks_allocated = 0; - -void *memfile_alloc_block(void) -{ - void *memory; - - memory = (void *)calloc(1, IMFS_MEMFILE_BYTES_PER_BLOCK); - if ( memory ) - memfile_blocks_allocated++; - - return memory; -} - -/* - * memfile_free_block - * - * Free a block from an in-memory file. - */ - -void memfile_free_block( - void *memory -) -{ -#if 0 -printf( "(d %p) ", memory ); -fflush(stdout); -#endif - free(memory); - memfile_blocks_allocated--; -} - - -/* - * memfile_rmnod - * - * This routine is available from the optable to remove a node - * from the IMFS file system. - */ - -int memfile_rmnod( - rtems_filesystem_location_info_t *pathloc /* IN */ -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = (IMFS_jnode_t *) pathloc->node_access; - - /* - * Take the node out of the parent's chain that contains this node - */ - - if ( the_jnode->Parent != NULL ) { - Chain_Extract( (Chain_Node *) the_jnode ); - the_jnode->Parent = NULL; - } - - /* - * Decrement the link counter and see if we can free the space. - */ - - the_jnode->st_nlink--; - IMFS_update_ctime( the_jnode ); - - /* - * The file cannot be open and the link must be less than 1 to free. - */ - - if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { - - /* - * Is the rtems_filesystem_current is this node? - */ - - if ( rtems_filesystem_current.node_access == pathloc->node_access ) - rtems_filesystem_current.node_access = NULL; - - /* - * Free memory associated with a memory file. - */ - if (the_jnode->type != IMFS_LINEAR_FILE) - IMFS_memfile_remove( the_jnode ); - - free( the_jnode ); - } - - return 0; - -} - - diff --git a/c/src/exec/libfs/src/imfs/miniimfs_init.c b/c/src/exec/libfs/src/imfs/miniimfs_init.c deleted file mode 100644 index 8ead84524e..0000000000 --- a/c/src/exec/libfs/src/imfs/miniimfs_init.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Mini-IMFS 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 /* for mkdir */ -#include -#include -#include - -#include - -#include "imfs.h" -#include - -#if defined(IMFS_DEBUG) -#include -#endif - -/* - * miniIMFS file system operations table - */ - -rtems_filesystem_operations_table miniIMFS_ops = { - IMFS_eval_path, - IMFS_evaluate_for_make, - NULL, /* XXX IMFS_link, */ - NULL, /* XXX IMFS_unlink, */ - IMFS_node_type, - IMFS_mknod, - NULL, /* XXX IMFS_chown, */ - NULL, /* XXX IMFS_freenodinfo, */ - NULL, /* XXX IMFS_mount, */ - miniIMFS_initialize, - NULL, /* XXX IMFS_unmount, */ - NULL, /* XXX IMFS_fsunmount, */ - NULL, /* XXX IMFS_utime, */ - NULL, /* XXX IMFS_evaluate_link, */ - NULL, /* XXX IMFS_symlink, */ - NULL /* XXX IMFS_readlink */ -}; - -/* - * miniIMFS_initialize - */ - -int miniIMFS_initialize( - rtems_filesystem_mount_table_entry_t *temp_mt_entry -) -{ - IMFS_initialize_support( - temp_mt_entry, - &miniIMFS_ops, - &rtems_filesystem_null_handlers, /* for linearfiles */ - &rtems_filesystem_null_handlers, /* for memfiles */ - &rtems_filesystem_null_handlers /* for directories */ - ); - return 0; -} - - - diff --git a/c/src/exec/libfs/wrapup/.cvsignore b/c/src/exec/libfs/wrapup/.cvsignore deleted file mode 100644 index 525275c115..0000000000 --- a/c/src/exec/libfs/wrapup/.cvsignore +++ /dev/null @@ -1,13 +0,0 @@ -Makefile -Makefile.in -aclocal.m4 -config.cache -config.guess -config.log -config.status -config.sub -configure -depcomp -install-sh -missing -mkinstalldirs diff --git a/c/src/exec/libfs/wrapup/Makefile.am b/c/src/exec/libfs/wrapup/Makefile.am deleted file mode 100644 index 87f159d62d..0000000000 --- a/c/src/exec/libfs/wrapup/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -## -## $Id$ -## - -LIBNAME = libfs -LIB = $(ARCH)/$(LIBNAME).a - -include $(top_srcdir)/../automake/multilib.am -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/lib.am - -IMFSLIB = ../src/imfs/$(ARCH)/libimfs.a - -if !UNIX -DOSFSLIB = ../src/dosfs/$(ARCH)/libdosfs.a -endif - -TMP_LIBS = $(IMFSLIB) $(DOSFSLIB) - -# -# (OPTIONAL) Add local stuff here using += -# - -$(LIB): $(TMP_LIBS) - $(RM) $@ - $(RM) -r $(ARCH) - mkdir $(ARCH) - cd $(ARCH); for lib in $^; do $(AR) -xv ../$$lib; done - $(AR) ruv $@ $(ARCH)/* - $(RANLIB) $@ - -all-local: $(ARCH) $(LIB) - -.PRECIOUS: $(LIB) - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libnetworking/.cvsignore b/c/src/exec/libnetworking/.cvsignore deleted file mode 100644 index d29e5050f5..0000000000 --- a/c/src/exec/libnetworking/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -config.cache -config.guess -config.log -config.status -config.sub -configure -depcomp -install-sh -missing -mkinstalldirs diff --git a/c/src/exec/libnetworking/ChangeLog b/c/src/exec/libnetworking/ChangeLog deleted file mode 100644 index e7ad37920c..0000000000 --- a/c/src/exec/libnetworking/ChangeLog +++ /dev/null @@ -1,663 +0,0 @@ -2002-07-17 Jay Monkman - - * netinet/in.h, netinet/ip.h, netinet/ip_var.h, netinet/tcp.h: - Modified to added packed attribute.o -2002-07-05 Ralf Corsepius - - * configure.ac: RTEMS_TOP(../..). - -2002-07-01 Ralf Corsepius - - * configure.ac: Remove RTEMS_PROJECT_ROOT. - -2002-06-27 Thomas Doerfler - - * Addition of a ftp client filesystem, comparable to the tftp one. - * lib/ftpfs.c, rtems/ftpfs.h: New files. - * lib/Makefile.am, rtems/Makefile.am: Modified to reflect above. - -2002-06-27 Ralf Corsepius - - * configure.ac: Use AC_CONFIG_AUX_DIR(../..). - Add AC_PROG_RANLIB. - -2002-06-26 Ralf Corsepius - - * wrapup/Makefile.am: Don't preinstall libnetworking.a. - -2002-06-18 Ralf Corsepius - - * Makefile.am: Remove commented out net-apps. - -2002-06-17 Ralf Corsepius - - * arpa/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * kern/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * Makefile.am: Include $(top_srcdir)/../automake/*.am. - Use ../aclocal. - * lib/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * libc/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * machine/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * net/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * netinet/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * nfs/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * rtems/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * sys/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * vm/Makefile.am: Include $(top_srcdir)/../automake/*.am. - * wrapup/Makefile.am: Include $(top_srcdir)/../automake/*.am. - -2002-06-02 Ralf Corsepius - - * rtems/Makefile.am: include multilib.am instead of RTEMS_BSP.cfg. - -2002-05-30 Ralf Corsepius - - * configure.ac: Remove RTEMS_CHECK_POSIX_API. - Remove RTEMS_ENABLE_POSIX. - Remove RTEMS_CHECK_CUSTOM_BSP. - Remove RTEMS_ENABLE_POSIX. - -2002-05-29 Ralf Corsepius - - Relocate c/src/libnetworking. - * Makefile.am: Reflect moval. - * machine/Makefile.am: Ditto. - * net/Makefile.am: Ditto. - * lib/Makefile.am: Ditto. - * netinet/Makefile.am: Ditto. - * vm/Makefile.am: Ditto. - * libc/Makefile.am: Ditto. - * sys/Makefile.am: Ditto. - * arpa/Makefile.am: Ditto. - * nfs/Makefile.am: Ditto. - * kern/Makefile.am: Ditto. - * rtems/Makefile.am: Ditto. - * configure.ac: Dittp. - * wrapup/Makefile.am: Ditto. Remove references to networking apps. - -2002-05-18 Ralf Corsepius - - * rtems_telnetd/pty.c: Remove bsp.h. Include . - -2002-05-16 Ralf Corsepius - - * rtems/mkrootfs.c: Add (relocated from libmisc/rootfs). - * rtems/mkrootfs.h: Ditto. - * rtems/Makefile.am: Reflect changes above. - -2002-05-14 Ralf Corsepius - - * sys/ioctl.h: Remove. - * sys/sockio.h: Remove. - * sys/filio.h: Remove. - * sys/Makefile.am: Reflect changes above. - -2001-05-14 Joel Sherrill - - * ChangeLog: Corrected -- entry should have been in libchip. - -2002-05-01 Eric Norum - - * machine/in_cksum.h: Per PR200 fix multi-line inline assembly - to satisfy gcc 3.1 and newer. - -2002-04-26 Eric Norum - - * netinet/in_cksum_i386.c: Add volatile so the more agressive - optimization in gcc 3.1 does not reorder things. - -2002-04-18 Ralf Corsepius - - * pppd/utils.c: Adapt to gcc-3.x. - -2002-04-11 Chris Johns - - * c/src/libnetworking/rtems/rtems_bsdnet.h: To address PR59, added - the drv_ctrl driver control block field to the ifconfig network driver - structure. This field is needed by the i82586 driver which was ported - from NetBSD as it had better hardware abstraction. - -2002-04-06 Ralf Corsepius - - * ChangeLog: Fix dates. - -2002-03-30 Ralf Corsepius - - * libc/rcmd.c: Replace __rtems w/ __rtems__. - -2002-03-27 Ralf Corsepius - - * configure.ac: - AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS). - AM_INIT_AUTOMAKE([no-define foreign 1.6]). - * arpa/Makefile.am: Remove AUTOMAKE_OPTIONS. - * kern/Makefile.am: Remove AUTOMAKE_OPTIONS. - * Makefile.am: Remove AUTOMAKE_OPTIONS. - * lib/Makefile.am: Remove AUTOMAKE_OPTIONS. - * libc/Makefile.am: Remove AUTOMAKE_OPTIONS. - * machine/Makefile.am: Remove AUTOMAKE_OPTIONS. - * net/Makefile.am: Remove AUTOMAKE_OPTIONS. - * netinet/Makefile.am: Remove AUTOMAKE_OPTIONS. - * nfs/Makefile.am: Remove AUTOMAKE_OPTIONS. - * pppd/Makefile.am: Remove AUTOMAKE_OPTIONS. - * rtems/Makefile.am: Remove AUTOMAKE_OPTIONS. - * rtems_servers/Makefile.am: Remove AUTOMAKE_OPTIONS. - * rtems_telnetd/Makefile.am: Remove AUTOMAKE_OPTIONS. - * rtems_webserver/Makefile.am: Remove AUTOMAKE_OPTIONS. - * sys/Makefile.am: Remove AUTOMAKE_OPTIONS. - * vm/Makefile.am: Remove AUTOMAKE_OPTIONS. - * wrapup/Makefile.am: Remove AUTOMAKE_OPTIONS. - -2002-03-27 Thomas.Doerfler@imd-systems.de - - * PR144 - * nfs/bootp_subr.c bootpc_init(): Performs a write to memory address - 0 when called for the first time. This is done when trying to clear - the variable "dhcp_hostname". - -2002-03-27 Ilya Alexeev - - * PR162 - * net/if_ppp.c ppp_txdaemon(), net/if_pppvar.h pppstart(): Local - variables must not be used in a device write routines. Now - ppp_softc structure have own character for writing to device - (sc_outchar). I think that converting local variables to static - is not a right solution, because problems will occur in the case - of two or more ppp instances. - * net/ppp_tty.c pppstart(): Type of the ioffset variable must be - u_long, otherwise in the case of the big output packet endless - loop may occur. - -2002-03-21 Ilya Alexeev - - * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple - PPPD connections. - -2001-03-20 Till Straumann - - * PR158 - * libc/rcmd.c, libc/rcmd.c: Enable the rcmd() library call by - commenting out the parts that deal with signals. This enables - RTEMS to 'rsh' command to a server connecting fd to remote stdio. - The 'server-side' parts of this file which deal with authentication - are disabled since they are not needed. - -2002-02-27 Ilya Alexeev - - * net/if_ppp.c, pppd/auth.c, pppd/chat.c, pppd/pppd.h, - pppd/sys-rtems.c: Add server with pap-authorization - capabilities as well as eliminate some warnings. - -2002-02-27 Eric Norum - - * net/radix.c: Properly handle fetching the default route when there - is no route. This was a bug in the original FreeBSD code and this - fix is from an updated version of their code. - -2002-02-01 Mike Siers - - * pppd/rtemspppd.c (rtems_pppd_disconnect): Modified to avoid bringing - the link down too fast. - NOTE: Mike reports successfully running at 56K baud on a direct link. - -2002-01-31 Mike Siers - - * pppd/rtemsdialer.h: New file missed in previous commit. - -2002-01-31 Mike Siers - - * Nice Update of PPPD support which eliminates the - requiremetn that drivers be in the termios TASK_DRIVEN mode. - Mike did significant testing and reports that it seems to be - more stable and handle larger packets better. This patch - replaces the termios tasks with more general pppd network - driver tasks. The functions pppinput() and pppstart() get - called from the interrupt service routine. - * Makefile.am, configure.ac, net/Makefile.am, net/bpf.h, - net/ethernet.h, net/if.c, net/if.h, net/if_arp.h, net/if_dl.h, - net/if_ethersubr.c, net/if_llc.h, net/if_loop.c, net/if_ppp.h, - net/if_pppvar.h, net/if_types.h, net/netisr.h, net/ppp-comp.h, - net/ppp_defs.h, net/pppcompress.h, net/radix.c, net/radix.h, - net/raw_cb.c, net/raw_cb.h, net/raw_usrreq.c, net/route.c, - net/route.h, net/rtsock.c, pppd/Makefile.am, pppd/README, - pppd/STATUS, pppd/auth.c, pppd/cbcp.c, pppd/ccp.c, pppd/ccp.h, - pppd/chap.c, pppd/chap.h, pppd/chap_ms.c, pppd/chap_ms.h, - pppd/chat.c, pppd/demand.c, pppd/fsm.c, pppd/fsm.h, pppd/ipcp.c, - pppd/ipcp.h, pppd/ipxcp.c, pppd/ipxcp.h, pppd/lcp.c, pppd/lcp.h, - pppd/magic.c, pppd/magic.h, pppd/options.c, pppd/patchlevel.h, - pppd/pathnames.h, pppd/pppd.8, pppd/pppd.h, pppd/rtemsmain.c, - pppd/rtemspppd.c, pppd/rtemspppd.h, pppd/sys-rtems.c, pppd/upap.c, - pppd/upap.h, pppd/utils.c, pppd/example/README, - pppd/example/netconfig.h, wrapup/Makefile.am: Modified. - * net/bsd-comp.c, net/if_ppp.c, net/ppp-deflate.c, net/ppp.h, - net/ppp_tty.c, net/pppcompress.c, net/zlib.c, net/zlib.h: New file. - * modem/, modem/.cvsignore, modem/Makefile.am, modem/ppp.c, - modem/ppp.h, modem/ppp_tty.c, modem/pppcompress.c: Subdirectory removed. - -2002-01-21 Ralf Corsepius - - * rtems_telnetd/pty.c: Move config.h to were it belongs. - Remove printf (Reported by Till Straumann - ). - -2002-02-16 Eric Norum - - * lib/tftpDriver.clib/tftpDriver.c: Fix TFTP block number checking. - -2002-02-05 Ralf Corsepius - - * pppd/sys-rtems.c: Remove unused variable status from - dodefaultroute. - -2002-02-04 Ralf Corsepius - - * lib/tftpDriver.c: Remove set_errno_and_return_minus_one, include - . - - -2001-12-18 Eric Norum - - * lib/tftpDriver.c: Allow chdir() to work on TFTP `directories' - (path names with a / at the end) while disallowing open() operations - on TFTP `directories'. - -2001-12-07 Eric Norum - - * lib/tftpDriver.c: Restore write capability. - -2001-11-26 Ralf Corsepius - - * arpa/Makefile.am: Remove stray lines. - -2001-10-18 Eric Norum - - * lib/tftpDriver.c: Properly handles ../ components in chdir() and - open() operations within the TFTP file system. - -2001-10-12 Mike Siers - - * Update to stable working state. Congratulations Mike! :) - * modem_example: Directory removed. - * modem_example/16550.h, modem_example/README, modem_example/modem.c, - modem_example/modem.h, modem_example/ppp.c, modem_example/ppp.h, - modem_example/pppcompress.c: Files removed. - * pppd/example/pppd.options: New file. - * pppd/README, pppd/STATUS, pppd/cbcp.c, pppd/cbcp.h, pppd/chat.c, - pppd/pppd.h, pppd/rtemsmain.c: Updated. - -2001-10-11 Ralf Corsepius - - * .cvsignore: Add autom4te.cache for autoconf > 2.52. - * configure.in: Remove. - * configure.ac: New file, generated from configure.in by autoupdate. - -2001-09-27 Eric Norum - - * lib/tftpDriver.c: Add limited chdir() support to the TFTP - filesystem. - -2001-09-23 Ralf Corsepius - - * machine/Makefile.am: Use 'PREINSTALL_FILES ='. - * net/Makefile.am: Use 'PREINSTALL_FILES ='. - * netinet/Makefile.am: Use 'PREINSTALL_FILES ='. - * vm/Makefile.am: Use 'PREINSTALL_FILES ='. - * pppd/Makefile.am: Use 'PREINSTALL_FILES ='. - * sys/Makefile.am: Use 'PREINSTALL_FILES ='. - * rtems_servers/Makefile.am: Use 'PREINSTALL_FILES ='. - * arpa/Makefile.am: Use 'PREINSTALL_FILES ='. - * nfs/Makefile.am: Use 'PREINSTALL_FILES ='. - * rtems_webserver/Makefile.am: Use 'PREINSTALL_FILES ='. - * rtems/Makefile.am: Use 'PREINSTALL_FILES ='. - * rtems_telnetd/Makefile.am: Use 'PREINSTALL_FILES ='. - -2001-09-22 Ralf Corsepius - - * Makefile.am: Use PREINSTALL_FILES = to make automake-1.5 happy. - -2001-09-19 Eric Norum - - * lib/tftpDriver.c: Add some debugging capability. - -2001-09-19 Chris Johns - - * nfs/bootp_subr.c, rtems/rtems_bootp.c, rtems/rtems_bsdnet.h, - rtems/rtems_bsdnet_internal.h Added support for populating the - initial "root" filesystem with information obtained via the DHCP - response. - -2001-08-16 Mike Siers - - * pppd/STATUS: Updated by Joel based upon email from Mike. - * pppd/cbcp.c, pppd/cbcp.h: Readded files. These support callback - functionality that has not even been compiled under RTEMS yet. - -2001-08-16 Joel Sherrill - - * pppd/example/Makefile: Removed. - * pppd/example/Makefile-user: Added was Makefile. Renamed to - avoid bootstrap -c clobbering it. - -2001-08-16 Mike Siers - - * Update of PPPD to 2.3.11 from 2.3.5 and addition of an example - application. Mike's notes on the modifications: - - renamed error() function because of namespace problems - - removed calls to the exit() funciton - - removed extra files from the pppd source directory - - defined pppd task constant values in rtemspppd.h - - modifyied example code to get actual tick per second value - - placed the pppd 2.3.11 man page file (pppd.8) into the pppd - directory - * pppd/cbcp.c, pppd/cbcp.h, pppd/main.c, pppd/ppp_tty.c, - pppd/pppmain.c, pppd/rtems-ppp.c, pppd/rtems-ppp.c: Deleted. - * pppd/pppd.8, pppd/rtemsmain.c, pppd/rtemspppd.c, pppd/rtemspppd.h, - pppd/sys-rtems.c, pppd/utils.c, pppd/example/Makefile, - pppd/example/README, pppd/example/init.c, pppd/example/netconfig.h, - pppd/example/ppp.conf, pppd/example/pppdapp.c, pppd/example/system.h: - New files. - * modem/ppp_tty.c, net/if_ppp.h, pppd/Makefile.am, pppd/README, - pppd/STATUS, pppd/auth.c, pppd/ccp.c, pppd/ccp.h, pppd/chap.c, - pppd/chap.h, pppd/chap_ms.c, pppd/chap_ms.h, pppd/chat.c, - pppd/demand.c, pppd/fsm.c, pppd/fsm.h, pppd/ipcp.c, pppd/ipcp.h, - pppd/ipxcp.c, pppd/ipxcp.h, pppd/lcp.c, pppd/lcp.h, pppd/magic.c, - pppd/magic.h, pppd/options.c, pppd/patchlevel.h, - pppd/pathnames.h, pppd/pppd.h, pppd/upap.c, pppd/upap.h: Modified. - -2001-08-16 Joel Sherrill - - * rtems_telnetd/.cvsignore: New file. - -2001-08-09 Fernando-Ruiz Casas - - * Makefile.am, configure.in, rtems_servers/Makefile.am, - rtems_servers/telnetd.c, rtems_servers/telnetd.h, - rtems_telnetd/Makefile.am, rtems_telnetd/README, rtems_telnetd/icmds.c, - rtems_telnetd/pty.c, rtems_telnetd/pty.h, rtems_telnetd/telnetd.c, - rtems_telnetd/telnetd.h, wrapup/Makefile.am: - - pty and telnetd have a new subdir rtems_telnetd to avoid - the side effect when ftpd change. - - the tcp/ip stats have been implemented into icmds.c and - started when telnetd daemon is started. - * rtems_servers/telnetd.c, rtems_servers/telnetd.h: Removed. - * rtems_telnetd: New directory. - * rtems_telnetd/Makefile.am, rtems_telnetd/README, - rtems_telnetd/icmds.c, rtems_telnetd/pty.c, rtems_telnetd/pty.h, - rtems_telnetd/telnetd.c, rtems_telnetd/telnetd.h: New files. - -2001-05-26 Ralf Corsepius - - * rtems_servers/Makefile.am: Deleted blank lines. - -2001-06-14 Joel Sherrill - - * rtems_servers/telnetd.c, shell/telnetd.h: Moved from libmisc/shell - so the network stack to address network depenendency. - * rtems_servers/Makefile.am: Modified to reflect above. - -2001-05-09 Ralf Corsepius - - * libc/Makefile.am: Remove -D__STRICT_ANSI__. - -2001-04-24 Eric Norum - - * lib/rtems_bsdnet_ntp.c: Modifications to make the RTEMS NTP - synchronization a little more robust -- no NTP daemon yet, but - at least it trys a little harder when the primary NTP server is down. - -2001-04-20 Radzislaw Galler - - * modem/ppp.c, pppd/main.c, pppd/pppmain.c, pppd/rtems-ppp.c, - pppd/modem_example/modem.c, pppd/modem_example/ppp.c: Translated - Polish comments and other strings into English - * pppd/STATUS: updated to reflect the changes - -2001-04-20 Jake Janovetz - - * rtems_servers/ftpd.c: Correct argument so hooks work again. - -2001-03-15 Ralf Corsepius - - * include/.cvsignore: Remove dangling file. - -2001-01-31 Sergei Organov - - * rtems_servers/ftp.d: Following changes: - - Hacks with current dir and root dir removed in favor of new libio - support for task-local current and root directories. - - Bug in `close_data_socket()' introduced by previous change fixed. - - `command_pasv()' changed to set timeout on socket we are listening - on and code fixed to don't close socket twice on error. - - `serr()' changed to clear `errno'. - - `data_socket()' changed to clear `errno' before `bind()'. - - `session()' changed to clear `errno' before processing session. - - `close_data_socket()' fixed to close both active and passive sockets - - Initialize info->data_socket to -1 in `daemon()' - - Initialize `fname' to empty string in `exec_command()' - -2001-02-03 Ralf Corsepius - - * Makefile.am, arpa/Makefile.am, machine/Makefile.am, net/Makefile.am, - netinet/Makefile.am, nfs/Makefile.am, rtems/Makefile.am, - rtems_servers/Makefile.am, rtems_webserver/Makefile.am, - sys/Makefile.am, vm/Makefile.am: - Apply include_*HEADERS instead of H_FILES. - * include/Makefile.am: Remove. - * Makefile.am: Add handling of *.h files. - * configure.in: Remove include/Makefile. - -2001-01-25 Eric Norum - - * lib/tftpDriver.c: Reduce first timeout interval. This - improves throughput on systems which are dropping packets. - Only the first timeout is reduced. This keeps the number - of extra packets down on networks that are very busy and - dropping lots of packets. - -2001-01-24 Sergei Organov - - * rtems_servers/ftpd.c, rtems_servers/ftpd.h: Major enhancements - as listed below: - - Timeouts on sockets implemented. 'idle' field added to - configuration. No timeout by default to keep backward compatibility. - Note: SITE IDLE command not implemented yet. - - Basic global access control implemented. 'access' field added to - configuration. No access limitations by default to keep backward - compatibility. - - Anchor data socket for active mode (using self IP and port 20.) - - Fixed default data port support (still not tested). - - Don't allow IP address different from originating host in - PORT command to improve security. - - Fixed bug in MDTM command. - - Check for correctness of parsing of argument in command_port(). - - Fixed squeeze_path() to don't allow names like 'NAME/smth' where - 'NAME' is not a directory. - - Command parsing a little bit improved: command names are now - converted to upper-case to be more compatible with RFC (command - names are not case-sensitive.) - - Reformat comments so that they have RTEMS look-and-feel. - - Fixed DELE, SITE CHMOD, RMD, MKD broken by previous changes - - True ASCII mode implemented (doesn't work for hooks and /dev/null) - - Passive mode implemented, PASV command added. - - Default port for data connection could be used (untested, can't find - ftp client that doesn't send PORT command) - - SYST reply changed to UNIX, as former RTEMS isn't registered name. - - Reply codes reviewed and fixed. - -2001-01-12 Sergei Organov - - * rtems_servers/ftpd.c, rtems_servers/ftpd.h: Major enhancements - as listed below: - - use pool of pre-created threads to handle sessions instead of - creating/deleting threads on the fly - - LIST output is now similar to what "/bin/ls -al" would output, - thus FTP clients such Netscape are happy with it. - - LIST NAME now works (both for files and directories) - - added support for NLST, CDUP, and MDTM FTP commands to make - more FTP clients happy - - keep track of CWD for every session separately - - ability to specify root directory name for FTPD in configuration - table. FTPD will then create illusion for FTP clients that this - is actually root directory. - - ignore options sent in commands, thus LIST -al FILE works and - doesn't try to list "-al" directory. - - buffers are allocated on stack instead of heap where possible to - eliminate malloc/free calls (avoid possible heap fragmentation - troubles). - - drop using of task notepad to pass parameters - use function - arguments instead - - use snprintf() instead of sprintf() as the latter is unsafe - - use of PF_INET in socket() instead of AF_INET - - Here are ftp clients I've tried new FTPD with (all of them - running on Debian GNU/Linux 2.2): - - Lftp 2.1.10 - NcFTP 2.4.3 - Netscape 4.75 - ftp - mc 4.5.49 - -2001-01-02 Joel Sherrill - - * CHANGELOG: Removed. - * README: Merged CHANGELOG contents as initial changes. - -2000-12-14 Eric Norum - - * lib/tftpDriver.c: Added write capability. - -2000-12-08 Joel Sherrill - - * libc/linkaddr.c: Initialized variable to remove warning. - * modem/ppp.c, modem/ppp_tty.c: Made numerous variable declarations - conditional on PPP_COMPRESS and PPP_FILTER. Commented out variables - that were not used because the code using them was commented out. - Removed totally unused variables. - * modem/pppcompress.c: Added parentheses to avoid warnings. - * pppd/pppmain.c: Removed numerous warnings. - -2000-11-30 Joel Sherrill - - * modem/ppp_tty.c: Changed to include since - that is an RTEMS specific header file. - -2000-11-30 Joel Sherrill - - * sys/ttycom.h: Moved to lib/include/sys. - * Makefile.am: Modified to reflect above. - -2000-11-27 Joel Sherrill - - * libc/res_init.c: Fix typo - adding missing # on include. - -2000-11-25 Eric Norum - - * libc/res_init.c: Move include to avoid compiler dumping core. - -2000-11-25 Antti P Miettinen - - * wrapup/Makefile.am: Added modem subdir. - * configure.in, Makefile.am: Added modem subdir. - * net/Makefile.am: Added if_pppvar.h, pppcompress.h. - * pppd/Makefile.am: Added pppmain.c (which needs work). - * pppd/chat.c, pppd/fsm.c, pppd/fsm.h, pppd/ipxcp.c, pppd/main.c, - pppd/ppp_tty.c, pppd/upap.c: Changes from Thomas Doerfler - and cosmetic changes by me. - Actually main.c and ppp_tty.c should be scratched. The modem - subdir has the real ppp_tty.c and the real pppd main is in pppmain.c. - -2000-11-09 Ralf Corsepius - - * Makefile.am: Use ... instead of RTEMS_TOPdir in ACLOCAL_AMFLAGS. - -2000-11-02 Ralf Corsepius - - * Makefile.am: Switch to ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal. - -2000-10-30 Joel Sherrill - - * POSIX include files merged into newlib. This resulted in - some definitions moving to other files and thus some secondary - effects in RTEMS source code. - * machine/types.h: Added _CLOCKID_T_ and _TIMER_T_ to be in sync - with newlib's . - * rtems/rtems_bsdnet_internal.h: newlib now includes definition - of struct itimerval in . - -2000-10-25 Ralf Corsepius - - * Makefile.am: ACLOCAL_AMFLAGS= -I $(RTEMS_TOPdir)/macros. - Switch to GNU canonicalization. - -2000-10-19 Antti P Miettinen - - * lib/tftpDriver.c: add comments to handlers struct function pointers. - * rtems/rtems_glue.c: move pointer arithmetic to be _after_ - pointer has been checked against NULL. - -2000-10-18 Chris Johns - - * pppd/ipxcp.c: Fixed a typo. - -2000-09-28 Joel Sherrill - - * rtems_webserver/Makefile.am, rtems_webserver/base64.c, - rtems_webserver/base64.c: Renamed base64.c to wbase64.c. - * rtems_webserver/sock.c: Added file missed in merger. - -2000-09-22 Joel Sherrill - - * machine/types.h, pppd/pppd.h, rtems/rtems_bsdnet_internal.h, - rtems_webserver/webmain.c: machine/types.h should not have - included rtems.h. It is now including precisely the - least amount of low level, yet portable .h files to get - the basic RTEMS types defined. This rippled into other - files since rtems_bsdnet_internal.h used machine/types.h to include - rtems.h. - -2000-09-06 Ralf Corsepius - - * ChangeLog: Cleanup. - -2000-09-05 Joel Sherrill - - * rtems/rtems_syscall.c: Changed from O_NONBLOCK to internal - RTEMS_LIBIO_FLAGS_NO_DELAY to avoid O_NONBLOCK/O_NDELAY confusion - and to work with the converted flags. - -2000-09-04 Ralf Corsepius - - * kern/Makefile.am, lib/Makefile.am, libc/Makefile.am, - net/Makefile.am, netinet/Makefile.am, nfs/Makefile.am, - pppd/Makefile.am, rtems/Makefile.am, rtems_servers/Makefile.am, - rtems_webserver/Makefile.am, wrapup/Makefile.am: Include compile.am - -2000-09-01 Rosimildo daSilva - - * emfdb.c: Removed stray semi-colon. Reported on GoAhead - mailing lists by Jim Rudnicki - -2000-08-31 Joel Sherrill - - * Merged version 2.1 of GoAhead webserver. This update - was submitted by Antti P Miettinen . - * NOTES, base64.c, ejIntrn.h, emfdb.c, emfdb.h, md5.h, md5c.c, - um.c, um.h: New files. - * wbase64.c: Removed. - * Makefile.am, asp.c, balloc.c, default.c, ej.h, ejlex.c, ejparse.c, - form.c, h.c, handler.c, mime.c, misc.c, ringq.c, rom.c, security.c, - socket.c, sym.c, uemf.c, uemf.h, url.c, value.c, webcomp.c, webmain.c, - webpage.c, webrom.c, webs.c, webs.h, websuemf.c, wsIntrn.h: Modified. - -2000-08-31 Ralf Corsepius - - * netinet/tcp_input.c: Spelling corrections. - -2000-08-30 Joel Sherrill - - * rtems_webserver/license.txt: New file. - -2000-08-10 Joel Sherrill - - * ChangeLog: New file. diff --git a/c/src/exec/libnetworking/Makefile.am b/c/src/exec/libnetworking/Makefile.am deleted file mode 100644 index a2dca14fc8..0000000000 --- a/c/src/exec/libnetworking/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -## -## $Id$ -## - -ACLOCAL_AMFLAGS = -I ../aclocal - -SUBDIRS = arpa kern machine sys vm lib libc net netinet nfs rtems -SUBDIRS += wrapup - -include_HEADERS = \ - bpfilter.h loop.h netdb.h opt_ipfw.h opt_mrouting.h \ - opt_tcpdebug.h poll.h resolv.h syslog.h memory.h - -PREINSTALL_FILES = $(PROJECT_INCLUDE) \ - $(include_HEADERS:%=$(PROJECT_INCLUDE)/%) - -$(PROJECT_INCLUDE): - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/%.h: %.h - $(INSTALL_DATA) $< $@ - -all-local: $(PREINSTALL_FILES) - -EXTRA_DIST = CHANGELOG - -include $(top_srcdir)/../automake/subdirs.am -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libnetworking/README b/c/src/exec/libnetworking/README deleted file mode 100644 index ed76f94183..0000000000 --- a/c/src/exec/libnetworking/README +++ /dev/null @@ -1,72 +0,0 @@ -# -# $Id$ -# - -This is a snapshot of my attempt to fit the FreeBSD networking code into -RTEMS. Things seem to be working! - -Things that need to be done: - 1) More documentation! - 2) Figure out what's still not working :-) - 3) Rationalize the include files. Right now I have a special - hack in the Makefile to ensure that I pick up the FreeBSD versions - of the include files that are duplicated between RTEMS - and FreeBSD. - The network device driver source should move to the BSP source tree. - 4) Have a look at all the FIXME comments. - 5) Go through and make sure that all the source files are - free of undesired copyright restrictions. - -Initial Changes -=============== - -19-AUG-1998 snapshot - - Pulled BOOTP initialization out of rtems_glue. Applications which - don't used BOOTP are now about 5k smaller. - - Loopback interface is not installed by default, rather it is - attached like any other interface. Saves about 0.5 kbytes. - - Add rtems_bsdnet_show_if_stats(); - - Moved test programs from below freebsd directory. - -18-AUG-1998 snapshot - - Removed some include files that were already part of RTEMS. - - Cleaned up machine/types.h to prepare for inclusion in RTEMS source. - - Added syslog library routines -- much simpler than KA9Q version. - Sockets can be shared among tasks (as long as the send is - protected by a mutex) so there's no need for a Syslog Daemon. - -16-AUG-1998 snapshot - - Table-driven configuration (networkconfig.h). - - Cleaned up rtems_bsdnet.h. - - BOOTP now retries properly -- Note to Joel: - The dichotomy between RTEMS and UNIX error codes is - a real pain! - -14-AUG-1998 snapshot - - Added dummy getprotobyname() and getprotobynum() functions. - - Added socket ioctl. - - Added application-level entry to manipulate routing tables. - - Added non-BOOTP network initialization. - -13-AUG-1998 snapshot - - Changed some BOOTP addresses from sockaddr_in to inaddr; - - Get DNS information from BOOTP reply. - - Got DNS lookups working. - Bloatware comes to RTEMS -- invoking gethostbyname() drags in - and extra 40 kbytes of code! - - Added hostname lookup program. - -12-AUG-1998 snapshot - - Added startup delay to network initialization. - - More statistic-printing routines. - - Added TFTP driver and test program - - Modified TFTP test program to use networkconfig.h. - - Removed unused include files. - - Added from ftp://ftp.ca.FreeBSD.ORG/pub/FreeBSD/FreeBSD-current/src/lib/libc/net. - -11-AUG-1998 snapshot. - - Added getpeername() - - Added M68k versions of IP checksum code - - Added TCP timing program to snapshot. - -02-AUG-1998 snapshot. diff --git a/c/src/exec/libnetworking/arpa/.cvsignore b/c/src/exec/libnetworking/arpa/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libnetworking/arpa/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libnetworking/arpa/Makefile.am b/c/src/exec/libnetworking/arpa/Makefile.am deleted file mode 100644 index 7035012a57..0000000000 --- a/c/src/exec/libnetworking/arpa/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -## -## $Id$ -## - - -include_arpadir = $(includedir)/arpa - -include_arpa_HEADERS = ftp.h inet.h nameser.h nameser_compat.h telnet.h - -PREINSTALL_FILES = $(PROJECT_INCLUDE)/arpa \ - $(include_arpa_HEADERS:%=$(PROJECT_INCLUDE)/arpa/%) - -$(PROJECT_INCLUDE)/arpa: - @$(mkinstalldirs) $@ - -$(PROJECT_INCLUDE)/arpa/%.h: %.h - $(INSTALL_DATA) $< $@ - -all-local: $(PREINSTALL_FILES) - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libnetworking/arpa/ftp.h b/c/src/exec/libnetworking/arpa/ftp.h deleted file mode 100644 index 584d290bc9..0000000000 --- a/c/src/exec/libnetworking/arpa/ftp.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 1983, 1989, 1993 - * 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. - * - * @(#)ftp.h 8.1 (Berkeley) 6/2/93 - * - * $Id$ - */ - -#ifndef _ARPA_FTP_H_ -#define _ARPA_FTP_H_ - -/* Definitions for FTP; see RFC-765. */ - -/* - * Reply codes. - */ -#define PRELIM 1 /* positive preliminary */ -#define COMPLETE 2 /* positive completion */ -#define CONTINUE 3 /* positive intermediate */ -#define TRANSIENT 4 /* transient negative completion */ -#define ERROR 5 /* permanent negative completion */ - -/* - * Type codes - */ -#define TYPE_A 1 /* ASCII */ -#define TYPE_E 2 /* EBCDIC */ -#define TYPE_I 3 /* image */ -#define TYPE_L 4 /* local byte size */ - -#ifdef FTP_NAMES -char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; -#endif - -/* - * Form codes - */ -#define FORM_N 1 /* non-print */ -#define FORM_T 2 /* telnet format effectors */ -#define FORM_C 3 /* carriage control (ASA) */ -#ifdef FTP_NAMES -char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; -#endif - -/* - * Structure codes - */ -#define STRU_F 1 /* file (no record structure) */ -#define STRU_R 2 /* record structure */ -#define STRU_P 3 /* page structure */ -#ifdef FTP_NAMES -char *strunames[] = {"0", "File", "Record", "Page" }; -#endif - -/* - * Mode types - */ -#define MODE_S 1 /* stream */ -#define MODE_B 2 /* block */ -#define MODE_C 3 /* compressed */ -#ifdef FTP_NAMES -char *modenames[] = {"0", "Stream", "Block", "Compressed" }; -#endif - -/* - * Record Tokens - */ -#define REC_ESC '\377' /* Record-mode Escape */ -#define REC_EOR '\001' /* Record-mode End-of-Record */ -#define REC_EOF '\002' /* Record-mode End-of-File */ - -/* - * Block Header - */ -#define BLK_EOR 0x80 /* Block is End-of-Record */ -#define BLK_EOF 0x40 /* Block is End-of-File */ -#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ -#define BLK_RESTART 0x10 /* Block is Restart Marker */ - -#define BLK_BYTECOUNT 2 /* Bytes in this block */ - -#endif /* !_FTP_H_ */ diff --git a/c/src/exec/libnetworking/arpa/inet.h b/c/src/exec/libnetworking/arpa/inet.h deleted file mode 100644 index ad5332e7ab..0000000000 --- a/c/src/exec/libnetworking/arpa/inet.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* - * @(#)inet.h 8.1 (Berkeley) 6/2/93 - * From: Id: inet.h,v 8.5 1997/01/29 08:48:09 vixie Exp $ - * $Id$ - */ - -#ifndef _ARPA_INET_H_ -#define _ARPA_INET_H_ - -/* External definitions for functions in inet(3), addr2ascii(3) */ - -#include -#include - -struct in_addr; - -#if 0 /* RTEMS -- Why rename these? */ -/* XXX all new diversions!! argh!! */ -#define inet_addr __inet_addr -#define inet_aton __inet_aton -#define inet_lnaof __inet_lnaof -#define inet_makeaddr __inet_makeaddr -#define inet_neta __inet_neta -#define inet_netof __inet_netof -#define inet_network __inet_network -#define inet_net_ntop __inet_net_ntop -#define inet_net_pton __inet_net_pton -#define inet_ntoa __inet_ntoa -#define inet_pton __inet_pton -#define inet_ntop __inet_ntop -#define inet_nsap_addr __inet_nsap_addr -#define inet_nsap_ntoa __inet_nsap_ntoa -#endif - -__BEGIN_DECLS -int ascii2addr __P((int, const char *, void *)); -char *addr2ascii __P((int, const void *, int, char *)); -unsigned long inet_addr __P((const char *)); -int inet_aton __P((const char *, struct in_addr *)); -unsigned long inet_lnaof __P((struct in_addr)); -struct in_addr inet_makeaddr __P((u_long , u_long)); -char * inet_neta __P((u_long, char *, size_t)); -unsigned long inet_netof __P((struct in_addr)); -unsigned long inet_network __P((const char *)); -char *inet_net_ntop __P((int, const void *, int, char *, size_t)); -int inet_net_pton __P((int, const char *, void *, size_t)); -char *inet_ntoa __P((struct in_addr)); -int inet_pton __P((int, const char *, void *)); -const char *inet_ntop __P((int, const void *, char *, size_t)); -u_int inet_nsap_addr __P((const char *, u_char *, int)); -char *inet_nsap_ntoa __P((int, const u_char *, char *)); -__END_DECLS - -#endif /* !_INET_H_ */ diff --git a/c/src/exec/libnetworking/arpa/nameser.h b/c/src/exec/libnetworking/arpa/nameser.h deleted file mode 100644 index 634dece37b..0000000000 --- a/c/src/exec/libnetworking/arpa/nameser.h +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (c) 1983, 1989, 1993 - * 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. - */ - -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* - * From: Id: nameser.h,v 8.16 1998/02/06 00:35:58 halley Exp - * $Id$ - */ - -#ifndef _ARPA_NAMESER_H_ -#define _ARPA_NAMESER_H_ - -#define BIND_4_COMPAT - -#include -#include - -/* - * revision information. this is the release date in YYYYMMDD format. - * it can change every day so the right thing to do with it is use it - * in preprocessor commands such as "#if (__NAMESER > 19931104)". do not - * compare for equality; rather, use it to determine whether your libnameser.a - * is new enough to contain a certain feature. - */ - -/* XXXRTH I made this bigger than __BIND in 4.9.5 T6B */ -#define __NAMESER 19961001 /* New interface version stamp. */ - -/* - * Define constants based on RFC 883, RFC 1034, RFC 1035 - */ -#define NS_PACKETSZ 512 /* maximum packet size */ -#define NS_MAXDNAME 1025 /* maximum domain name */ -#define NS_MAXCDNAME 255 /* maximum compressed domain name */ -#define NS_MAXLABEL 63 /* maximum length of domain label */ -#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ -#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ -#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ -#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */ -#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */ -#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */ -#define NS_INADDRSZ 4 /* IPv4 T_A */ -#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ -#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ -#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ - -/* - * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord() - * in synch with it. - */ -typedef enum __ns_sect { - ns_s_qd = 0, /* Query: Question. */ - ns_s_zn = 0, /* Update: Zone. */ - ns_s_an = 1, /* Query: Answer. */ - ns_s_pr = 1, /* Update: Prerequisites. */ - ns_s_ns = 2, /* Query: Name servers. */ - ns_s_ud = 2, /* Update: Update. */ - ns_s_ar = 3, /* Query|Update: Additional records. */ - ns_s_max = 4 -} ns_sect; - -/* - * This is a message handle. It is caller allocated and has no dynamic data. - * This structure is intended to be opaque to all but ns_parse.c, thus the - * leading _'s on the member names. Use the accessor functions, not the _'s. - */ -typedef struct __ns_msg { - const u_char *_msg, *_eom; - u_int16_t _id, _flags, _counts[ns_s_max]; - const u_char *_sections[ns_s_max]; - ns_sect _sect; - int _rrnum; - const u_char *_ptr; -} ns_msg; - -/* Private data structure - do not use from outside library. */ -struct _ns_flagdata { int mask, shift; }; -extern struct _ns_flagdata _ns_flagdata[]; - -/* Accessor macros - this is part of the public interface. */ -#define ns_msg_getflag(handle, flag) ( \ - ((handle)._flags & _ns_flagdata[flag].mask) \ - >> _ns_flagdata[flag].shift \ - ) -#define ns_msg_id(handle) ((handle)._id + 0) -#define ns_msg_base(handle) ((handle)._msg + 0) -#define ns_msg_end(handle) ((handle)._eom + 0) -#define ns_msg_size(handle) ((handle)._eom - (handle)._msg) -#define ns_msg_count(handle, section) ((handle)._counts[section] + 0) - -/* - * This is a parsed record. It is caller allocated and has no dynamic data. - */ -typedef struct __ns_rr { - char name[NS_MAXDNAME]; /* XXX need to malloc */ - u_int16_t type; - u_int16_t class; - u_int32_t ttl; - u_int16_t rdlength; - const u_char *rdata; -} ns_rr; - -/* Accessor macros - this is part of the public interface. */ -#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") -#define ns_rr_type(rr) ((rr).type + 0) -#define ns_rr_class(rr) ((rr).class + 0) -#define ns_rr_ttl(rr) ((rr).ttl + 0) -#define ns_rr_rdlen(rr) ((rr).rdlength + 0) -#define ns_rr_rdata(rr) ((rr).rdata + 0) - -/* - * These don't have to be in the same order as in the packet flags word, - * and they can even overlap in some cases, but they will need to be kept - * in synch with ns_parse.c:ns_flagdata[]. - */ -typedef enum __ns_flag { - ns_f_qr, /* Question/Response. */ - ns_f_opcode, /* Operation code. */ - ns_f_aa, /* Authoritative Answer. */ - ns_f_tc, /* Truncation occurred. */ - ns_f_rd, /* Recursion Desired. */ - ns_f_ra, /* Recursion Available. */ - ns_f_z, /* MBZ. */ - ns_f_ad, /* Authentic Data (DNSSEC). */ - ns_f_cd, /* Checking Disabled (DNSSEC). */ - ns_f_rcode, /* Response code. */ - ns_f_max -} ns_flag; - -/* - * Currently defined opcodes. - */ -typedef enum __ns_opcode { - ns_o_query = 0, /* Standard query. */ - ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ - ns_o_status = 2, /* Name server status query (unsupported). */ - /* Opcode 3 is undefined/reserved. */ - ns_o_notify = 4, /* Zone change notification. */ - ns_o_update = 5, /* Zone update message. */ - ns_o_max = 6 -} ns_opcode; - -/* - * Currently defined response codes. - */ -typedef enum __ns_rcode { - ns_r_noerror = 0, /* No error occurred. */ - ns_r_formerr = 1, /* Format error. */ - ns_r_servfail = 2, /* Server failure. */ - ns_r_nxdomain = 3, /* Name error. */ - ns_r_notimpl = 4, /* Unimplemented. */ - ns_r_refused = 5, /* Operation refused. */ - /* these are for BIND_UPDATE */ - ns_r_yxdomain = 6, /* Name exists */ - ns_r_yxrrset = 7, /* RRset exists */ - ns_r_nxrrset = 8, /* RRset does not exist */ - ns_r_notauth = 9, /* Not authoritative for zone */ - ns_r_notzone = 10, /* Zone of record different from zone section */ - ns_r_max = 11 -} ns_rcode; - -/* BIND_UPDATE */ -typedef enum __ns_update_operation { - ns_uop_delete = 0, - ns_uop_add = 1, - ns_uop_max = 2 -} ns_update_operation; - -/* - * This RR-like structure is particular to UPDATE. - */ -struct ns_updrec { - struct ns_updrec *r_prev; /* prev record */ - struct ns_updrec *r_next; /* next record */ - u_int8_t r_section; /* ZONE/PREREQUISITE/UPDATE */ - char * r_dname; /* owner of the RR */ - u_int16_t r_class; /* class number */ - u_int16_t r_type; /* type number */ - u_int32_t r_ttl; /* time to live */ - u_char * r_data; /* rdata fields as text string */ - u_int16_t r_size; /* size of r_data field */ - int r_opcode; /* type of operation */ - /* following fields for private use by the resolver/server routines */ - struct ns_updrec *r_grpnext; /* next record when grouped */ - struct databuf *r_dp; /* databuf to process */ - struct databuf *r_deldp; /* databuf's deleted/overwritten */ - u_int16_t r_zone; /* zone number on server */ -}; -typedef struct ns_updrec ns_updrec; - -/* - * Currently defined type values for resources and queries. - */ -typedef enum __ns_type { - ns_t_a = 1, /* Host address. */ - ns_t_ns = 2, /* Authoritative server. */ - ns_t_md = 3, /* Mail destination. */ - ns_t_mf = 4, /* Mail forwarder. */ - ns_t_cname = 5, /* Canonical name. */ - ns_t_soa = 6, /* Start of authority zone. */ - ns_t_mb = 7, /* Mailbox domain name. */ - ns_t_mg = 8, /* Mail group member. */ - ns_t_mr = 9, /* Mail rename name. */ - ns_t_null = 10, /* Null resource record. */ - ns_t_wks = 11, /* Well known service. */ - ns_t_ptr = 12, /* Domain name pointer. */ - ns_t_hinfo = 13, /* Host information. */ - ns_t_minfo = 14, /* Mailbox information. */ - ns_t_mx = 15, /* Mail routing information. */ - ns_t_txt = 16, /* Text strings. */ - ns_t_rp = 17, /* Responsible person. */ - ns_t_afsdb = 18, /* AFS cell database. */ - ns_t_x25 = 19, /* X_25 calling address. */ - ns_t_isdn = 20, /* ISDN calling address. */ - ns_t_rt = 21, /* Router. */ - ns_t_nsap = 22, /* NSAP address. */ - ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ - ns_t_sig = 24, /* Security signature. */ - ns_t_key = 25, /* Security key. */ - ns_t_px = 26, /* X.400 mail mapping. */ - ns_t_gpos = 27, /* Geographical position (withdrawn). */ - ns_t_aaaa = 28, /* Ip6 Address. */ - ns_t_loc = 29, /* Location Information. */ - ns_t_nxt = 30, /* Next domain (security). */ - ns_t_eid = 31, /* Endpoint identifier. */ - ns_t_nimloc = 32, /* Nimrod Locator. */ - ns_t_srv = 33, /* Server Selection. */ - ns_t_atma = 34, /* ATM Address */ - ns_t_naptr = 35, /* Naming Authority PoinTeR */ - /* Query type values which do not appear in resource records. */ - ns_t_ixfr = 251, /* Incremental zone transfer. */ - ns_t_axfr = 252, /* Transfer zone of authority. */ - ns_t_mailb = 253, /* Transfer mailbox records. */ - ns_t_maila = 254, /* Transfer mail agent records. */ - ns_t_any = 255, /* Wildcard match. */ - ns_t_max = 65536 -} ns_type; - -/* - * Values for class field - */ -typedef enum __ns_class { - ns_c_in = 1, /* Internet. */ - /* Class 2 unallocated/unsupported. */ - ns_c_chaos = 3, /* MIT Chaos-net. */ - ns_c_hs = 4, /* MIT Hesiod. */ - /* Query class values which do not appear in resource records */ - ns_c_none = 254, /* for prereq. sections in update requests */ - ns_c_any = 255, /* Wildcard match. */ - ns_c_max = 65536 -} ns_class; - -/* - * Flags field of the KEY RR rdata - */ -#define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */ -#define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */ -#define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */ -#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */ -#define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */ -/* The type bits can also be interpreted independently, as single bits: */ -#define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */ -#define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */ -#define NS_KEY_EXPERIMENTAL 0x2000 /* Security is *mandatory* if bit=0 */ -#define NS_KEY_RESERVED3 0x1000 /* reserved - must be zero */ -#define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */ -#define NS_KEY_USERACCOUNT 0x0400 /* key is assoc. with a user acct */ -#define NS_KEY_ENTITY 0x0200 /* key is assoc. with entity eg host */ -#define NS_KEY_ZONEKEY 0x0100 /* key is zone key */ -#define NS_KEY_IPSEC 0x0080 /* key is for IPSEC (host or user)*/ -#define NS_KEY_EMAIL 0x0040 /* key is for email (MIME security) */ -#define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */ -#define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */ -#define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */ - -#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED3 | \ - NS_KEY_RESERVED4 | \ - NS_KEY_RESERVED10 | \ - NS_KEY_RESERVED11 ) - -/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */ -#define NS_ALG_MD5RSA 1 /* MD5 with RSA */ -#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */ -#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */ - -/* Signatures */ -#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */ -#define NS_MD5RSA_MAX_BITS 2552 - /* Total of binary mod and exp */ -#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3) - /* Max length of text sig block */ -#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4) - -/* Offsets into SIG record rdata to find various values */ -#define NS_SIG_TYPE 0 /* Type flags */ -#define NS_SIG_ALG 2 /* Algorithm */ -#define NS_SIG_LABELS 3 /* How many labels in name */ -#define NS_SIG_OTTL 4 /* Original TTL */ -#define NS_SIG_EXPIR 8 /* Expiration time */ -#define NS_SIG_SIGNED 12 /* Signature time */ -#define NS_SIG_FOOT 16 /* Key footprint */ -#define NS_SIG_SIGNER 18 /* Domain name of who signed it */ - -/* How RR types are represented as bit-flags in NXT records */ -#define NS_NXT_BITS 8 -#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS))) -#define NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS))) -#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS))) - - -/* - * Inline versions of get/put short/long. Pointer is advanced. - */ -#define NS_GET16(s, cp) { \ - register u_char *t_cp = (u_char *)(cp); \ - (s) = ((u_int16_t)t_cp[0] << 8) \ - | ((u_int16_t)t_cp[1]) \ - ; \ - (cp) += NS_INT16SZ; \ -} - -#define NS_GET32(l, cp) { \ - register u_char *t_cp = (u_char *)(cp); \ - (l) = ((u_int32_t)t_cp[0] << 24) \ - | ((u_int32_t)t_cp[1] << 16) \ - | ((u_int32_t)t_cp[2] << 8) \ - | ((u_int32_t)t_cp[3]) \ - ; \ - (cp) += NS_INT32SZ; \ -} - -#define NS_PUT16(s, cp) { \ - register u_int16_t t_s = (u_int16_t)(s); \ - register u_char *t_cp = (u_char *)(cp); \ - *t_cp++ = t_s >> 8; \ - *t_cp = t_s; \ - (cp) += NS_INT16SZ; \ -} - -#define NS_PUT32(l, cp) { \ - register u_int32_t t_l = (u_int32_t)(l); \ - register u_char *t_cp = (u_char *)(cp); \ - *t_cp++ = t_l >> 24; \ - *t_cp++ = t_l >> 16; \ - *t_cp++ = t_l >> 8; \ - *t_cp = t_l; \ - (cp) += NS_INT32SZ; \ -} - -/* - * ANSI C identifier hiding. - */ -#define ns_get16 __ns_get16 -#define ns_get32 __ns_get32 -#define ns_put16 __ns_put16 -#define ns_put32 __ns_put32 -#define ns_initparse __ns_initparse -#define ns_parserr __ns_parserr -#define ns_sprintrr __ns_sprintrr -#define ns_sprintrrf __ns_sprintrrf -#define ns_format_ttl __ns_format_ttl -#define ns_parse_ttl __ns_parse_ttl -#define ns_name_ntop __ns_name_ntop -#define ns_name_pton __ns_name_pton -#define ns_name_unpack __ns_name_unpack -#define ns_name_pack __ns_name_pack -#define ns_name_compress __ns_name_compress -#define ns_name_uncompress __ns_name_uncompress - -__BEGIN_DECLS -u_int ns_get16 __P((const u_char *)); -u_long ns_get32 __P((const u_char *)); -void ns_put16 __P((u_int, u_char *)); -void ns_put32 __P((u_long, u_char *)); -int ns_initparse __P((const u_char *, int, ns_msg *)); -int ns_parserr __P((ns_msg *, ns_sect, int, ns_rr *)); -int ns_sprintrr __P((const ns_msg *, const ns_rr *, - const char *, const char *, char *, size_t)); -int ns_sprintrrf __P((const u_char *, size_t, const char *, - ns_class, ns_type, u_long, const u_char *, - size_t, const char *, const char *, - char *, size_t)); -int ns_format_ttl __P((u_long, char *, size_t)); -int ns_parse_ttl __P((const char *, u_long *)); -int ns_name_ntop __P((const u_char *, char *, size_t)); -int ns_name_pton __P((const char *, u_char *, size_t)); -int ns_name_unpack __P((const u_char *, const u_char *, - const u_char *, u_char *, size_t)); -int ns_name_pack __P((const u_char *, u_char *, int, - const u_char **, const u_char **)); -int ns_name_uncompress __P((const u_char *, const u_char *, - const u_char *, char *, size_t)); -int ns_name_compress __P((const char *, u_char *, size_t, - const u_char **, const u_char **)); -int ns_name_skip __P((const u_char **, const u_char *)); -__END_DECLS - -#ifdef BIND_4_COMPAT -#include -#endif - -#endif /* !_ARPA_NAMESER_H_ */ diff --git a/c/src/exec/libnetworking/arpa/nameser_compat.h b/c/src/exec/libnetworking/arpa/nameser_compat.h deleted file mode 100644 index 2ab5b47386..0000000000 --- a/c/src/exec/libnetworking/arpa/nameser_compat.h +++ /dev/null @@ -1,194 +0,0 @@ -/* Copyright (c) 1983, 1989 - * 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. - */ - -/* - * from nameser.h 8.1 (Berkeley) 6/2/93 - * From: Id: nameser_compat.h,v 8.9 1998/03/20 23:25:10 halley Exp - * $Id$ - */ - -#ifndef _ARPA_NAMESER_COMPAT_ -#define _ARPA_NAMESER_COMPAT_ - -#define __BIND 19950621 /* (DEAD) interface version stamp. */ - -#include - -#if !defined(BYTE_ORDER) || \ - (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \ - BYTE_ORDER != PDP_ENDIAN) - /* you must determine what the correct bit order is for - * your compiler - the next line is an intentional error - * which will force your compiles to bomb until you fix - * the above macros. - */ - error "Undefined or invalid BYTE_ORDER"; -#endif - -/* - * Structure for query header. The order of the fields is machine- and - * compiler-dependent, depending on the byte/bit order and the layout - * of bit fields. We use bit fields only in int variables, as this - * is all ANSI requires. This requires a somewhat confusing rearrangement. - */ - -typedef struct { - unsigned id :16; /* query identification number */ -#if BYTE_ORDER == BIG_ENDIAN - /* fields in third byte */ - unsigned qr: 1; /* response flag */ - unsigned opcode: 4; /* purpose of message */ - unsigned aa: 1; /* authoritive answer */ - unsigned tc: 1; /* truncated message */ - unsigned rd: 1; /* recursion desired */ - /* fields in fourth byte */ - unsigned ra: 1; /* recursion available */ - unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ - unsigned ad: 1; /* authentic data from named */ - unsigned cd: 1; /* checking disabled by resolver */ - unsigned rcode :4; /* response code */ -#endif -#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN - /* fields in third byte */ - unsigned rd :1; /* recursion desired */ - unsigned tc :1; /* truncated message */ - unsigned aa :1; /* authoritive answer */ - unsigned opcode :4; /* purpose of message */ - unsigned qr :1; /* response flag */ - /* fields in fourth byte */ - unsigned rcode :4; /* response code */ - unsigned cd: 1; /* checking disabled by resolver */ - unsigned ad: 1; /* authentic data from named */ - unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ - unsigned ra :1; /* recursion available */ -#endif - /* remaining bytes */ - unsigned qdcount :16; /* number of question entries */ - unsigned ancount :16; /* number of answer entries */ - unsigned nscount :16; /* number of authority entries */ - unsigned arcount :16; /* number of resource entries */ -} HEADER; - -#define PACKETSZ NS_PACKETSZ -#define MAXDNAME NS_MAXDNAME -#define MAXCDNAME NS_MAXCDNAME -#define MAXLABEL NS_MAXLABEL -#define HFIXEDSZ NS_HFIXEDSZ -#define QFIXEDSZ NS_QFIXEDSZ -#define RRFIXEDSZ NS_RRFIXEDSZ -#define INT32SZ NS_INT32SZ -#define INT16SZ NS_INT16SZ -#define INADDRSZ NS_INADDRSZ -#define IN6ADDRSZ NS_IN6ADDRSZ -#define INDIR_MASK NS_CMPRSFLGS -#define NAMESERVER_PORT NS_DEFAULTPORT - -#define S_ZONE ns_s_zn -#define S_PREREQ ns_s_pr -#define S_UPDATE ns_s_ud -#define S_ADDT ns_s_ar - -#define QUERY ns_o_query -#define IQUERY ns_o_iquery -#define STATUS ns_o_status -#define NS_NOTIFY_OP ns_o_notify -#define NS_UPDATE_OP ns_o_update - -#define NOERROR ns_r_noerror -#define FORMERR ns_r_formerr -#define SERVFAIL ns_r_servfail -#define NXDOMAIN ns_r_nxdomain -#define NOTIMP ns_r_notimpl -#define REFUSED ns_r_refused -#define YXDOMAIN ns_r_yxdomain -#define YXRRSET ns_r_yxrrset -#define NXRRSET ns_r_nxrrset -#define NOTAUTH ns_r_notauth -#define NOTZONE ns_r_notzone - -#define DELETE ns_uop_delete -#define ADD ns_uop_add - -#define T_A ns_t_a -#define T_NS ns_t_ns -#define T_MD ns_t_md -#define T_MF ns_t_mf -#define T_CNAME ns_t_cname -#define T_SOA ns_t_soa -#define T_MB ns_t_mb -#define T_MG ns_t_mg -#define T_MR ns_t_mr -#define T_NULL ns_t_null -#define T_WKS ns_t_wks -#define T_PTR ns_t_ptr -#define T_HINFO ns_t_hinfo -#define T_MINFO ns_t_minfo -#define T_MX ns_t_mx -#define T_TXT ns_t_txt -#define T_RP ns_t_rp -#define T_AFSDB ns_t_afsdb -#define T_X25 ns_t_x25 -#define T_ISDN ns_t_isdn -#define T_RT ns_t_rt -#define T_NSAP ns_t_nsap -#define T_NSAP_PTR ns_t_nsap_ptr -#define T_SIG ns_t_sig -#define T_KEY ns_t_key -#define T_PX ns_t_px -#define T_GPOS ns_t_gpos -#define T_AAAA ns_t_aaaa -#define T_LOC ns_t_loc -#define T_NXT ns_t_nxt -#define T_EID ns_t_eid -#define T_NIMLOC ns_t_nimloc -#define T_SRV ns_t_srv -#define T_ATMA ns_t_atma -#define T_NAPTR ns_t_naptr -#define T_IXFR ns_t_ixfr -#define T_AXFR ns_t_axfr -#define T_MAILB ns_t_mailb -#define T_MAILA ns_t_maila -#define T_ANY ns_t_any - -#define C_IN ns_c_in -#define C_CHAOS ns_c_chaos -#define C_HS ns_c_hs -/* BIND_UPDATE */ -#define C_NONE ns_c_none -#define C_ANY ns_c_any - -#define GETSHORT NS_GET16 -#define GETLONG NS_GET32 -#define PUTSHORT NS_PUT16 -#define PUTLONG NS_PUT32 - -#endif /* _ARPA_NAMESER_COMPAT_ */ diff --git a/c/src/exec/libnetworking/arpa/telnet.h b/c/src/exec/libnetworking/arpa/telnet.h deleted file mode 100644 index 09b85692da..0000000000 --- a/c/src/exec/libnetworking/arpa/telnet.h +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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. - * - * @(#)telnet.h 8.2 (Berkeley) 12/15/93 - * - * $Id$ - */ - -#ifndef _ARPA_TELNET_H_ -#define _ARPA_TELNET_H_ - -/* - * Definitions for the TELNET protocol. - */ -#define IAC 255 /* interpret as command: */ -#define DONT 254 /* you are not to use option */ -#define DO 253 /* please, you use option */ -#define WONT 252 /* I won't use option */ -#define WILL 251 /* I will use option */ -#define SB 250 /* interpret as subnegotiation */ -#define GA 249 /* you may reverse the line */ -#define EL 248 /* erase the current line */ -#define EC 247 /* erase the current character */ -#define AYT 246 /* are you there */ -#define AO 245 /* abort output--but let prog finish */ -#define IP 244 /* interrupt process--permanently */ -#define BREAK 243 /* break */ -#define DM 242 /* data mark--for connect. cleaning */ -#define NOP 241 /* nop */ -#define SE 240 /* end sub negotiation */ -#define EOR 239 /* end of record (transparent mode) */ -#define ABORT 238 /* Abort process */ -#define SUSP 237 /* Suspend process */ -#define xEOF 236 /* End of file: EOF is already used... */ - -#define SYNCH 242 /* for telfunc calls */ - -#ifdef TELCMDS -char *telcmds[] = { - "EOF", "SUSP", "ABORT", "EOR", - "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", - "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", - 0 -}; -#else -extern char *telcmds[]; -#endif - -#define TELCMD_FIRST xEOF -#define TELCMD_LAST IAC -#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ - (unsigned int)(x) >= TELCMD_FIRST) -#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] - -/* telnet options */ -#define TELOPT_BINARY 0 /* 8-bit data path */ -#define TELOPT_ECHO 1 /* echo */ -#define TELOPT_RCP 2 /* prepare to reconnect */ -#define TELOPT_SGA 3 /* suppress go ahead */ -#define TELOPT_NAMS 4 /* approximate message size */ -#define TELOPT_STATUS 5 /* give status */ -#define TELOPT_TM 6 /* timing mark */ -#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ -#define TELOPT_NAOL 8 /* negotiate about output line width */ -#define TELOPT_NAOP 9 /* negotiate about output page size */ -#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ -#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ -#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ -#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ -#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ -#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ -#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII 17 /* extended ascic character set */ -#define TELOPT_LOGOUT 18 /* force logout */ -#define TELOPT_BM 19 /* byte macro */ -#define TELOPT_DET 20 /* data entry terminal */ -#define TELOPT_SUPDUP 21 /* supdup protocol */ -#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ -#define TELOPT_SNDLOC 23 /* send location */ -#define TELOPT_TTYPE 24 /* terminal type */ -#define TELOPT_EOR 25 /* end or record */ -#define TELOPT_TUID 26 /* TACACS user identification */ -#define TELOPT_OUTMRK 27 /* output marking */ -#define TELOPT_TTYLOC 28 /* terminal location number */ -#define TELOPT_3270REGIME 29 /* 3270 regime */ -#define TELOPT_X3PAD 30 /* X.3 PAD */ -#define TELOPT_NAWS 31 /* window size */ -#define TELOPT_TSPEED 32 /* terminal speed */ -#define TELOPT_LFLOW 33 /* remote flow control */ -#define TELOPT_LINEMODE 34 /* Linemode option */ -#define TELOPT_XDISPLOC 35 /* X Display Location */ -#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ -#define TELOPT_AUTHENTICATION 37/* Authenticate */ -#define TELOPT_ENCRYPT 38 /* Encryption option */ -#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ -#define TELOPT_EXOPL 255 /* extended-options-list */ - - -#define NTELOPTS (1+TELOPT_NEW_ENVIRON) -#ifdef TELOPTS -char *telopts[NTELOPTS+1] = { - "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", - "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", - "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", - "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", - "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", - "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", - "TACACS UID", "OUTPUT MARKING", "TTYLOC", - "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", - "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", - "ENCRYPT", "NEW-ENVIRON", - 0 -}; -#define TELOPT_FIRST TELOPT_BINARY -#define TELOPT_LAST TELOPT_NEW_ENVIRON -#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) -#define TELOPT(x) telopts[(x)-TELOPT_FIRST] -#endif - -/* sub-option qualifiers */ -#define TELQUAL_IS 0 /* option is... */ -#define TELQUAL_SEND 1 /* send option */ -#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ -#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ -#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ - -#define LFLOW_OFF 0 /* Disable remote flow control */ -#define LFLOW_ON 1 /* Enable remote flow control */ -#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ -#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ - -/* - * LINEMODE suboptions - */ - -#define LM_MODE 1 -#define LM_FORWARDMASK 2 -#define LM_SLC 3 - -#define MODE_EDIT 0x01 -#define MODE_TRAPSIG 0x02 -#define MODE_ACK 0x04 -#define MODE_SOFT_TAB 0x08 -#define MODE_LIT_ECHO 0x10 - -#define MODE_MASK 0x1f - -/* Not part of protocol, but needed to simplify things... */ -#define MODE_FLOW 0x0100 -#define MODE_ECHO 0x0200 -#define MODE_INBIN 0x0400 -#define MODE_OUTBIN 0x0800 -#define MODE_FORCE 0x1000 - -#define SLC_SYNCH 1 -#define SLC_BRK 2 -#define SLC_IP 3 -#define SLC_AO 4 -#define SLC_AYT 5 -#define SLC_EOR 6 -#define SLC_ABORT 7 -#define SLC_EOF 8 -#define SLC_SUSP 9 -#define SLC_EC 10 -#define SLC_EL 11 -#define SLC_EW 12 -#define SLC_RP 13 -#define SLC_LNEXT 14 -#define SLC_XON 15 -#define SLC_XOFF 16 -#define SLC_FORW1 17 -#define SLC_FORW2 18 -#define SLC_MCL 19 -#define SLC_MCR 20 -#define SLC_MCWL 21 -#define SLC_MCWR 22 -#define SLC_MCBOL 23 -#define SLC_MCEOL 24 -#define SLC_INSRT 25 -#define SLC_OVER 26 -#define SLC_ECR 27 -#define SLC_EWR 28 -#define SLC_EBOL 29 -#define SLC_EEOL 30 - -#define NSLC 30 - -/* - * For backwards compatability, we define SLC_NAMES to be the - * list of names if SLC_NAMES is not defined. - */ -#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ - "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ - "LNEXT", "XON", "XOFF", "FORW1", "FORW2", \ - "MCL", "MCR", "MCWL", "MCWR", "MCBOL", \ - "MCEOL", "INSRT", "OVER", "ECR", "EWR", \ - "EBOL", "EEOL", \ - 0 - -#ifdef SLC_NAMES -char *slc_names[] = { - SLC_NAMELIST -}; -#else -extern char *slc_names[]; -#define SLC_NAMES SLC_NAMELIST -#endif - -#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) -#define SLC_NAME(x) slc_names[x] - -#define SLC_NOSUPPORT 0 -#define SLC_CANTCHANGE 1 -#define SLC_VARIABLE 2 -#define SLC_DEFAULT 3 -#define SLC_LEVELBITS 0x03 - -#define SLC_FUNC 0 -#define SLC_FLAGS 1 -#define SLC_VALUE 2 - -#define SLC_ACK 0x80 -#define SLC_FLUSHIN 0x40 -#define SLC_FLUSHOUT 0x20 - -#define OLD_ENV_VAR 1 -#define OLD_ENV_VALUE 0 -#define NEW_ENV_VAR 0 -#define NEW_ENV_VALUE 1 -#define ENV_ESC 2 -#define ENV_USERVAR 3 - -/* - * AUTHENTICATION suboptions - */ - -/* - * Who is authenticating who ... - */ -#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ -#define AUTH_WHO_SERVER 1 /* Server authenticating client */ -#define AUTH_WHO_MASK 1 - -/* - * amount of authentication done - */ -#define AUTH_HOW_ONE_WAY 0 -#define AUTH_HOW_MUTUAL 2 -#define AUTH_HOW_MASK 2 - -#define AUTHTYPE_NULL 0 -#define AUTHTYPE_KERBEROS_V4 1 -#define AUTHTYPE_KERBEROS_V5 2 -#define AUTHTYPE_SPX 3 -#define AUTHTYPE_MINK 4 -#define AUTHTYPE_CNT 5 - -#define AUTHTYPE_TEST 99 - -#ifdef AUTH_NAMES -char *authtype_names[] = { - "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", - 0 -}; -#else -extern char *authtype_names[]; -#endif - -#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) -#define AUTHTYPE_NAME(x) authtype_names[x] - -/* - * ENCRYPTion suboptions - */ -#define ENCRYPT_IS 0 /* I pick encryption type ... */ -#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ -#define ENCRYPT_REPLY 2 /* Initial setup response */ -#define ENCRYPT_START 3 /* Am starting to send encrypted */ -#define ENCRYPT_END 4 /* Am ending encrypted */ -#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ -#define ENCRYPT_REQEND 6 /* Request you end encrypting */ -#define ENCRYPT_ENC_KEYID 7 -#define ENCRYPT_DEC_KEYID 8 -#define ENCRYPT_CNT 9 - -#define ENCTYPE_ANY 0 -#define ENCTYPE_DES_CFB64 1 -#define ENCTYPE_DES_OFB64 2 -#define ENCTYPE_CNT 3 - -#ifdef ENCRYPT_NAMES -char *encrypt_names[] = { - "IS", "SUPPORT", "REPLY", "START", "END", - "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", - 0 -}; -char *enctype_names[] = { - "ANY", "DES_CFB64", "DES_OFB64", - 0 -}; -#else -extern char *encrypt_names[]; -extern char *enctype_names[]; -#endif - - -#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) -#define ENCRYPT_NAME(x) encrypt_names[x] - -#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) -#define ENCTYPE_NAME(x) enctype_names[x] - -#endif /* !_TELNET_H_ */ diff --git a/c/src/exec/libnetworking/bpfilter.h b/c/src/exec/libnetworking/bpfilter.h deleted file mode 100644 index 5a6ee0337b..0000000000 --- a/c/src/exec/libnetworking/bpfilter.h +++ /dev/null @@ -1,6 +0,0 @@ -/* - * $Id$ - */ - -/* intentionally empty file */ - diff --git a/c/src/exec/libnetworking/configure.ac b/c/src/exec/libnetworking/configure.ac deleted file mode 100644 index b81f189114..0000000000 --- a/c/src/exec/libnetworking/configure.ac +++ /dev/null @@ -1,44 +0,0 @@ -## Process this file with autoconf to produce a configure script. -## -## $Id$ - -AC_PREREQ(2.52) -AC_INIT([rtems-c-src-libnetworking],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com]) -AC_CONFIG_SRCDIR([arpa]) -RTEMS_TOP(../..) -AC_CONFIG_AUX_DIR(../..) - -RTEMS_CANONICAL_TARGET_CPU - -AM_INIT_AUTOMAKE([no-define foreign 1.6]) -AM_MAINTAINER_MODE - -RTEMS_ENABLE_NETWORKING - -RTEMS_ENV_RTEMSCPU - -RTEMS_CHECK_CPU -RTEMS_CANONICAL_HOST - -RTEMS_PROG_CC_FOR_TARGET -RTEMS_CANONICALIZE_TOOLS -AC_PROG_RANLIB - -RTEMS_CHECK_NETWORKING - -# Explicitly list all Makefiles here -AC_CONFIG_FILES([Makefile -arpa/Makefile -machine/Makefile -kern/Makefile -sys/Makefile -vm/Makefile -lib/Makefile -libc/Makefile -net/Makefile -netinet/Makefile -nfs/Makefile -rtems/Makefile -wrapup/Makefile -]) -AC_OUTPUT diff --git a/c/src/exec/libnetworking/kern/.cvsignore b/c/src/exec/libnetworking/kern/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libnetworking/kern/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libnetworking/kern/Makefile.am b/c/src/exec/libnetworking/kern/Makefile.am deleted file mode 100644 index 7fb7e608ad..0000000000 --- a/c/src/exec/libnetworking/kern/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -## -## $Id$ -## - - -LIBNAME = lib.a -LIB = $(ARCH)/$(LIBNAME) - -C_FILES = kern_subr.c uipc_domain.c uipc_mbuf.c uipc_socket.c uipc_socket2.c -C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) - -OBJS = $(C_O_FILES) - -include $(top_srcdir)/../automake/multilib.am -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/lib.am - -# -# Add local stuff here using += -# - -AM_CPPFLAGS += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS -DDIAGNOSTIC \ - -DBOOTP_COMPAT - -$(LIB): $(OBJS) - $(make-library) - -all-local: $(ARCH) $(OBJS) $(LIB) - -.PRECIOUS: $(LIB) - -EXTRA_DIST = kern_subr.c uipc_domain.c uipc_mbuf.c uipc_socket.c \ - uipc_socket2.c - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libnetworking/kern/kern_subr.c b/c/src/exec/libnetworking/kern/kern_subr.c deleted file mode 100644 index 71e51fc442..0000000000 --- a/c/src/exec/libnetworking/kern/kern_subr.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1991, 1993 - * 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. - * - * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 - * $Id$ - */ - -#include -#include -#include -#include -#include - -int -uiomove(cp, n, uio) - register caddr_t cp; - register int n; - register struct uio *uio; -{ - register struct iovec *iov; - u_int cnt; - int error; - -#ifdef DIAGNOSTIC - if (uio->uio_rw != UIO_READ && uio->uio_rw != UIO_WRITE) - panic("uiomove: mode"); -#endif - while (n > 0 && uio->uio_resid) { - iov = uio->uio_iov; - cnt = iov->iov_len; - if (cnt == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - continue; - } - if (cnt > n) - cnt = n; - - switch (uio->uio_segflg) { - - case UIO_USERSPACE: - case UIO_USERISPACE: - if (uio->uio_rw == UIO_READ) - error = copyout(cp, iov->iov_base, cnt); - else - error = copyin(iov->iov_base, cp, cnt); - if (error) - return (error); - break; - - case UIO_SYSSPACE: - if (uio->uio_rw == UIO_READ) - bcopy((caddr_t)cp, iov->iov_base, cnt); - else - bcopy(iov->iov_base, (caddr_t)cp, cnt); - break; - case UIO_NOCOPY: - break; - } - iov->iov_base += cnt; - iov->iov_len -= cnt; - uio->uio_resid -= cnt; - uio->uio_offset += cnt; - cp += cnt; - n -= cnt; - } - return (0); -} - -#ifdef vax /* unused except by ct.c, other oddities XXX */ -/* - * Get next character written in by user from uio. - */ -int -uwritec(uio) - struct uio *uio; -{ - register struct iovec *iov; - register int c; - - if (uio->uio_resid <= 0) - return (-1); -again: - if (uio->uio_iovcnt <= 0) - panic("uwritec"); - iov = uio->uio_iov; - if (iov->iov_len == 0) { - uio->uio_iov++; - if (--uio->uio_iovcnt == 0) - return (-1); - goto again; - } - switch (uio->uio_segflg) { - - case UIO_USERSPACE: - c = fubyte(iov->iov_base); - break; - - case UIO_SYSSPACE: - c = *(u_char *) iov->iov_base; - break; - - case UIO_USERISPACE: - c = fuibyte(iov->iov_base); - break; - } - if (c < 0) - return (-1); - iov->iov_base++; - iov->iov_len--; - uio->uio_resid--; - uio->uio_offset++; - return (c); -} -#endif /* vax */ - -/* - * General routine to allocate a hash table. - */ -void * -hashinit(elements, type, hashmask) - int elements, type; - u_long *hashmask; -{ - long hashsize; - LIST_HEAD(generic, generic) *hashtbl; - int i; - - if (elements <= 0) - panic("hashinit: bad elements"); - for (hashsize = 1; hashsize <= elements; hashsize <<= 1) - continue; - hashsize >>= 1; - hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); - for (i = 0; i < hashsize; i++) - LIST_INIT(&hashtbl[i]); - *hashmask = hashsize - 1; - return (hashtbl); -} - -#define NPRIMES 27 -static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039, - 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653, - 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; - -/* - * General routine to allocate a prime number sized hash table. - */ -void * -phashinit(elements, type, nentries) - int elements, type; - u_long *nentries; -{ - long hashsize; - LIST_HEAD(generic, generic) *hashtbl; - int i; - - if (elements <= 0) - panic("phashinit: bad elements"); - for (i = 1, hashsize = primes[1]; hashsize <= elements;) { - i++; - if (i == NPRIMES) - break; - hashsize = primes[i]; - } - hashsize = primes[i - 1]; - hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); - for (i = 0; i < hashsize; i++) - LIST_INIT(&hashtbl[i]); - *nentries = hashsize; - return (hashtbl); -} diff --git a/c/src/exec/libnetworking/kern/uipc_domain.c b/c/src/exec/libnetworking/kern/uipc_domain.c deleted file mode 100644 index 81d741fe37..0000000000 --- a/c/src/exec/libnetworking/kern/uipc_domain.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * 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. - * - * @(#)uipc_domain.c 8.2 (Berkeley) 10/18/93 - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include - -/* - * System initialization - * - * Note: domain initialization wants to take place on a per domain basis - * as a result of traversing a linker set. Most likely, each domain - * want to call a registration function rather than being handled here - * in domaininit(). Probably this will look like: - * - * SYSINIT(unique, SI_SUB_PROTO_DOMAI, SI_ORDER_ANY, domain_add, xxx) - * - * Where 'xxx' is replaced by the address of a parameter struct to be - * passed to the doamin_add() function. - */ - -#if !defined(__rtems__) -static int x_save_spl; /* used by kludge*/ -static void kludge_splimp __P((void *)); -static void kludge_splx __P((void *)); - void domaininit __P((void *)); -SYSINIT(splimp, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, kludge_splimp, &x_save_spl) -SYSINIT(domain, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, domaininit, NULL) -SYSINIT(splx, SI_SUB_PROTO_END, SI_ORDER_FIRST, kludge_splx, &x_save_spl) -#endif - -static void pffasttimo __P((void *)); -static void pfslowtimo __P((void *)); - -struct domain *domains; - -#define ADDDOMAIN(x) { \ - __CONCAT(x,domain.dom_next) = domains; \ - domains = &__CONCAT(x,domain); \ -} - -extern struct linker_set domain_set; - -/* ARGSUSED*/ -void -domaininit(dummy) - void *dummy; -{ - register struct domain *dp; - register struct protosw *pr; - -/* - not in our sources -#ifdef ISDN - ADDDOMAIN(isdn); -#endif -*/ - - for (dp = domains; dp; dp = dp->dom_next) { - if (dp->dom_init) - (*dp->dom_init)(); - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++){ -#ifdef PRU_OLDSTYLE - /* See comments in uipc_socket2.c. */ - if (pr->pr_usrreqs == 0 && pr->pr_ousrreq) - pr->pr_usrreqs = &pru_oldstyle; -#endif - if (pr->pr_init) - (*pr->pr_init)(); - } - } - - if (max_linkhdr < 16) /* XXX */ - max_linkhdr = 16; - max_hdr = max_linkhdr + max_protohdr; - max_datalen = MHLEN - max_hdr; - timeout(pffasttimo, (void *)0, 1); - timeout(pfslowtimo, (void *)0, 1); -} - - -#if !defined(__rtems__) -/* - * The following two operations are kludge code. Most likely, they should - * be done as a "domainpreinit()" for the first function and then rolled - * in as the last act of "domaininit()" for the second. - * - * In point of fact, it is questionable why other initialization prior - * to this does not also take place at splimp by default. - */ -static void -kludge_splimp(udata) - void *udata; -{ - int *savesplp = udata; - - *savesplp = splimp(); -} - -static void -kludge_splx(udata) - void *udata; -{ - int *savesplp = udata; - - splx( *savesplp); -} -#endif /* !defined(__rtems__) */ - -struct protosw * -pffindtype(int family, int type) -{ - register struct domain *dp; - register struct protosw *pr; - - for (dp = domains; dp; dp = dp->dom_next) - if (dp->dom_family == family) - goto found; - return (0); -found: - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_type && pr->pr_type == type) - return (pr); - return (0); -} - -struct protosw * -pffindproto(int family, int protocol, int type) -{ - register struct domain *dp; - register struct protosw *pr; - struct protosw *maybe = 0; - - if (family == 0) - return (0); - for (dp = domains; dp; dp = dp->dom_next) - if (dp->dom_family == family) - goto found; - return (0); -found: - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { - if ((pr->pr_protocol == protocol) && (pr->pr_type == type)) - return (pr); - - if (type == SOCK_RAW && pr->pr_type == SOCK_RAW && - pr->pr_protocol == 0 && maybe == (struct protosw *)0) - maybe = pr; - } - return (maybe); -} - -void -pfctlinput(cmd, sa) - int cmd; - struct sockaddr *sa; -{ - register struct domain *dp; - register struct protosw *pr; - - for (dp = domains; dp; dp = dp->dom_next) - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_ctlinput) - (*pr->pr_ctlinput)(cmd, sa, (void *)0); -} - -static void -pfslowtimo(arg) - void *arg; -{ - register struct domain *dp; - register struct protosw *pr; - - for (dp = domains; dp; dp = dp->dom_next) - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_slowtimo) - (*pr->pr_slowtimo)(); - timeout(pfslowtimo, (void *)0, hz/2); -} - -static void -pffasttimo(arg) - void *arg; -{ - register struct domain *dp; - register struct protosw *pr; - - for (dp = domains; dp; dp = dp->dom_next) - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_fasttimo) - (*pr->pr_fasttimo)(); - timeout(pffasttimo, (void *)0, hz/5); -} diff --git a/c/src/exec/libnetworking/kern/uipc_mbuf.c b/c/src/exec/libnetworking/kern/uipc_mbuf.c deleted file mode 100644 index 17d2be6b26..0000000000 --- a/c/src/exec/libnetworking/kern/uipc_mbuf.c +++ /dev/null @@ -1,748 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1991, 1993 - * 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. - * - * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 - * $Id$ - */ - -#include -#include -#include -#include -#define MBTYPES -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -static void mbinit __P((void *)) __attribute__ ((unused)); -SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbinit, NULL) - -struct mbuf *mbutl; -char *mclrefcnt; -struct mbstat mbstat; -struct mbuf *mmbfree; -union mcluster *mclfree; -int max_linkhdr; -int max_protohdr; -int max_hdr; -int max_datalen; - -/* "number of clusters of pages" */ -#define NCL_INIT 1 - -#define NMB_INIT 16 - -/* - * When MGET failes, ask protocols to free space when short of memory, - * then re-attempt to allocate an mbuf. - */ -struct mbuf * -m_retry(i, t) - int i, t; -{ - register struct mbuf *m; - - m_reclaim(); -#define m_retry(i, t) (struct mbuf *)0 - MGET(m, i, t); -#undef m_retry - if (m != NULL) - mbstat.m_wait++; - else - mbstat.m_drops++; - return (m); -} - -/* - * As above; retry an MGETHDR. - */ -struct mbuf * -m_retryhdr(i, t) - int i, t; -{ - register struct mbuf *m; - - m_reclaim(); -#define m_retryhdr(i, t) (struct mbuf *)0 - MGETHDR(m, i, t); -#undef m_retryhdr - if (m != NULL) - mbstat.m_wait++; - else - mbstat.m_drops++; - return (m); -} - -void -m_reclaim(void) -{ - register struct domain *dp; - register struct protosw *pr; - int s = splimp(); - - for (dp = domains; dp; dp = dp->dom_next) - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_drain) - (*pr->pr_drain)(); - splx(s); - mbstat.m_drain++; -} - -/* - * Space allocation routines. - * These are also available as macros - * for critical paths. - */ -struct mbuf * -m_get(nowait, type) - int nowait, type; -{ - register struct mbuf *m; - - MGET(m, nowait, type); - return (m); -} - -struct mbuf * -m_gethdr(nowait, type) - int nowait, type; -{ - register struct mbuf *m; - - MGETHDR(m, nowait, type); - return (m); -} - -struct mbuf * -m_getclr(nowait, type) - int nowait, type; -{ - register struct mbuf *m; - - MGET(m, nowait, type); - if (m == 0) - return (0); - bzero(mtod(m, caddr_t), MLEN); - return (m); -} - -struct mbuf * -m_free(m) - struct mbuf *m; -{ - register struct mbuf *n; - - MFREE(m, n); - return (n); -} - -void -m_freem(m) - register struct mbuf *m; -{ - register struct mbuf *n; - - if (m == NULL) - return; - do { - MFREE(m, n); - m = n; - } while (m); -} - -/* - * Mbuffer utility routines. - */ - -/* - * Lesser-used path for M_PREPEND: - * allocate new mbuf to prepend to chain, - * copy junk along. - */ -struct mbuf * -m_prepend(m, len, how) - register struct mbuf *m; - int len, how; -{ - struct mbuf *mn; - - MGET(mn, how, m->m_type); - if (mn == (struct mbuf *)NULL) { - m_freem(m); - return ((struct mbuf *)NULL); - } - if (m->m_flags & M_PKTHDR) { - M_COPY_PKTHDR(mn, m); - m->m_flags &= ~M_PKTHDR; - } - mn->m_next = m; - m = mn; - if (len < MHLEN) - MH_ALIGN(m, len); - m->m_len = len; - return (m); -} - -/* - * Make a copy of an mbuf chain starting "off0" bytes from the beginning, - * continuing for "len" bytes. If len is M_COPYALL, copy to end of mbuf. - * The wait parameter is a choice of M_WAIT/M_DONTWAIT from caller. - */ -static int MCFail; - -struct mbuf * -m_copym(m, off0, len, wait) - register struct mbuf *m; - int off0, wait; - register int len; -{ - register struct mbuf *n, **np; - register int off = off0; - struct mbuf *top; - int copyhdr = 0; - - if (off < 0 || len < 0) - panic("m_copym"); - if (off == 0 && m->m_flags & M_PKTHDR) - copyhdr = 1; - while (off > 0) { - if (m == 0) - panic("m_copym"); - if (off < m->m_len) - break; - off -= m->m_len; - m = m->m_next; - } - np = ⊤ - top = 0; - while (len > 0) { - if (m == 0) { - if (len != M_COPYALL) - panic("m_copym"); - break; - } - MGET(n, wait, m->m_type); - *np = n; - if (n == 0) - goto nospace; - if (copyhdr) { - M_COPY_PKTHDR(n, m); - if (len == M_COPYALL) - n->m_pkthdr.len -= off0; - else - n->m_pkthdr.len = len; - copyhdr = 0; - } - n->m_len = min(len, m->m_len - off); - if (m->m_flags & M_EXT) { - n->m_data = m->m_data + off; - if(!m->m_ext.ext_ref) - mclrefcnt[mtocl(m->m_ext.ext_buf)]++; - else - (*(m->m_ext.ext_ref))(m->m_ext.ext_buf, - m->m_ext.ext_size); - n->m_ext = m->m_ext; - n->m_flags |= M_EXT; - } else - bcopy(mtod(m, caddr_t)+off, mtod(n, caddr_t), - (unsigned)n->m_len); - if (len != M_COPYALL) - len -= n->m_len; - off = 0; - m = m->m_next; - np = &n->m_next; - } - if (top == 0) - MCFail++; - return (top); -nospace: - m_freem(top); - MCFail++; - return (0); -} - -/* - * Copy an entire packet, including header (which must be present). - * An optimization of the common case `m_copym(m, 0, M_COPYALL, how)'. - */ -struct mbuf * -m_copypacket(m, how) - struct mbuf *m; - int how; -{ - struct mbuf *top, *n, *o; - - MGET(n, how, m->m_type); - top = n; - if (!n) - goto nospace; - - M_COPY_PKTHDR(n, m); - n->m_len = m->m_len; - if (m->m_flags & M_EXT) { - n->m_data = m->m_data; - mclrefcnt[mtocl(m->m_ext.ext_buf)]++; - n->m_ext = m->m_ext; - n->m_flags |= M_EXT; - } else { - bcopy(mtod(m, char *), mtod(n, char *), n->m_len); - } - - m = m->m_next; - while (m) { - MGET(o, how, m->m_type); - if (!o) - goto nospace; - - n->m_next = o; - n = n->m_next; - - n->m_len = m->m_len; - if (m->m_flags & M_EXT) { - n->m_data = m->m_data; - mclrefcnt[mtocl(m->m_ext.ext_buf)]++; - n->m_ext = m->m_ext; - n->m_flags |= M_EXT; - } else { - bcopy(mtod(m, char *), mtod(n, char *), n->m_len); - } - - m = m->m_next; - } - return top; -nospace: - m_freem(top); - MCFail++; - return 0; -} - -/* - * Copy data from an mbuf chain starting "off" bytes from the beginning, - * continuing for "len" bytes, into the indicated buffer. - */ -void -m_copydata(m, off, len, cp) - register struct mbuf *m; - register int off; - register int len; - caddr_t cp; -{ - register unsigned count; - - if (off < 0 || len < 0) - panic("m_copydata"); - while (off > 0) { - if (m == 0) - panic("m_copydata"); - if (off < m->m_len) - break; - off -= m->m_len; - m = m->m_next; - } - while (len > 0) { - if (m == 0) - panic("m_copydata"); - count = min(m->m_len - off, len); - bcopy(mtod(m, caddr_t) + off, cp, count); - len -= count; - cp += count; - off = 0; - m = m->m_next; - } -} - -/* - * Concatenate mbuf chain n to m. - * Both chains must be of the same type (e.g. MT_DATA). - * Any m_pkthdr is not updated. - */ -void -m_cat(m, n) - register struct mbuf *m, *n; -{ - while (m->m_next) - m = m->m_next; - while (n) { - if (m->m_flags & M_EXT || - m->m_data + m->m_len + n->m_len >= &m->m_dat[MLEN]) { - /* just join the two chains */ - m->m_next = n; - return; - } - /* splat the data from one into the other */ - bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len, - (u_int)n->m_len); - m->m_len += n->m_len; - n = m_free(n); - } -} - -void -m_adj(mp, req_len) - struct mbuf *mp; - int req_len; -{ - register int len = req_len; - register struct mbuf *m; - register int count; - - if ((m = mp) == NULL) - return; - if (len >= 0) { - /* - * Trim from head. - */ - while (m != NULL && len > 0) { - if (m->m_len <= len) { - len -= m->m_len; - m->m_len = 0; - m = m->m_next; - } else { - m->m_len -= len; - m->m_data += len; - len = 0; - } - } - m = mp; - if (mp->m_flags & M_PKTHDR) - m->m_pkthdr.len -= (req_len - len); - } else { - /* - * Trim from tail. Scan the mbuf chain, - * calculating its length and finding the last mbuf. - * If the adjustment only affects this mbuf, then just - * adjust and return. Otherwise, rescan and truncate - * after the remaining size. - */ - len = -len; - count = 0; - for (;;) { - count += m->m_len; - if (m->m_next == (struct mbuf *)0) - break; - m = m->m_next; - } - if (m->m_len >= len) { - m->m_len -= len; - if (mp->m_flags & M_PKTHDR) - mp->m_pkthdr.len -= len; - return; - } - count -= len; - if (count < 0) - count = 0; - /* - * Correct length for chain is "count". - * Find the mbuf with last data, adjust its length, - * and toss data from remaining mbufs on chain. - */ - m = mp; - if (m->m_flags & M_PKTHDR) - m->m_pkthdr.len = count; - for (; m; m = m->m_next) { - if (m->m_len >= count) { - m->m_len = count; - break; - } - count -= m->m_len; - } - while (m->m_next) - (m = m->m_next) ->m_len = 0; - } -} - -/* - * Rearange an mbuf chain so that len bytes are contiguous - * and in the data area of an mbuf (so that mtod and dtom - * will work for a structure of size len). Returns the resulting - * mbuf chain on success, frees it and returns null on failure. - * If there is room, it will add up to max_protohdr-len extra bytes to the - * contiguous region in an attempt to avoid being called next time. - */ -static int MPFail; - -struct mbuf * -m_pullup(n, len) - register struct mbuf *n; - int len; -{ - register struct mbuf *m; - register int count; - int space; - - /* - * If first mbuf has no cluster, and has room for len bytes - * without shifting current data, pullup into it, - * otherwise allocate a new mbuf to prepend to the chain. - */ - if ((n->m_flags & M_EXT) == 0 && - n->m_data + len < &n->m_dat[MLEN] && n->m_next) { - if (n->m_len >= len) - return (n); - m = n; - n = n->m_next; - len -= m->m_len; - } else { - if (len > MHLEN) - goto bad; - MGET(m, M_DONTWAIT, n->m_type); - if (m == 0) - goto bad; - m->m_len = 0; - if (n->m_flags & M_PKTHDR) { - M_COPY_PKTHDR(m, n); - n->m_flags &= ~M_PKTHDR; - } - } - space = &m->m_dat[MLEN] - (m->m_data + m->m_len); - do { - count = min(min(max(len, max_protohdr), space), n->m_len); - bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len, - (unsigned)count); - len -= count; - m->m_len += count; - n->m_len -= count; - space -= count; - if (n->m_len) - n->m_data += count; - else - n = m_free(n); - } while (len > 0 && n); - if (len > 0) { - (void) m_free(m); - goto bad; - } - m->m_next = n; - return (m); -bad: - m_freem(n); - MPFail++; - return (0); -} - -/* - * Partition an mbuf chain in two pieces, returning the tail -- - * all but the first len0 bytes. In case of failure, it returns NULL and - * attempts to restore the chain to its original state. - */ -struct mbuf * -m_split(m0, len0, wait) - register struct mbuf *m0; - int len0, wait; -{ - register struct mbuf *m, *n; - unsigned len = len0, remain; - - for (m = m0; m && len > m->m_len; m = m->m_next) - len -= m->m_len; - if (m == 0) - return (0); - remain = m->m_len - len; - if (m0->m_flags & M_PKTHDR) { - MGETHDR(n, wait, m0->m_type); - if (n == 0) - return (0); - n->m_pkthdr.rcvif = m0->m_pkthdr.rcvif; - n->m_pkthdr.len = m0->m_pkthdr.len - len0; - m0->m_pkthdr.len = len0; - if (m->m_flags & M_EXT) - goto extpacket; - if (remain > MHLEN) { - /* m can't be the lead packet */ - MH_ALIGN(n, 0); - n->m_next = m_split(m, len, wait); - if (n->m_next == 0) { - (void) m_free(n); - return (0); - } else - return (n); - } else - MH_ALIGN(n, remain); - } else if (remain == 0) { - n = m->m_next; - m->m_next = 0; - return (n); - } else { - MGET(n, wait, m->m_type); - if (n == 0) - return (0); - M_ALIGN(n, remain); - } -extpacket: - if (m->m_flags & M_EXT) { - n->m_flags |= M_EXT; - n->m_ext = m->m_ext; - if(!m->m_ext.ext_ref) - mclrefcnt[mtocl(m->m_ext.ext_buf)]++; - else - (*(m->m_ext.ext_ref))(m->m_ext.ext_buf, - m->m_ext.ext_size); - m->m_ext.ext_size = 0; /* For Accounting XXXXXX danger */ - n->m_data = m->m_data + len; - } else { - bcopy(mtod(m, caddr_t) + len, mtod(n, caddr_t), remain); - } - n->m_len = remain; - m->m_len = len; - n->m_next = m->m_next; - m->m_next = 0; - return (n); -} -/* - * Routine to copy from device local memory into mbufs. - */ -struct mbuf * -m_devget(buf, totlen, off0, ifp, copy) - char *buf; - int totlen, off0; - struct ifnet *ifp; - void (*copy) __P((char *from, caddr_t to, u_int len)); -{ - register struct mbuf *m; - struct mbuf *top = 0, **mp = ⊤ - register int off = off0, len; - register char *cp; - char *epkt; - - cp = buf; - epkt = cp + totlen; - if (off) { - cp += off + 2 * sizeof(u_short); - totlen -= 2 * sizeof(u_short); - } - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) - return (0); - m->m_pkthdr.rcvif = ifp; - m->m_pkthdr.len = totlen; - m->m_len = MHLEN; - - while (totlen > 0) { - if (top) { - MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { - m_freem(top); - return (0); - } - m->m_len = MLEN; - } - len = min(totlen, epkt - cp); - if (len >= MINCLSIZE) { - MCLGET(m, M_DONTWAIT); - if (m->m_flags & M_EXT) - m->m_len = len = min(len, MCLBYTES); - else - len = m->m_len; - } else { - /* - * Place initial small packet/header at end of mbuf. - */ - if (len < m->m_len) { - if (top == 0 && len + max_linkhdr <= m->m_len) - m->m_data += max_linkhdr; - m->m_len = len; - } else - len = m->m_len; - } - if (copy) - copy(cp, mtod(m, caddr_t), (unsigned)len); - else - bcopy(cp, mtod(m, caddr_t), (unsigned)len); - cp += len; - *mp = m; - mp = &m->m_next; - totlen -= len; - if (cp == epkt) - cp = buf; - } - return (top); -} - -/* - * Copy data from a buffer back into the indicated mbuf chain, - * starting "off" bytes from the beginning, extending the mbuf - * chain if necessary. - */ -void -m_copyback(m0, off, len, cp) - struct mbuf *m0; - register int off; - register int len; - caddr_t cp; -{ - register int mlen; - register struct mbuf *m = m0, *n; - int totlen = 0; - - if (m0 == 0) - return; - while (off > (mlen = m->m_len)) { - off -= mlen; - totlen += mlen; - if (m->m_next == 0) { - n = m_getclr(M_DONTWAIT, m->m_type); - if (n == 0) - goto out; - n->m_len = min(MLEN, len + off); - m->m_next = n; - } - m = m->m_next; - } - while (len > 0) { - mlen = min (m->m_len - off, len); - bcopy(cp, off + mtod(m, caddr_t), (unsigned)mlen); - cp += mlen; - len -= mlen; - mlen += off; - off = 0; - totlen += mlen; - if (len == 0) - break; - if (m->m_next == 0) { - n = m_get(M_DONTWAIT, m->m_type); - if (n == 0) - break; - n->m_len = min(MLEN, len); - m->m_next = n; - } - m = m->m_next; - } -out: if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen)) - m->m_pkthdr.len = totlen; -} diff --git a/c/src/exec/libnetworking/kern/uipc_socket.c b/c/src/exec/libnetworking/kern/uipc_socket.c deleted file mode 100644 index 49a5a65653..0000000000 --- a/c/src/exec/libnetworking/kern/uipc_socket.c +++ /dev/null @@ -1,1143 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1990, 1993 - * 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. - * - * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int somaxconn = SOMAXCONN; -SYSCTL_INT(_kern, KERN_SOMAXCONN, somaxconn, CTLFLAG_RW, &somaxconn, 0, ""); - -/* - * Socket operation routines. - * These routines are called by the routines in - * sys_socket.c or from a system process, and - * implement the semantics of socket operations by - * switching out to the protocol specific routines. - */ -/*ARGSUSED*/ -int -socreate(dom, aso, type, proto, p) - int dom; - struct socket **aso; - register int type; - int proto; - struct proc *p; -{ - register struct protosw *prp; - register struct socket *so; - register int error; - - if (proto) - prp = pffindproto(dom, proto, type); - else - prp = pffindtype(dom, type); - if (prp == 0 || prp->pr_usrreqs == 0) - return (EPROTONOSUPPORT); - if (prp->pr_type != type) - return (EPROTOTYPE); - MALLOC(so, struct socket *, sizeof(*so), M_SOCKET, M_WAIT); - bzero((caddr_t)so, sizeof(*so)); - TAILQ_INIT(&so->so_incomp); - TAILQ_INIT(&so->so_comp); - so->so_type = type; - so->so_state = SS_PRIV; - so->so_uid = 0; - so->so_proto = prp; - error = (*prp->pr_usrreqs->pru_attach)(so, proto); - if (error) { - so->so_state |= SS_NOFDREF; - sofree(so); - return (error); - } - *aso = so; - return (0); -} - -int -sobind(so, nam) - struct socket *so; - struct mbuf *nam; -{ - int s = splnet(); - int error; - - error = (*so->so_proto->pr_usrreqs->pru_bind)(so, nam); - splx(s); - return (error); -} - -int -solisten(so, backlog) - register struct socket *so; - int backlog; -{ - int s = splnet(), error; - - error = (*so->so_proto->pr_usrreqs->pru_listen)(so); - if (error) { - splx(s); - return (error); - } - if (so->so_comp.tqh_first == NULL) - so->so_options |= SO_ACCEPTCONN; - if (backlog < 0 || backlog > somaxconn) - backlog = somaxconn; - so->so_qlimit = backlog; - splx(s); - return (0); -} - -void -sofree(so) - register struct socket *so; -{ - struct socket *head = so->so_head; - - if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0) - return; - if (head != NULL) { - if (so->so_state & SS_INCOMP) { - TAILQ_REMOVE(&head->so_incomp, so, so_list); - head->so_incqlen--; - } else if (so->so_state & SS_COMP) { - TAILQ_REMOVE(&head->so_comp, so, so_list); - } else { - panic("sofree: not queued"); - } - head->so_qlen--; - so->so_state &= ~(SS_INCOMP|SS_COMP); - so->so_head = NULL; - } - sbrelease(&so->so_snd); - sorflush(so); - FREE(so, M_SOCKET); -} - -/* - * Close a socket on last file table reference removal. - * Initiate disconnect if connected. - * Free socket when disconnect complete. - */ -int -soclose(so) - register struct socket *so; -{ - int s = splnet(); /* conservative */ - int error = 0; - - if (so->so_options & SO_ACCEPTCONN) { - struct socket *sp, *sonext; - - for (sp = so->so_incomp.tqh_first; sp != NULL; sp = sonext) { - sonext = sp->so_list.tqe_next; - (void) soabort(sp); - } - for (sp = so->so_comp.tqh_first; sp != NULL; sp = sonext) { - sonext = sp->so_list.tqe_next; - (void) soabort(sp); - } - } - if (so->so_pcb == 0) - goto discard; - if (so->so_state & SS_ISCONNECTED) { - if ((so->so_state & SS_ISDISCONNECTING) == 0) { - error = sodisconnect(so); - if (error) - goto drop; - } - if (so->so_options & SO_LINGER) { - if ((so->so_state & SS_ISDISCONNECTING) && - (so->so_state & SS_NBIO)) - goto drop; - while (so->so_state & SS_ISCONNECTED) { - soconnsleep (so); - } - } - } -drop: - if (so->so_pcb) { - int error2 = (*so->so_proto->pr_usrreqs->pru_detach)(so); - if (error == 0) - error = error2; - } -discard: - if (so->so_state & SS_NOFDREF) - panic("soclose: NOFDREF"); - so->so_state |= SS_NOFDREF; - sofree(so); - splx(s); - return (error); -} - -/* - * Must be called at splnet... - */ -int -soabort(so) - struct socket *so; -{ - - return (*so->so_proto->pr_usrreqs->pru_abort)(so); -} - -int -soaccept(so, nam) - register struct socket *so; - struct mbuf *nam; -{ - int s = splnet(); - int error; - - if ((so->so_state & SS_NOFDREF) == 0) - panic("soaccept: !NOFDREF"); - so->so_state &= ~SS_NOFDREF; - error = (*so->so_proto->pr_usrreqs->pru_accept)(so, nam); - splx(s); - return (error); -} - -int -soconnect(so, nam) - register struct socket *so; - struct mbuf *nam; -{ - int s; - int error; - - if (so->so_options & SO_ACCEPTCONN) - return (EOPNOTSUPP); - s = splnet(); - /* - * If protocol is connection-based, can only connect once. - * Otherwise, if connected, try to disconnect first. - * This allows user to disconnect by connecting to, e.g., - * a null address. - */ - if (so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING) && - ((so->so_proto->pr_flags & PR_CONNREQUIRED) || - (error = sodisconnect(so)))) - error = EISCONN; - else - error = (*so->so_proto->pr_usrreqs->pru_connect)(so, nam); - splx(s); - return (error); -} - -int -soconnect2(so1, so2) - register struct socket *so1; - struct socket *so2; -{ - int s = splnet(); - int error; - - error = (*so1->so_proto->pr_usrreqs->pru_connect2)(so1, so2); - splx(s); - return (error); -} - -int -sodisconnect(so) - register struct socket *so; -{ - int s = splnet(); - int error; - - if ((so->so_state & SS_ISCONNECTED) == 0) { - error = ENOTCONN; - goto bad; - } - if (so->so_state & SS_ISDISCONNECTING) { - error = EALREADY; - goto bad; - } - error = (*so->so_proto->pr_usrreqs->pru_disconnect)(so); -bad: - splx(s); - return (error); -} - -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : M_WAITOK) -/* - * Send on a socket. - * If send must go all at once and message is larger than - * send buffering, then hard error. - * Lock against other senders. - * If must go all at once and not enough room now, then - * inform user that this would block and do nothing. - * Otherwise, if nonblocking, send as much as possible. - * The data to be sent is described by "uio" if nonzero, - * otherwise by the mbuf chain "top" (which must be null - * if uio is not). Data provided in mbuf chain must be small - * enough to send all at once. - * - * Returns nonzero on error, timeout or signal; callers - * must check for short counts if EINTR/ERESTART are returned. - * Data and control buffers are freed on return. - */ -int -sosend(so, addr, uio, top, control, flags) - register struct socket *so; - struct mbuf *addr; - struct uio *uio; - struct mbuf *top; - struct mbuf *control; - int flags; -{ - struct mbuf **mp; - register struct mbuf *m; - register long space, len, resid; - int clen = 0, error, s, dontroute, mlen; - int atomic = sosendallatonce(so) || top; - - if (uio) - resid = uio->uio_resid; - else - resid = top->m_pkthdr.len; - /* - * In theory resid should be unsigned. - * However, space must be signed, as it might be less than 0 - * if we over-committed, and we must use a signed comparison - * of space and resid. On the other hand, a negative resid - * causes us to loop sending 0-length segments to the protocol. - * - * Also check to make sure that MSG_EOR isn't used on SOCK_STREAM - * type sockets since that's an error. - */ - if ((resid < 0) || (so->so_type == SOCK_STREAM && (flags & MSG_EOR))) { - error = EINVAL; - goto out; - } - - dontroute = - (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 && - (so->so_proto->pr_flags & PR_ATOMIC); - if (control) - clen = control->m_len; -#define snderr(errno) { error = errno; splx(s); goto release; } - -restart: - error = sblock(&so->so_snd, SBLOCKWAIT(flags)); - if (error) - goto out; - do { - s = splnet(); - if (so->so_state & SS_CANTSENDMORE) - snderr(EPIPE); - if (so->so_error) { - error = so->so_error; - so->so_error = 0; - splx(s); - goto release; - } - if ((so->so_state & SS_ISCONNECTED) == 0) { - /* - * `sendto' and `sendmsg' is allowed on a connection- - * based socket if it supports implied connect. - * Return ENOTCONN if not connected and no address is - * supplied. - */ - if ((so->so_proto->pr_flags & PR_CONNREQUIRED) && - (so->so_proto->pr_flags & PR_IMPLOPCL) == 0) { - if ((so->so_state & SS_ISCONFIRMING) == 0 && - !(resid == 0 && clen != 0)) - snderr(ENOTCONN); - } else if (addr == 0) - snderr(so->so_proto->pr_flags & PR_CONNREQUIRED ? - ENOTCONN : EDESTADDRREQ); - } - space = sbspace(&so->so_snd); - if (flags & MSG_OOB) - space += 1024; - if ((atomic && resid > so->so_snd.sb_hiwat) || - clen > so->so_snd.sb_hiwat) - snderr(EMSGSIZE); - if (space < resid + clen && uio && - (atomic || space < so->so_snd.sb_lowat || space < clen)) { - if (so->so_state & SS_NBIO) - snderr(EWOULDBLOCK); - sbunlock(&so->so_snd); - error = sbwait(&so->so_snd); - splx(s); - if (error) - goto out; - goto restart; - } - splx(s); - mp = ⊤ - space -= clen; - do { - if (uio == NULL) { - /* - * Data is prepackaged in "top". - */ - resid = 0; - if (flags & MSG_EOR) - top->m_flags |= M_EOR; - } else do { - if (top == 0) { - MGETHDR(m, M_WAIT, MT_DATA); - mlen = MHLEN; - m->m_pkthdr.len = 0; - m->m_pkthdr.rcvif = (struct ifnet *)0; - } else { - MGET(m, M_WAIT, MT_DATA); - mlen = MLEN; - } - if (resid >= MINCLSIZE) { - MCLGET(m, M_WAIT); - if ((m->m_flags & M_EXT) == 0) - goto nopages; - mlen = MCLBYTES; - len = min(min(mlen, resid), space); - } else { -nopages: - len = min(min(mlen, resid), space); - /* - * For datagram protocols, leave room - * for protocol headers in first mbuf. - */ - if (atomic && top == 0 && len < mlen) - MH_ALIGN(m, len); - } - space -= len; - error = uiomove(mtod(m, caddr_t), (int)len, uio); - resid = uio->uio_resid; - m->m_len = len; - *mp = m; - top->m_pkthdr.len += len; - if (error) - goto release; - mp = &m->m_next; - if (resid <= 0) { - if (flags & MSG_EOR) - top->m_flags |= M_EOR; - break; - } - } while (space > 0 && atomic); - if (dontroute) - so->so_options |= SO_DONTROUTE; - s = splnet(); /* XXX */ - error = (*so->so_proto->pr_usrreqs->pru_send)(so, - (flags & MSG_OOB) ? PRUS_OOB : - /* - * If the user set MSG_EOF, the protocol - * understands this flag and nothing left to - * send then use PRU_SEND_EOF instead of PRU_SEND. - */ - ((flags & MSG_EOF) && - (so->so_proto->pr_flags & PR_IMPLOPCL) && - (resid <= 0)) ? - PRUS_EOF : 0, - top, addr, control); - splx(s); - if (dontroute) - so->so_options &= ~SO_DONTROUTE; - clen = 0; - control = 0; - top = 0; - mp = ⊤ - if (error) - goto release; - } while (resid && space > 0); - } while (resid); - -release: - sbunlock(&so->so_snd); -out: - if (top) - m_freem(top); - if (control) - m_freem(control); - return (error); -} - -/* - * Implement receive operations on a socket. - * We depend on the way that records are added to the sockbuf - * by sbappend*. In particular, each record (mbufs linked through m_next) - * must begin with an address if the protocol so specifies, - * followed by an optional mbuf or mbufs containing ancillary data, - * and then zero or more mbufs of data. - * In order to avoid blocking network interrupts for the entire time here, - * we splx() while doing the actual copy to user space. - * Although the sockbuf is locked, new data may still be appended, - * and thus we must maintain consistency of the sockbuf during that time. - * - * The caller may receive the data as a single mbuf chain by supplying - * an mbuf **mp0 for use in returning the chain. The uio is then used - * only for the count in uio_resid. - */ -int -soreceive(so, paddr, uio, mp0, controlp, flagsp) - register struct socket *so; - struct mbuf **paddr; - struct uio *uio; - struct mbuf **mp0; - struct mbuf **controlp; - int *flagsp; -{ - register struct mbuf *m, **mp; - register int flags, len, error, s, offset; - struct protosw *pr = so->so_proto; - struct mbuf *nextrecord; - int moff, type = 0; - int orig_resid = uio->uio_resid; - - mp = mp0; - if (paddr) - *paddr = 0; - if (controlp) - *controlp = 0; - if (flagsp) - flags = *flagsp &~ MSG_EOR; - else - flags = 0; - if (flags & MSG_OOB) { - m = m_get(M_WAIT, MT_DATA); - error = (*pr->pr_usrreqs->pru_rcvoob)(so, m, flags & MSG_PEEK); - if (error) - goto bad; - do { - error = uiomove(mtod(m, caddr_t), - (int) min(uio->uio_resid, m->m_len), uio); - m = m_free(m); - } while (uio->uio_resid && error == 0 && m); -bad: - if (m) - m_freem(m); - return (error); - } - if (mp) - *mp = (struct mbuf *)0; - if (so->so_state & SS_ISCONFIRMING && uio->uio_resid) - (*pr->pr_usrreqs->pru_rcvd)(so, 0); - -restart: - error = sblock(&so->so_rcv, SBLOCKWAIT(flags)); - if (error) - return (error); - s = splnet(); - - m = so->so_rcv.sb_mb; - /* - * If we have less data than requested, block awaiting more - * (subject to any timeout) if: - * 1. the current count is less than the low water mark, or - * 2. MSG_WAITALL is set, and it is possible to do the entire - * receive operation at once if we block (resid <= hiwat). - * 3. MSG_DONTWAIT is not set - * If MSG_WAITALL is set but resid is larger than the receive buffer, - * we have to do the receive in sections, and thus risk returning - * a short count if a timeout or signal occurs after we start. - */ - if (m == 0 || (((flags & MSG_DONTWAIT) == 0 && - so->so_rcv.sb_cc < uio->uio_resid) && - (so->so_rcv.sb_cc < so->so_rcv.sb_lowat || - ((flags & MSG_WAITALL) && uio->uio_resid <= so->so_rcv.sb_hiwat)) && - m->m_nextpkt == 0 && (pr->pr_flags & PR_ATOMIC) == 0)) { -#ifdef DIAGNOSTIC - if (m == 0 && so->so_rcv.sb_cc) - panic("receive 1"); -#endif - if (so->so_error) { - if (m) - goto dontblock; - error = so->so_error; - if ((flags & MSG_PEEK) == 0) - so->so_error = 0; - goto release; - } - if (so->so_state & SS_CANTRCVMORE) { - if (m) - goto dontblock; - else - goto release; - } - for (; m; m = m->m_next) - if (m->m_type == MT_OOBDATA || (m->m_flags & M_EOR)) { - m = so->so_rcv.sb_mb; - goto dontblock; - } - if ((so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING)) == 0 && - (so->so_proto->pr_flags & PR_CONNREQUIRED)) { - error = ENOTCONN; - goto release; - } - if (uio->uio_resid == 0) - goto release; - if ((so->so_state & SS_NBIO) || (flags & MSG_DONTWAIT)) { - error = EWOULDBLOCK; - goto release; - } - sbunlock(&so->so_rcv); - error = sbwait(&so->so_rcv); - splx(s); - if (error) - return (error); - goto restart; - } -dontblock: - nextrecord = m->m_nextpkt; - if (pr->pr_flags & PR_ADDR) { -#ifdef DIAGNOSTIC - if (m->m_type != MT_SONAME) - panic("receive 1a"); -#endif - orig_resid = 0; - if (flags & MSG_PEEK) { - if (paddr) - *paddr = m_copy(m, 0, m->m_len); - m = m->m_next; - } else { - sbfree(&so->so_rcv, m); - if (paddr) { - *paddr = m; - so->so_rcv.sb_mb = m->m_next; - m->m_next = 0; - m = so->so_rcv.sb_mb; - } else { - MFREE(m, so->so_rcv.sb_mb); - m = so->so_rcv.sb_mb; - } - } - } - while (m && m->m_type == MT_CONTROL && error == 0) { - if (flags & MSG_PEEK) { - if (controlp) - *controlp = m_copy(m, 0, m->m_len); - m = m->m_next; - } else { - sbfree(&so->so_rcv, m); - if (controlp) { - if (pr->pr_domain->dom_externalize && - mtod(m, struct cmsghdr *)->cmsg_type == - SCM_RIGHTS) - error = (*pr->pr_domain->dom_externalize)(m); - *controlp = m; - so->so_rcv.sb_mb = m->m_next; - m->m_next = 0; - m = so->so_rcv.sb_mb; - } else { - MFREE(m, so->so_rcv.sb_mb); - m = so->so_rcv.sb_mb; - } - } - if (controlp) { - orig_resid = 0; - controlp = &(*controlp)->m_next; - } - } - if (m) { - if ((flags & MSG_PEEK) == 0) - m->m_nextpkt = nextrecord; - type = m->m_type; - if (type == MT_OOBDATA) - flags |= MSG_OOB; - } - moff = 0; - offset = 0; - while (m && uio->uio_resid > 0 && error == 0) { - if (m->m_type == MT_OOBDATA) { - if (type != MT_OOBDATA) - break; - } else if (type == MT_OOBDATA) - break; -#ifdef DIAGNOSTIC - else if (m->m_type != MT_DATA && m->m_type != MT_HEADER) - panic("receive 3"); -#endif - so->so_state &= ~SS_RCVATMARK; - len = uio->uio_resid; - if (so->so_oobmark && len > so->so_oobmark - offset) - len = so->so_oobmark - offset; - if (len > m->m_len - moff) - len = m->m_len - moff; - /* - * If mp is set, just pass back the mbufs. - * Otherwise copy them out via the uio, then free. - * Sockbuf must be consistent here (points to current mbuf, - * it points to next record) when we drop priority; - * we must note any additions to the sockbuf when we - * block interrupts again. - */ - if (mp == 0) { - splx(s); - error = uiomove(mtod(m, caddr_t) + moff, (int)len, uio); - s = splnet(); - if (error) - goto release; - } else - uio->uio_resid -= len; - if (len == m->m_len - moff) { - if (m->m_flags & M_EOR) - flags |= MSG_EOR; - if (flags & MSG_PEEK) { - m = m->m_next; - moff = 0; - } else { - nextrecord = m->m_nextpkt; - sbfree(&so->so_rcv, m); - if (mp) { - *mp = m; - mp = &m->m_next; - so->so_rcv.sb_mb = m = m->m_next; - *mp = (struct mbuf *)0; - } else { - MFREE(m, so->so_rcv.sb_mb); - m = so->so_rcv.sb_mb; - } - if (m) - m->m_nextpkt = nextrecord; - } - } else { - if (flags & MSG_PEEK) - moff += len; - else { - if (mp) - *mp = m_copym(m, 0, len, M_WAIT); - m->m_data += len; - m->m_len -= len; - so->so_rcv.sb_cc -= len; - } - } - if (so->so_oobmark) { - if ((flags & MSG_PEEK) == 0) { - so->so_oobmark -= len; - if (so->so_oobmark == 0) { - so->so_state |= SS_RCVATMARK; - break; - } - } else { - offset += len; - if (offset == so->so_oobmark) - break; - } - } - if (flags & MSG_EOR) - break; - /* - * If the MSG_WAITALL flag is set (for non-atomic socket), - * we must not quit until "uio->uio_resid == 0" or an error - * termination. If a signal/timeout occurs, return - * with a short count but without error. - * Keep sockbuf locked against other readers. - */ - while (flags & MSG_WAITALL && m == 0 && uio->uio_resid > 0 && - !sosendallatonce(so) && !nextrecord) { - if (so->so_error || so->so_state & SS_CANTRCVMORE) - break; - error = sbwait(&so->so_rcv); - if (error) { - sbunlock(&so->so_rcv); - splx(s); - return (0); - } - m = so->so_rcv.sb_mb; - if (m) - nextrecord = m->m_nextpkt; - } - } - - if (m && pr->pr_flags & PR_ATOMIC) { - flags |= MSG_TRUNC; - if ((flags & MSG_PEEK) == 0) - (void) sbdroprecord(&so->so_rcv); - } - if ((flags & MSG_PEEK) == 0) { - if (m == 0) - so->so_rcv.sb_mb = nextrecord; - if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) - (*pr->pr_usrreqs->pru_rcvd)(so, flags); - } - if (orig_resid == uio->uio_resid && orig_resid && - (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { - sbunlock(&so->so_rcv); - splx(s); - goto restart; - } - - if (flagsp) - *flagsp |= flags; -release: - sbunlock(&so->so_rcv); - splx(s); - return (error); -} - -int -soshutdown(so, how) - register struct socket *so; - register int how; -{ - register struct protosw *pr = so->so_proto; - - how++; - if (how & FREAD) - sorflush(so); - if (how & FWRITE) - return ((*pr->pr_usrreqs->pru_shutdown)(so)); - return (0); -} - -void -sorflush(so) - register struct socket *so; -{ - register struct sockbuf *sb = &so->so_rcv; - register struct protosw *pr = so->so_proto; - register int s; - struct sockbuf asb; - - sb->sb_flags |= SB_NOINTR; - (void) sblock(sb, M_WAITOK); - s = splimp(); - socantrcvmore(so); - sbunlock(sb); - asb = *sb; - bzero((caddr_t)sb, sizeof (*sb)); - splx(s); - if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose) - (*pr->pr_domain->dom_dispose)(asb.sb_mb); - sbrelease(&asb); -} - -int -sosetopt(so, level, optname, m0) - register struct socket *so; - int level, optname; - struct mbuf *m0; -{ - int error = 0; - register struct mbuf *m = m0; - - if (level != SOL_SOCKET) { - if (so->so_proto && so->so_proto->pr_ctloutput) - return ((*so->so_proto->pr_ctloutput) - (PRCO_SETOPT, so, level, optname, &m0)); - error = ENOPROTOOPT; - } else { - switch (optname) { - - case SO_LINGER: - if (m == NULL || m->m_len != sizeof (struct linger)) { - error = EINVAL; - goto bad; - } - so->so_linger = mtod(m, struct linger *)->l_linger; - /* fall thru... */ - - case SO_DEBUG: - case SO_KEEPALIVE: - case SO_DONTROUTE: - case SO_USELOOPBACK: - case SO_BROADCAST: - case SO_REUSEADDR: - case SO_REUSEPORT: - case SO_OOBINLINE: - case SO_TIMESTAMP: - if (m == NULL || m->m_len < sizeof (int)) { - error = EINVAL; - goto bad; - } - if (*mtod(m, int *)) - so->so_options |= optname; - else - so->so_options &= ~optname; - break; - - case SO_SNDBUF: - case SO_RCVBUF: - case SO_SNDLOWAT: - case SO_RCVLOWAT: - { - int optval; - - if (m == NULL || m->m_len < sizeof (int)) { - error = EINVAL; - goto bad; - } - - /* - * Values < 1 make no sense for any of these - * options, so disallow them. - */ - optval = *mtod(m, int *); - if (optval < 1) { - error = EINVAL; - goto bad; - } - - switch (optname) { - - case SO_SNDBUF: - case SO_RCVBUF: - if (sbreserve(optname == SO_SNDBUF ? - &so->so_snd : &so->so_rcv, - (u_long) optval) == 0) { - error = ENOBUFS; - goto bad; - } - break; - - /* - * Make sure the low-water is never greater than - * the high-water. - */ - case SO_SNDLOWAT: - so->so_snd.sb_lowat = - (optval > so->so_snd.sb_hiwat) ? - so->so_snd.sb_hiwat : optval; - break; - case SO_RCVLOWAT: - so->so_rcv.sb_lowat = - (optval > so->so_rcv.sb_hiwat) ? - so->so_rcv.sb_hiwat : optval; - break; - } - break; - } - - case SO_SNDTIMEO: - case SO_RCVTIMEO: - { - struct timeval *tv; - unsigned long val; - - if (m == NULL || m->m_len < sizeof (*tv)) { - error = EINVAL; - goto bad; - } - tv = mtod(m, struct timeval *); - if (tv->tv_sec >= (ULONG_MAX - hz) / hz) { - error = EDOM; - goto bad; - } - val = tv->tv_sec * hz + tv->tv_usec / tick; - - switch (optname) { - - case SO_SNDTIMEO: - so->so_snd.sb_timeo = val; - break; - case SO_RCVTIMEO: - so->so_rcv.sb_timeo = val; - break; - } - break; - } - - case SO_PRIVSTATE: - /* we don't care what the parameter is... */ - so->so_state &= ~SS_PRIV; - break; - - case SO_SNDWAKEUP: - case SO_RCVWAKEUP: - { - /* RTEMS addition. */ - struct sockwakeup *sw; - struct sockbuf *sb; - - if (m == NULL - || m->m_len != sizeof (struct sockwakeup)) { - error = EINVAL; - goto bad; - } - sw = mtod(m, struct sockwakeup *); - sb = (optname == SO_SNDWAKEUP - ? &so->so_snd - : &so->so_rcv); - sb->sb_wakeup = sw->sw_pfn; - sb->sb_wakeuparg = sw->sw_arg; - if (sw->sw_pfn) - sb->sb_flags |= SB_ASYNC; - else - sb->sb_flags &=~ SB_ASYNC; - break; - } - - default: - error = ENOPROTOOPT; - break; - } - if (error == 0 && so->so_proto && so->so_proto->pr_ctloutput) { - (void) ((*so->so_proto->pr_ctloutput) - (PRCO_SETOPT, so, level, optname, &m0)); - m = NULL; /* freed by protocol */ - } - } -bad: - if (m) - (void) m_free(m); - return (error); -} - -int -sogetopt(so, level, optname, mp) - register struct socket *so; - int level, optname; - struct mbuf **mp; -{ - register struct mbuf *m; - - if (level != SOL_SOCKET) { - if (so->so_proto && so->so_proto->pr_ctloutput) { - return ((*so->so_proto->pr_ctloutput) - (PRCO_GETOPT, so, level, optname, mp)); - } else - return (ENOPROTOOPT); - } else { - m = m_get(M_WAIT, MT_SOOPTS); - m->m_len = sizeof (int); - - switch (optname) { - - case SO_LINGER: - m->m_len = sizeof (struct linger); - mtod(m, struct linger *)->l_onoff = - so->so_options & SO_LINGER; - mtod(m, struct linger *)->l_linger = so->so_linger; - break; - - case SO_USELOOPBACK: - case SO_DONTROUTE: - case SO_DEBUG: - case SO_KEEPALIVE: - case SO_REUSEADDR: - case SO_REUSEPORT: - case SO_BROADCAST: - case SO_OOBINLINE: - case SO_TIMESTAMP: - *mtod(m, int *) = so->so_options & optname; - break; - - case SO_PRIVSTATE: - *mtod(m, int *) = so->so_state & SS_PRIV; - break; - - case SO_TYPE: - *mtod(m, int *) = so->so_type; - break; - - case SO_ERROR: - *mtod(m, int *) = so->so_error; - so->so_error = 0; - break; - - case SO_SNDBUF: - *mtod(m, int *) = so->so_snd.sb_hiwat; - break; - - case SO_RCVBUF: - *mtod(m, int *) = so->so_rcv.sb_hiwat; - break; - - case SO_SNDLOWAT: - *mtod(m, int *) = so->so_snd.sb_lowat; - break; - - case SO_RCVLOWAT: - *mtod(m, int *) = so->so_rcv.sb_lowat; - break; - - case SO_SNDTIMEO: - case SO_RCVTIMEO: - { - unsigned long val = (optname == SO_SNDTIMEO ? - so->so_snd.sb_timeo : so->so_rcv.sb_timeo); - - m->m_len = sizeof(struct timeval); - mtod(m, struct timeval *)->tv_sec = val / hz; - mtod(m, struct timeval *)->tv_usec = - (val % hz) * tick; - break; - } - - case SO_SNDWAKEUP: - case SO_RCVWAKEUP: - { - struct sockbuf *sb; - struct sockwakeup *sw; - - /* RTEMS additions. */ - sb = (optname == SO_SNDWAKEUP - ? &so->so_snd - : &so->so_rcv); - m->m_len = sizeof (struct sockwakeup); - sw = mtod(m, struct sockwakeup *); - sw->sw_pfn = sb->sb_wakeup; - sw->sw_arg = sb->sb_wakeuparg; - break; - } - - default: - (void)m_free(m); - return (ENOPROTOOPT); - } - *mp = m; - return (0); - } -} - -void -sohasoutofband(so) - register struct socket *so; -{ -#if 0 /* FIXME: For now we just ignore out of band data */ - struct proc *p; - - if (so->so_pgid < 0) - gsignal(-so->so_pgid, SIGURG); - else if (so->so_pgid > 0 && (p = pfind(so->so_pgid)) != 0) - psignal(p, SIGURG); - selwakeup(&so->so_rcv.sb_sel); -#endif -} diff --git a/c/src/exec/libnetworking/kern/uipc_socket2.c b/c/src/exec/libnetworking/kern/uipc_socket2.c deleted file mode 100644 index 0539d2c5f3..0000000000 --- a/c/src/exec/libnetworking/kern/uipc_socket2.c +++ /dev/null @@ -1,965 +0,0 @@ -/* - * This file has undergone several changes to reflect the - * differences between the RTEMS and FreeBSD kernels. - */ - -/* - * Copyright (c) 1982, 1986, 1988, 1990, 1993 - * 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. - * - * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Primitive routines for operating on sockets and socket buffers - */ - -u_long sb_max = SB_MAX; /* XXX should be static */ -SYSCTL_INT(_kern, KERN_MAXSOCKBUF, maxsockbuf, CTLFLAG_RW, &sb_max, 0, "") - -static u_long sb_efficiency = 8; /* parameter for sbreserve() */ -SYSCTL_INT(_kern, OID_AUTO, sockbuf_waste_factor, CTLFLAG_RW, &sb_efficiency, - 0, ""); - -/* - * Procedures to manipulate state flags of socket - * and do appropriate wakeups. Normal sequence from the - * active (originating) side is that soisconnecting() is - * called during processing of connect() call, - * resulting in an eventual call to soisconnected() if/when the - * connection is established. When the connection is torn down - * soisdisconnecting() is called during processing of disconnect() call, - * and soisdisconnected() is called when the connection to the peer - * is totally severed. The semantics of these routines are such that - * connectionless protocols can call soisconnected() and soisdisconnected() - * only, bypassing the in-progress calls when setting up a ``connection'' - * takes no time. - * - * From the passive side, a socket is created with - * two queues of sockets: so_q0 for connections in progress - * and so_q for connections already made and awaiting user acceptance. - * As a protocol is preparing incoming connections, it creates a socket - * structure queued on so_q0 by calling sonewconn(). When the connection - * is established, soisconnected() is called, and transfers the - * socket structure to so_q, making it available to accept(). - * - * If a socket is closed with sockets on either - * so_q0 or so_q, these sockets are dropped. - * - * If higher level protocols are implemented in - * the kernel, the wakeups done here will sometimes - * cause software-interrupt process scheduling. - */ - -void -soisconnecting(so) - register struct socket *so; -{ - - so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING); - so->so_state |= SS_ISCONNECTING; -} - -void -soisconnected(so) - register struct socket *so; -{ - register struct socket *head = so->so_head; - - so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING); - so->so_state |= SS_ISCONNECTED; - if (head && (so->so_state & SS_INCOMP)) { - TAILQ_REMOVE(&head->so_incomp, so, so_list); - head->so_incqlen--; - so->so_state &= ~SS_INCOMP; - TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); - so->so_state |= SS_COMP; - sorwakeup(head); - soconnwakeup(head); - } else { - soconnwakeup(so); - sorwakeup(so); - sowwakeup(so); - } -} - -void -soisdisconnecting(so) - register struct socket *so; -{ - - so->so_state &= ~SS_ISCONNECTING; - so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE); - soconnwakeup(so); - sowwakeup(so); - sorwakeup(so); -} - -void -soisdisconnected(so) - register struct socket *so; -{ - - so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING); - so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE); - soconnwakeup(so); - sowwakeup(so); - sorwakeup(so); -} - -/* - * Return a random connection that hasn't been serviced yet and - * is eligible for discard. There is a one in qlen chance that - * we will return a null, saying that there are no dropable - * requests. In this case, the protocol specific code should drop - * the new request. This insures fairness. - * - * This may be used in conjunction with protocol specific queue - * congestion routines. - */ -struct socket * -sodropablereq(head) - register struct socket *head; -{ - register struct socket *so; - unsigned int i, j, qlen, m; - - static int rnd; - static long old_mono_secs; - static unsigned int cur_cnt, old_cnt; - - if ((i = (m = rtems_bsdnet_seconds_since_boot()) - old_mono_secs) != 0) { - old_mono_secs = m; - old_cnt = cur_cnt / i; - cur_cnt = 0; - } - - so = TAILQ_FIRST(&head->so_incomp); - if (!so) - return (so); - - qlen = head->so_incqlen; - if (++cur_cnt > qlen || old_cnt > qlen) { - rnd = (314159 * rnd + 66329) & 0xffff; - j = ((qlen + 1) * rnd) >> 16; - - while (j-- && so) - so = TAILQ_NEXT(so, so_list); - } - - return (so); -} - -/* - * When an attempt at a new connection is noted on a socket - * which accepts connections, sonewconn is called. If the - * connection is possible (subject to space constraints, etc.) - * then we allocate a new structure, propoerly linked into the - * data structure of the original socket, and return this. - * Connstatus may be 0, or SO_ISCONFIRMING, or SO_ISCONNECTED. - * - * Currently, sonewconn() is defined as sonewconn1() in socketvar.h - * to catch calls that are missing the (new) second parameter. - */ -struct socket * -sonewconn1(head, connstatus) - register struct socket *head; - int connstatus; -{ - register struct socket *so; - - if (head->so_qlen > 3 * head->so_qlimit / 2) - return ((struct socket *)0); - MALLOC(so, struct socket *, sizeof(*so), M_SOCKET, M_DONTWAIT); - if (so == NULL) - return ((struct socket *)0); - bzero((caddr_t)so, sizeof(*so)); - so->so_head = head; - so->so_type = head->so_type; - so->so_options = head->so_options &~ SO_ACCEPTCONN; - so->so_linger = head->so_linger; - so->so_state = head->so_state | SS_NOFDREF; - so->so_proto = head->so_proto; - so->so_timeo = head->so_timeo; - so->so_pgid = head->so_pgid; - so->so_uid = head->so_uid; - (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat); - if (connstatus) { - TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); - so->so_state |= SS_COMP; - } else { - TAILQ_INSERT_TAIL(&head->so_incomp, so, so_list); - so->so_state |= SS_INCOMP; - head->so_incqlen++; - } - head->so_qlen++; - if ((*so->so_proto->pr_usrreqs->pru_attach)(so, 0)) { - if (so->so_state & SS_COMP) { - TAILQ_REMOVE(&head->so_comp, so, so_list); - } else { - TAILQ_REMOVE(&head->so_incomp, so, so_list); - head->so_incqlen--; - } - head->so_qlen--; - (void) free((caddr_t)so, M_SOCKET); - return ((struct socket *)0); - } - if (connstatus) { - sorwakeup(head); - soconnwakeup(head); - so->so_state |= connstatus; - } - return (so); -} - -/* - * Socantsendmore indicates that no more data will be sent on the - * socket; it would normally be applied to a socket when the user - * informs the system that no more data is to be sent, by the protocol - * code (in case PRU_SHUTDOWN). Socantrcvmore indicates that no more data - * will be received, and will normally be applied to the socket by a - * protocol when it detects that the peer will send no more data. - * Data queued for reading in the socket may yet be read. - */ - -void -socantsendmore(so) - struct socket *so; -{ - - so->so_state |= SS_CANTSENDMORE; - sowwakeup(so); -} - -void -socantrcvmore(so) - struct socket *so; -{ - - so->so_state |= SS_CANTRCVMORE; - sorwakeup(so); -} - -/* - * Socket buffer (struct sockbuf) utility routines. - * - * Each socket contains two socket buffers: one for sending data and - * one for receiving data. Each buffer contains a queue of mbufs, - * information about the number of mbufs and amount of data in the - * queue, and other fields allowing select() statements and notification - * on data availability to be implemented. - * - * Data stored in a socket buffer is maintained as a list of records. - * Each record is a list of mbufs chained together with the m_next - * field. Records are chained together with the m_nextpkt field. The upper - * level routine soreceive() expects the following conventions to be - * observed when placing information in the receive buffer: - * - * 1. If the protocol requires each message be preceded by the sender's - * name, then a record containing that name must be present before - * any associated data (mbuf's must be of type MT_SONAME). - * 2. If the protocol supports the exchange of ``access rights'' (really - * just additional data associated with the message), and there are - * ``rights'' to be received, then a record containing this data - * should be present (mbuf's must be of type MT_RIGHTS). - * 3. If a name or rights record exists, then it must be followed by - * a data record, perhaps of zero length. - * - * Before using a new socket structure it is first necessary to reserve - * buffer space to the socket, by calling sbreserve(). This should commit - * some of the available buffer space in the system buffer pool for the - * socket (currently, it does nothing but enforce limits). The space - * should be released by calling sbrelease() when the socket is destroyed. - */ - -int -soreserve(so, sndcc, rcvcc) - register struct socket *so; - u_long sndcc, rcvcc; -{ - - if (sbreserve(&so->so_snd, sndcc) == 0) - goto bad; - if (sbreserve(&so->so_rcv, rcvcc) == 0) - goto bad2; - if (so->so_rcv.sb_lowat == 0) - so->so_rcv.sb_lowat = 1; - if (so->so_snd.sb_lowat == 0) - so->so_snd.sb_lowat = MCLBYTES; - if (so->so_snd.sb_lowat > so->so_snd.sb_hiwat) - so->so_snd.sb_lowat = so->so_snd.sb_hiwat; - return (0); -bad2: - sbrelease(&so->so_snd); -bad: - return (ENOBUFS); -} - -/* - * Allot mbufs to a sockbuf. - * Attempt to scale mbmax so that mbcnt doesn't become limiting - * if buffering efficiency is near the normal case. - */ -int -sbreserve(sb, cc) - struct sockbuf *sb; - u_long cc; -{ - - if (cc > sb_max * MCLBYTES / (MSIZE + MCLBYTES)) - return (0); - sb->sb_hiwat = cc; - sb->sb_mbmax = min(cc * sb_efficiency, sb_max); - if (sb->sb_lowat > sb->sb_hiwat) - sb->sb_lowat = sb->sb_hiwat; - return (1); -} - -/* - * Free mbufs held by a socket, and reserved mbuf space. - */ -void -sbrelease(sb) - struct sockbuf *sb; -{ - - sbflush(sb); - sb->sb_hiwat = sb->sb_mbmax = 0; -} - -/* - * Routines to add and remove - * data from an mbuf queue. - * - * The routines sbappend() or sbappendrecord() are normally called to - * append new mbufs to a socket buffer, after checking that adequate - * space is available, comparing the function sbspace() with the amount - * of data to be added. sbappendrecord() differs from sbappend() in - * that data supplied is treated as the beginning of a new record. - * To place a sender's address, optional access rights, and data in a - * socket receive buffer, sbappendaddr() should be used. To place - * access rights and data in a socket receive buffer, sbappendrights() - * should be used. In either case, the new data begins a new record. - * Note that unlike sbappend() and sbappendrecord(), these routines check - * for the caller that there will be enough space to store the data. - * Each fails if there is not enough space, or if it cannot find mbufs - * to store additional information in. - * - * Reliable protocols may use the socket send buffer to hold data - * awaiting acknowledgement. Data is normally copied from a socket - * send buffer in a protocol with m_copy for output to a peer, - * and then removing the data from the socket buffer with sbdrop() - * or sbdroprecord() when the data is acknowledged by the peer. - */ - -/* - * Append mbuf chain m to the last record in the - * socket buffer sb. The additional space associated - * the mbuf chain is recorded in sb. Empty mbufs are - * discarded and mbufs are compacted where possible. - */ -void -sbappend(sb, m) - struct sockbuf *sb; - struct mbuf *m; -{ - register struct mbuf *n; - - if (m == 0) - return; - n = sb->sb_mb; - if (n) { - while (n->m_nextpkt) - n = n->m_nextpkt; - do { - if (n->m_flags & M_EOR) { - sbappendrecord(sb, m); /* XXXXXX!!!! */ - return; - } - } while (n->m_next && (n = n->m_next)); - } - sbcompress(sb, m, n); -} - -#ifdef SOCKBUF_DEBUG -void -sbcheck(sb) - register struct sockbuf *sb; -{ - register struct mbuf *m; - register int len = 0, mbcnt = 0; - - for (m = sb->sb_mb; m; m = m->m_next) { - len += m->m_len; - mbcnt += MSIZE; - if (m->m_flags & M_EXT) /*XXX*/ /* pretty sure this is bogus */ - mbcnt += m->m_ext.ext_size; - if (m->m_nextpkt) - panic("sbcheck nextpkt"); - } - if (len != sb->sb_cc || mbcnt != sb->sb_mbcnt) { - printf("cc %d != %d || mbcnt %d != %d\n", len, sb->sb_cc, - mbcnt, sb->sb_mbcnt); - panic("sbcheck"); - } -} -#endif - -/* - * As above, except the mbuf chain - * begins a new record. - */ -void -sbappendrecord(sb, m0) - register struct sockbuf *sb; - register struct mbuf *m0; -{ - register struct mbuf *m; - - if (m0 == 0) - return; - m = sb->sb_mb; - if (m) - while (m->m_nextpkt) - m = m->m_nextpkt; - /* - * Put the first mbuf on the queue. - * Note this permits zero length records. - */ - sballoc(sb, m0); - if (m) - m->m_nextpkt = m0; - else - sb->sb_mb = m0; - m = m0->m_next; - m0->m_next = 0; - if (m && (m0->m_flags & M_EOR)) { - m0->m_flags &= ~M_EOR; - m->m_flags |= M_EOR; - } - sbcompress(sb, m, m0); -} - -/* - * As above except that OOB data - * is inserted at the beginning of the sockbuf, - * but after any other OOB data. - */ -void -sbinsertoob(sb, m0) - register struct sockbuf *sb; - register struct mbuf *m0; -{ - register struct mbuf *m; - register struct mbuf **mp; - - if (m0 == 0) - return; - for (mp = &sb->sb_mb; *mp ; mp = &((*mp)->m_nextpkt)) { - m = *mp; - again: - switch (m->m_type) { - - case MT_OOBDATA: - continue; /* WANT next train */ - - case MT_CONTROL: - m = m->m_next; - if (m) - goto again; /* inspect THIS train further */ - } - break; - } - /* - * Put the first mbuf on the queue. - * Note this permits zero length records. - */ - sballoc(sb, m0); - m0->m_nextpkt = *mp; - *mp = m0; - m = m0->m_next; - m0->m_next = 0; - if (m && (m0->m_flags & M_EOR)) { - m0->m_flags &= ~M_EOR; - m->m_flags |= M_EOR; - } - sbcompress(sb, m, m0); -} - -/* - * Append address and data, and optionally, control (ancillary) data - * to the receive queue of a socket. If present, - * m0 must include a packet header with total length. - * Returns 0 if no space in sockbuf or insufficient mbufs. - */ -int -sbappendaddr(sb, asa, m0, control) - register struct sockbuf *sb; - struct sockaddr *asa; - struct mbuf *m0, *control; -{ - register struct mbuf *m, *n; - int space = asa->sa_len; - -if (m0 && (m0->m_flags & M_PKTHDR) == 0) -panic("sbappendaddr"); - if (m0) - space += m0->m_pkthdr.len; - for (n = control; n; n = n->m_next) { - space += n->m_len; - if (n->m_next == 0) /* keep pointer to last control buf */ - break; - } - if (space > sbspace(sb)) - return (0); - if (asa->sa_len > MLEN) - return (0); - MGET(m, M_DONTWAIT, MT_SONAME); - if (m == 0) - return (0); - m->m_len = asa->sa_len; - bcopy((caddr_t)asa, mtod(m, caddr_t), asa->sa_len); - if (n) - n->m_next = m0; /* concatenate data to control */ - else - control = m0; - m->m_next = control; - for (n = m; n; n = n->m_next) - sballoc(sb, n); - n = sb->sb_mb; - if (n) { - while (n->m_nextpkt) - n = n->m_nextpkt; - n->m_nextpkt = m; - } else - sb->sb_mb = m; - return (1); -} - -int -sbappendcontrol(sb, m0, control) - struct sockbuf *sb; - struct mbuf *control, *m0; -{ - register struct mbuf *m, *n; - int space = 0; - - if (control == 0) - panic("sbappendcontrol"); - for (m = control; ; m = m->m_next) { - space += m->m_len; - if (m->m_next == 0) - break; - } - n = m; /* save pointer to last control buffer */ - for (m = m0; m; m = m->m_next) - space += m->m_len; - if (space > sbspace(sb)) - return (0); - n->m_next = m0; /* concatenate data to control */ - for (m = control; m; m = m->m_next) - sballoc(sb, m); - n = sb->sb_mb; - if (n) { - while (n->m_nextpkt) - n = n->m_nextpkt; - n->m_nextpkt = control; - } else - sb->sb_mb = control; - return (1); -} - -/* - * Compress mbuf chain m into the socket - * buffer sb following mbuf n. If n - * is null, the buffer is presumed empty. - */ -void -sbcompress(sb, m, n) - register struct sockbuf *sb; - register struct mbuf *m, *n; -{ - register int eor = 0; - register struct mbuf *o; - - while (m) { - eor |= m->m_flags & M_EOR; - if (m->m_len == 0 && - (eor == 0 || - (((o = m->m_next) || (o = n)) && - o->m_type == m->m_type))) { - m = m_free(m); - continue; - } - if (n && (n->m_flags & (M_EXT | M_EOR)) == 0 && - (n->m_data + n->m_len + m->m_len) < &n->m_dat[MLEN] && - n->m_type == m->m_type) { - bcopy(mtod(m, caddr_t), mtod(n, caddr_t) + n->m_len, - (unsigned)m->m_len); - n->m_len += m->m_len; - sb->sb_cc += m->m_len; - m = m_free(m); - continue; - } - if (n) - n->m_next = m; - else - sb->sb_mb = m; - sballoc(sb, m); - n = m; - m->m_flags &= ~M_EOR; - m = m->m_next; - n->m_next = 0; - } - if (eor) { - if (n) - n->m_flags |= eor; - else - printf("semi-panic: sbcompress\n"); - } -} - -/* - * Free all mbufs in a sockbuf. - * Check that all resources are reclaimed. - */ -void -sbflush(sb) - register struct sockbuf *sb; -{ - - if (sb->sb_flags & SB_LOCK) - panic("sbflush"); - while (sb->sb_mbcnt) - sbdrop(sb, (int)sb->sb_cc); - if (sb->sb_cc || sb->sb_mb) - panic("sbflush 2"); -} - -/* - * Drop data from (the front of) a sockbuf. - */ -void -sbdrop(sb, len) - register struct sockbuf *sb; - register int len; -{ - register struct mbuf *m, *mn; - struct mbuf *next; - - next = (m = sb->sb_mb) ? m->m_nextpkt : 0; - while (len > 0) { - if (m == 0) { - if (next == 0) - panic("sbdrop"); - m = next; - next = m->m_nextpkt; - continue; - } - if (m->m_len > len) { - m->m_len -= len; - m->m_data += len; - sb->sb_cc -= len; - break; - } - len -= m->m_len; - sbfree(sb, m); - MFREE(m, mn); - m = mn; - } - while (m && m->m_len == 0) { - sbfree(sb, m); - MFREE(m, mn); - m = mn; - } - if (m) { - sb->sb_mb = m; - m->m_nextpkt = next; - } else - sb->sb_mb = next; -} - -/* - * Drop a record off the front of a sockbuf - * and move the next record to the front. - */ -void -sbdroprecord(sb) - register struct sockbuf *sb; -{ - register struct mbuf *m, *mn; - - m = sb->sb_mb; - if (m) { - sb->sb_mb = m->m_nextpkt; - do { - sbfree(sb, m); - MFREE(m, mn); - m = mn; - } while (m); - } -} - -/* - * Create a "control" mbuf containing the specified data - * with the specified type for presentation on a socket buffer. - */ -struct mbuf * -sbcreatecontrol(p, size, type, level) - caddr_t p; - register int size; - int type, level; -{ - register struct cmsghdr *cp; - struct mbuf *m; - - if ((m = m_get(M_DONTWAIT, MT_CONTROL)) == NULL) - return ((struct mbuf *) NULL); - cp = mtod(m, struct cmsghdr *); - /* XXX check size? */ - (void)memcpy(CMSG_DATA(cp), p, size); - size += sizeof(*cp); - m->m_len = size; - cp->cmsg_len = size; - cp->cmsg_level = level; - cp->cmsg_type = type; - return (m); -} - -#ifdef PRU_OLDSTYLE -/* - * The following routines mediate between the old-style `pr_usrreq' - * protocol implementations and the new-style `struct pr_usrreqs' - * calling convention. - */ - -/* syntactic sugar */ -#define nomb (struct mbuf *)0 - -static int -old_abort(struct socket *so) -{ - return so->so_proto->pr_ousrreq(so, PRU_ABORT, nomb, nomb, nomb); -} - -static int -old_accept(struct socket *so, struct mbuf *nam) -{ - return so->so_proto->pr_ousrreq(so, PRU_ACCEPT, nomb, nam, nomb); -} - -static int -old_attach(struct socket *so, int proto) -{ - return so->so_proto->pr_ousrreq(so, PRU_ATTACH, nomb, - (struct mbuf *)proto, /* XXX */ - nomb); -} - -static int -old_bind(struct socket *so, struct mbuf *nam) -{ - return so->so_proto->pr_ousrreq(so, PRU_BIND, nomb, nam, nomb); -} - -static int -old_connect(struct socket *so, struct mbuf *nam) -{ - return so->so_proto->pr_ousrreq(so, PRU_CONNECT, nomb, nam, nomb); -} - -static int -old_connect2(struct socket *so1, struct socket *so2) -{ - return so1->so_proto->pr_ousrreq(so1, PRU_CONNECT2, nomb, - (struct mbuf *)so2, nomb); -} - -static int -old_control(struct socket *so, int cmd, caddr_t data, struct ifnet *ifp) -{ - return so->so_proto->pr_ousrreq(so, PRU_CONTROL, (struct mbuf *)cmd, - (struct mbuf *)data, - (struct mbuf *)ifp); -} - -static int -old_detach(struct socket *so) -{ - return so->so_proto->pr_ousrreq(so, PRU_DETACH, nomb, nomb, nomb); -} - -static int -old_disconnect(struct socket *so) -{ - return so->so_proto->pr_ousrreq(so, PRU_DISCONNECT, nomb, nomb, nomb); -} - -static int -old_listen(struct socket *so) -{ - return so->so_proto->pr_ousrreq(so, PRU_LISTEN, nomb, nomb, nomb); -} - -static int -old_peeraddr(struct socket *so, struct mbuf *nam) -{ - return so->so_proto->pr_ousrreq(so, PRU_PEERADDR, nomb, nam, nomb); -} - -static int -old_rcvd(struct socket *so, int flags) -{ - return so->so_proto->pr_ousrreq(so, PRU_RCVD, nomb, - (struct mbuf *)flags, /* XXX */ - nomb); -} - -static int -old_rcvoob(struct socket *so, struct mbuf *m, int flags) -{ - return so->so_proto->pr_ousrreq(so, PRU_RCVOOB, m, - (struct mbuf *)flags, /* XXX */ - nomb); -} - -static int -old_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr, - struct mbuf *control) -{ - int req; - - if (flags & PRUS_OOB) { - req = PRU_SENDOOB; - } else if(flags & PRUS_EOF) { - req = PRU_SEND_EOF; - } else { - req = PRU_SEND; - } - return so->so_proto->pr_ousrreq(so, req, m, addr, control); -} - -static int -old_sense(struct socket *so, struct stat *sb) -{ - return so->so_proto->pr_ousrreq(so, PRU_SENSE, (struct mbuf *)sb, - nomb, nomb); -} - -static int -old_shutdown(struct socket *so) -{ - return so->so_proto->pr_ousrreq(so, PRU_SHUTDOWN, nomb, nomb, nomb); -} - -static int -old_sockaddr(struct socket *so, struct mbuf *nam) -{ - return so->so_proto->pr_ousrreq(so, PRU_SOCKADDR, nomb, nam, nomb); -} - -struct pr_usrreqs pru_oldstyle = { - old_abort, old_accept, old_attach, old_bind, old_connect, - old_connect2, old_control, old_detach, old_disconnect, - old_listen, old_peeraddr, old_rcvd, old_rcvoob, old_send, - old_sense, old_shutdown, old_sockaddr -}; - -#endif /* PRU_OLDSTYLE */ - -/* - * Some routines that return EOPNOTSUPP for entry points that are not - * supported by a protocol. Fill in as needed. - */ -int -pru_accept_notsupp(struct socket *so, struct mbuf *nam) -{ - return EOPNOTSUPP; -} - -int -pru_connect2_notsupp(struct socket *so1, struct socket *so2) -{ - return EOPNOTSUPP; -} - -int -pru_control_notsupp(struct socket *so, int cmd, caddr_t data, - struct ifnet *ifp) -{ - return EOPNOTSUPP; -} - -int -pru_listen_notsupp(struct socket *so) -{ - return EOPNOTSUPP; -} - -int -pru_rcvd_notsupp(struct socket *so, int flags) -{ - return EOPNOTSUPP; -} - -int -pru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags) -{ - return EOPNOTSUPP; -} - -/* - * This isn't really a ``null'' operation, but it's the default one - * and doesn't do anything destructive. - */ -int -pru_sense_null(struct socket *so, struct stat *sb) -{ - sb->st_blksize = so->so_snd.sb_hiwat; - return 0; -} - diff --git a/c/src/exec/libnetworking/lib/.cvsignore b/c/src/exec/libnetworking/lib/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libnetworking/lib/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libnetworking/lib/Makefile.am b/c/src/exec/libnetworking/lib/Makefile.am deleted file mode 100644 index a1cea1841b..0000000000 --- a/c/src/exec/libnetworking/lib/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -## -## $Id$ -## - - -LIBNAME = lib.a -LIB = $(ARCH)/$(LIBNAME) - -C_FILES = getprotoby.c rtems_bsdnet_ntp.c ftpfs.c syslog.c tftpDriver.c -C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) - -OBJS = $(C_O_FILES) - -include $(top_srcdir)/../automake/multilib.am -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/lib.am - -# -# Add local stuff here using += -# - -AM_CPPFLAGS += -DNOPOLL -DNOSELECT - -$(LIB): $(OBJS) - $(make-library) - -all-local: $(ARCH) $(OBJS) $(LIB) - -.PRECIOUS: $(LIB) - -EXTRA_DIST = README getprotoby.c rtems_bsdnet_ntp.c syslog.c tftpDriver.c - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libnetworking/lib/README b/c/src/exec/libnetworking/lib/README deleted file mode 100644 index 998bd5e708..0000000000 --- a/c/src/exec/libnetworking/lib/README +++ /dev/null @@ -1,5 +0,0 @@ -# -# $Id$ -# - -Sources from application-level (as opposed to kernel-level) libraries. diff --git a/c/src/exec/libnetworking/lib/ftpfs.c b/c/src/exec/libnetworking/lib/ftpfs.c deleted file mode 100644 index 033c1b6bdf..0000000000 --- a/c/src/exec/libnetworking/lib/ftpfs.c +++ /dev/null @@ -1,1159 +0,0 @@ -/* - * File Transfer Protocol client - * - * Transfer file to/from remote host - * - * This driver can be added to the RTEMS file system with a call to - * "rtems_bsdnet_initialize_ftp_filesystem () ". - * From then on, you can open, read and close files on a remote FTP server - * using the following syntax: - * To open a file "myfile.txt" in the directory "mydir" (relative to home - * directory) on a server named "myserver" using the user id - * "myuserid" and the password "my_very_secret_password" you must - * specify the following path: - * - * /FTP/myuserid:my_very_secret_password/@myserver/mydirectory/myfile.txt - * - * If the server is the default server specified in BOOTP, it can be ommitted: - * - * /FTP/myuserid:my_very_secret_password/mydirectory/myfile.txt - * - * WARNING: write accesses have not yet been tested. - * - * - * (c) Copyright 2002 - * Thomas Doerfler - * IMD Ingenieurbuero fuer Microcomputertechnik - * Herbststr. 8 - * 82178 Puchheim, Germany - * - * - * This code has been created after closly inspecting - * "tftpdriver.c" from Eric Norum. - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#ifndef set_errno_and_return_minus_one -#define set_errno_and_return_minus_one( _error ) \ - do { errno = (_error); return -1; } while(0) -#endif - -/* #define DEBUG_OUT */ - -/* - * Well-known port for FTP - */ -#define FTP_PORT_NUM 21 - -/* - * Pathname prefix - */ -#define FTP_PATHNAME_PREFIX "/FTP/" -/* - * reply codes - */ -#define FTP_REPLY_CONNECT 220 /* Connection established */ -#define FTP_REPLY_PASSREQ 331 /* user ok, password required */ -#define FTP_REPLY_LOGIN 230 /* login finished */ -#define FTP_REPLY_SUCCESS 200 /* xxx successful */ -#define FTP_REPLY_OPENCONN 150 /* opening connection for tfer */ -#define FTP_REPLY_TFERCMPL 226 /* transfer complete */ - -extern rtems_filesystem_operations_table rtems_ftp_ops; -extern rtems_filesystem_file_handlers_r rtems_ftp_handlers; - -/* - * FTP command strings - */ -#define FTP_USER_CMD "USER " -#define FTP_PASS_CMD "PASS " -#define FTP_BINARY_CMD "TYPE I" -#define FTP_PORT_CMD "PORT " -#define FTP_STOR_CMD "STOR " -#define FTP_RETR_CMD "RETR " -#define FTP_QUIT_CMD "QUIT" - -/* - * State of each FTP stream - */ -struct ftpStream { - /* - * Control connection socket - */ - int ctrl_socket; - struct sockaddr_in myCtrlAddress; - struct sockaddr_in farCtrlAddress; - /* - * Data transfer socket - */ - int port_socket; - int data_socket; - struct sockaddr_in myDataAddress; - struct sockaddr_in farDataAddress; - /* - * other stuff to remember - */ - boolean eof_reached; -}; - -/* - * Number of streams open at the same time - */ -static rtems_id ftp_mutex; -static int nStreams; -static struct ftpStream ** volatile ftpStreams; - -extern rtems_filesystem_operations_table rtems_tftp_ops; -extern rtems_filesystem_file_handlers_r rtems_tftp_handlers; - -/* - * Direct copy from the IMFS/TFTP. Look at this. - */ - -rtems_filesystem_limits_and_options_t rtems_ftp_limits_and_options = { - 5, /* link_max */ - 6, /* max_canon */ - 7, /* max_input */ - 255, /* name_max */ - 255, /* path_max */ - 2, /* pipe_buf */ - 1, /* posix_async_io */ - 2, /* posix_chown_restrictions */ - 3, /* posix_no_trunc */ - 4, /* posix_prio_io */ - 5, /* posix_sync_io */ - 6 /* posix_vdisable */ -}; - -int rtems_ftp_mount_me( - rtems_filesystem_mount_table_entry_t *temp_mt_entry -) -{ - rtems_status_code sc; - - temp_mt_entry->mt_fs_root.handlers = &rtems_ftp_handlers; - temp_mt_entry->mt_fs_root.ops = &rtems_ftp_ops; - - /* - * We have no ftp filesystem specific data to maintain. This - * filesystem may only be mounted ONCE. - * - * And we maintain no real filesystem nodes, so there is no real root. - */ - - temp_mt_entry->fs_info = NULL; - temp_mt_entry->mt_fs_root.node_access = NULL; - - /* - * These need to be looked at for full POSIX semantics. - */ - - temp_mt_entry->pathconf_limits_and_options = rtems_ftp_limits_and_options; - - - /* - * Now allocate a semaphore for mutual exclusion. - * - * NOTE: This could be in an fsinfo for this filesystem type. - */ - - sc = rtems_semaphore_create (rtems_build_name('F','T','P',' '), - 1, - RTEMS_FIFO | - RTEMS_BINARY_SEMAPHORE | - RTEMS_NO_INHERIT_PRIORITY | - RTEMS_NO_PRIORITY_CEILING | - RTEMS_LOCAL, - 0, - &ftp_mutex); - - if (sc != RTEMS_SUCCESSFUL) - set_errno_and_return_minus_one( ENOMEM ); - - return 0; -} - -/* - * Initialize the FTP driver - */ - -int rtems_bsdnet_initialize_ftp_filesystem () -{ - int status; - rtems_filesystem_mount_table_entry_t *entry; - - status = mkdir( FTP_PATHNAME_PREFIX, S_IRWXU | S_IRWXG | S_IRWXO ); - if ( status == -1 ) - return status; - - status = mount( - &entry, - &rtems_ftp_ops, - RTEMS_FILESYSTEM_READ_ONLY, - NULL, - FTP_PATHNAME_PREFIX - ); - - if ( status ) - perror( "FTP mount failed" ); - - return status; -} - -/* - * read and return message code from ftp control connection - */ -int rtems_ftp_get_message -( - const struct ftpStream *fsp, /* ptr to ftp control structure */ - int *msg_code /* ptr to return message code */ -) -{ - char rd_buffer[4]; - size_t rd_size; - size_t tmp_size; - int eno = 0; - rtems_boolean finished = FALSE; - do { - /* - * fetch (at least) 4 characters from control connection - * FIXME: how about a timeout? - */ - rd_size = 0; - while ((eno == 0) && - (rd_size < sizeof(rd_buffer))) { - tmp_size = read(fsp->ctrl_socket, - (&rd_buffer)+rd_size, - sizeof(rd_buffer)-rd_size); - if (tmp_size < 0) { - eno = EIO; - } - else { -#ifdef DEBUG_OUT - write(1,(&rd_buffer)+rd_size,tmp_size); -#endif - rd_size += tmp_size; - } - } - /* - * check for 3 digits and space, otherwise not finished - */ - if ((eno == 0) && - (isdigit((unsigned int)rd_buffer[0])) && - (isdigit((unsigned int)rd_buffer[1])) && - (isdigit((unsigned int)rd_buffer[2])) && - (rd_buffer[3] == ' ')) { - finished = TRUE; - rd_buffer[3] = '\0'; - *msg_code = atol(rd_buffer); - } - /* - * skip rest until end-of-line - */ - do { - tmp_size = read(fsp->ctrl_socket, - &rd_buffer, - 1); - if (tmp_size < 0) { - eno = EIO; - } -#ifdef DEBUG_OUT - else { - write(1,(&rd_buffer),tmp_size); - } -#endif - } while ((eno == 0) && - (rd_buffer[0] != '\n')); - } while ((eno == 0) && !finished); - return eno; -} - -/* - * split a pseudo file name into host, user, password, filename - * NOTE: this function will allocate space for these strings, - * the calling function should free the space, when no longer needed - * exception: when we return any error, we will also cleanup - * the strings - * valid forms: - * /FTP/user:pass/filepath - * /FTP/user:pass@hostname/filepath - - * /FTP/user:pass/filepath - * /FTP/user:pass/@hostname/filepath - * NOTE: /FTP is already stripped from the name - */ -int rtems_ftp_split_names -( const char *pathname, /* total path name (including prefix) */ - char **usernamep, /* ptr to ptr to user name */ - char **passwordp, /* ptr to ptr to password */ - char **hostnamep, /* ptr to ptr to host name */ - char **filenamep) /* ptr to ptr to hostremaining file name */ -{ - const char *chunk_start; - const char *chunk_end; - size_t chunk_len; - int rc = 0; - - /* - * ensure, that result pointers are NULL... - */ - *usernamep = NULL; - *passwordp = NULL; - *hostnamep = NULL; - *filenamep = NULL; - -#if 1 - chunk_start = pathname; -#else /* no longer needed with IMFS */ - /* - * check, that total path is long enough, skip prefix - */ - if (rc == 0) { - if (strlen (pathname) <= strlen (FTP_PATHNAME_PREFIX)) { - rc = ENOENT; - } - else { - chunk_start = pathname + strlen (FTP_PATHNAME_PREFIX); - } - } -#endif - /* - * fetch user name: terminated with ":" - */ - if (rc == 0) { - chunk_end = strchr(chunk_start,':'); - if ((chunk_end == NULL) || /* No ':' found or */ - (chunk_end == chunk_start)) { /* ':' is first character-> no name */ - rc = ENOENT; - } - else { - chunk_len = chunk_end-chunk_start; - *usernamep = malloc(chunk_len); - if (*usernamep == NULL) { - rc = ENOMEM; - } - else { - memcpy(*usernamep,chunk_start,chunk_len); - (*usernamep)[chunk_len] = '\0'; - } - } - } - /* - * fetch password: terminated with "/" or "@" - */ - if (rc == 0) { - chunk_start = chunk_end + 1; /* skip ":" after user name */ - chunk_end = strchr(chunk_start,'/'); - if ((chunk_end == NULL) || /* No '/' found or */ - (chunk_end == chunk_start)) { /* '/' is first character-> no pwd */ - rc = ENOENT; - } - else { - /* - * we have found a proper '/' - * this is the end of the password - */ - chunk_len = chunk_end-chunk_start; - *passwordp = malloc(chunk_len); - if (*passwordp == NULL) { - rc = ENOMEM; - } - else { - memcpy(*passwordp,chunk_start,chunk_len); - (*passwordp)[chunk_len] = '\0'; - } - } - } - /* - * if first char after '/' is '@', then this is the hostname - * fetch hostname terminated with "/" - * if exists at all. otherwise take default server from bootp - */ - if (rc == 0) { - chunk_start = chunk_end+1; - if (*chunk_start == '@') { - /* - * hostname follows - */ - chunk_start = chunk_start + 1; /* skip "@" after password */ - chunk_end = strchr(chunk_start,'/'); - if ((chunk_end == NULL) || /* No '/' found or */ - (chunk_end == chunk_start)) { /* '/' is first character-> no host */ - rc = ENOENT; - } - else { - /* - * we have found a proper '/' - */ - chunk_len = chunk_end-chunk_start; - *hostnamep = malloc(chunk_len); - if (*hostnamep == NULL) { - rc = ENOMEM; - } - else { - memcpy(*hostnamep,chunk_start,chunk_len); - (*hostnamep)[chunk_len] = '\0'; - } - } - } - else { /* chunk_start != '@' */ - /* - * no host name given, keep string empty - */ - *hostnamep = malloc(1); - if (*hostnamep == NULL) { - rc = ENOMEM; - } - else { - (*hostnamep)[0] = '\0'; - } - } - } - /* - * fetch filename. This is all the rest... - */ - if (rc == 0) { - chunk_start = chunk_end+1; - if (*chunk_start == '\0') { /* nothing left for filename */ - rc = ENOENT; - } - else { - chunk_len = strlen(chunk_start); - *filenamep = malloc(chunk_len); - if (*filenamep == NULL) { - rc = ENOMEM; - } - else { - memcpy(*filenamep,chunk_start,chunk_len); - (*filenamep)[chunk_len] = '\0'; - } - } - } - - /* - * cleanup anything, if error occured - */ - if (rc != 0) { - if (*hostnamep != NULL) { - free(*hostnamep); - *hostnamep = NULL; - } - if (*usernamep != NULL) { - free(*usernamep); - *usernamep = NULL; - } - if (*passwordp != NULL) { - free(*passwordp); - *passwordp = NULL; - } - if (*filenamep != NULL) { - free(*filenamep); - *filenamep = NULL; - } - } - return rc; -} - -int rtems_ftp_evaluate_for_make( - const char *path, /* IN */ - rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ - const char **name /* OUT */ -) -{ - set_errno_and_return_minus_one( EIO ); -} - -/* - * XXX - Fix return values. - */ - -int rtems_ftp_eval_path( - const char *pathname, /* IN */ - int flags, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */ -) -{ - - /* - * Read-only for now - */ - - if ( ((flags & O_RDONLY) != O_RDONLY ) && - ((flags & O_WRONLY) != O_WRONLY )) { - set_errno_and_return_minus_one( ENOENT ); - } - /* - * The File system is mounted at FTP_PATHNAME_PREFIX - * the caller of this routine has striped off this part of the - * name. Save the remainder of the name for use by the open routine. - */ - - pathloc->node_access = (void * ) pathname; - pathloc->handlers = &rtems_ftp_handlers; - - return 0; -} - -/* - * Open a FTP stream - */ -int rtems_ftp_open( - rtems_libio_t *iop, - const char *new_name, - unsigned32 flag, - unsigned32 mode -) -{ - int s = 0; - char *filename = NULL; - char *uname = NULL; - char *upass = NULL; - char *hostname = NULL; - char port_buffer[sizeof(FTP_PORT_CMD)+6*4+1+1]; - rtems_unsigned32 my_ip; - rtems_unsigned16 my_port; - int eno = 0; - rtems_status_code rc; - rtems_boolean is_write = FALSE; - rtems_boolean sema_obtained = FALSE; - struct ftpStream *fsp = NULL; - int msg_tmp; - int sockaddr_size; - /* - * check for R/O or W/O flags - */ - if (eno == 0) { - if ((0 != (iop->flags & LIBIO_FLAGS_WRITE)) && - (0 != (iop->flags & LIBIO_FLAGS_READ))) { - eno = ENOTSUP; - } - else { - is_write = (0 != (iop->flags & LIBIO_FLAGS_WRITE)); - } - } - /* - * split pathname into parts - */ - if (eno == 0) { - eno = rtems_ftp_split_names(iop->file_info, - &uname, - &upass, - &hostname, - &filename); - } - - /* - * Find a free stream - */ - if (eno == 0) { - rc = rtems_semaphore_obtain (ftp_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (rc == RTEMS_SUCCESSFUL) { - sema_obtained = TRUE; - } - else { - eno = EBUSY; - } - } - if (eno == 0) { - for (s = 0 ; s < nStreams ; s++) { - if (ftpStreams[s] == NULL) - break; - } - if (s == nStreams) { - /* - * Reallocate stream pointers - * Guard against the case where realloc() returns NULL. - */ - struct ftpStream **np; - - np = realloc (ftpStreams, ++nStreams * sizeof *ftpStreams); - if (np == NULL) { - eno = ENOMEM; - } - else { - ftpStreams = np; - } - } - } - if (eno == 0) { - fsp = ftpStreams[s] = malloc (sizeof (struct ftpStream)); - rtems_semaphore_release (ftp_mutex); - sema_obtained = FALSE; - if (fsp == NULL) { - eno = ENOMEM; - } - else { - iop->data0 = s; - iop->data1 = fsp; - fsp->ctrl_socket = -1; /* mark, that sockets not yet created */ - fsp->port_socket = -1; - fsp->data_socket = -1; - fsp->eof_reached = FALSE; - } - } - if (eno == 0) { - /* - * Create the socket for control connection - */ - if ((fsp->ctrl_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) { - eno = ENOMEM; - } - } - - if (eno == 0) { - /* - * Set the destination to the FTP server - * port on the remote machine. - */ - memset(&(fsp->farCtrlAddress),sizeof(fsp->farCtrlAddress),0); - fsp->farCtrlAddress.sin_family = AF_INET; - if (*hostname == '\0') { - fsp->farCtrlAddress.sin_addr.s_addr = rtems_bsdnet_bootp_server_address.s_addr; - } - else if (1 != inet_aton(hostname,&(fsp->farCtrlAddress.sin_addr))) { - struct hostent *hent; - struct hostent *gethostbyname(const char *name); - - hent = gethostbyname(hostname); - if (hent != NULL) { - bcopy(hent->h_addr, - (char *)(&(fsp->farCtrlAddress.sin_addr)), - sizeof(fsp->farCtrlAddress.sin_addr)); - } - else { - eno = ENOENT; - } - } - if (eno == 0) { - fsp->farCtrlAddress.sin_port = htons (FTP_PORT_NUM); - fsp->farCtrlAddress.sin_len = sizeof(fsp->farCtrlAddress); - if (0 > connect(fsp->ctrl_socket, - (struct sockaddr *)&(fsp->farCtrlAddress), - sizeof(fsp->farCtrlAddress))) { - eno = ENOENT; - } - } - if (eno == 0) { - /* - * fetch IP address of interface used - */ - memset(&(fsp->myCtrlAddress),sizeof(fsp->myCtrlAddress),0); - fsp->myCtrlAddress.sin_family = AF_INET; - fsp->myCtrlAddress.sin_addr.s_addr = INADDR_ANY; - fsp->myCtrlAddress.sin_port = 0; - fsp->myCtrlAddress.sin_len = sizeof(fsp->myDataAddress); - sockaddr_size = sizeof(fsp->myCtrlAddress); - if (0 > getsockname(fsp->ctrl_socket, - (struct sockaddr *)&(fsp->myCtrlAddress), - &sockaddr_size)) { - eno = ENOMEM; - } - } - } - if (eno == 0) { - /* - * now we should get a connect message from the FTP server - */ - eno = rtems_ftp_get_message(fsp,&msg_tmp); - if ((eno == 0) && - (msg_tmp != FTP_REPLY_CONNECT)) { - eno = ENOENT; - } - } - if (eno == 0) { - /* - * send user ID to server - * NOTE: the following lines will be executed in order - * and will be aborted whenever an error occures... (see your ANSI C book) - */ - if ((0 > send(fsp->ctrl_socket,FTP_USER_CMD,strlen(FTP_USER_CMD),0)) || - (0 > send(fsp->ctrl_socket,uname, strlen(uname), 0)) || - (0 > send(fsp->ctrl_socket,"\n", 1, 0))) { - eno = EIO; - } - } - if (eno == 0) { - /* - * now we should get a request for the password or a login... - */ - eno = rtems_ftp_get_message(fsp,&msg_tmp); - if (eno == 0) { - if (msg_tmp == FTP_REPLY_PASSREQ) { - /* - * send password to server - */ -#ifdef DEBUG_OUT - write(1,FTP_PASS_CMD,strlen(FTP_PASS_CMD)); - write(1,upass, strlen(upass) ); - write(1,"\n", 1 ); -#endif - if ((0 > send(fsp->ctrl_socket,FTP_PASS_CMD,strlen(FTP_PASS_CMD),0)) || - (0 > send(fsp->ctrl_socket,upass, strlen(upass), 0)) || - (0 > send(fsp->ctrl_socket,"\n", 1, 0))) { - eno = EIO; - } - /* - * at least now a login reply should come up... - * this is checked some lines downwards the code - */ - if (eno == 0) { - eno = rtems_ftp_get_message(fsp,&msg_tmp); - } - } - } - } - if (eno == 0) { - /* - * check for a login reply. this should be present now... - */ - if (msg_tmp != FTP_REPLY_LOGIN) { - eno = EACCES; /* pseudo for wrong user/pass */ - } - } - if (eno == 0) { - /* - * set binary mode for all transfers - */ -#ifdef DEBUG_OUT - write(1,FTP_BINARY_CMD,strlen(FTP_BINARY_CMD)); - write(1,"\n", 1 ); -#endif - if ((0 > send(fsp->ctrl_socket,FTP_BINARY_CMD,strlen(FTP_BINARY_CMD),0)) || - (0 > send(fsp->ctrl_socket,"\n", 1, 0))) { - eno = EIO; - } - else { - eno = rtems_ftp_get_message(fsp,&msg_tmp); - } - } - if (eno == 0) { - /* - * check for a "BINARY TYPE command successful" reply - */ - if (msg_tmp != FTP_REPLY_SUCCESS) { - eno = EIO; - } - } - if (eno == 0) { - /* - * create and bind socket for data connection - */ - if ((fsp->port_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) { - eno = ENOMEM; - } - else { - memset(&(fsp->myDataAddress),sizeof(fsp->myDataAddress),0); - fsp->myDataAddress.sin_family = AF_INET; - fsp->myDataAddress.sin_addr.s_addr = INADDR_ANY; - fsp->myDataAddress.sin_port = 0; /* unique port will be assigned */ - fsp->myDataAddress.sin_len = sizeof(fsp->myDataAddress); - if (0 > bind(fsp->port_socket, - (struct sockaddr *)&(fsp->myDataAddress), - sizeof(fsp->myDataAddress))) { - eno = EBUSY; - } - else { - /* - * fetch port number of data socket - */ - memset(&(fsp->myDataAddress),sizeof(fsp->myDataAddress),0); - fsp->myDataAddress.sin_family = AF_INET; - fsp->myDataAddress.sin_addr.s_addr = INADDR_ANY; - fsp->myDataAddress.sin_port = 0; - fsp->myDataAddress.sin_len = sizeof(fsp->myDataAddress); - sockaddr_size = sizeof(fsp->myDataAddress); - if (0 > getsockname(fsp->port_socket, - (struct sockaddr *)&(fsp->myDataAddress), - &sockaddr_size)) { - eno = ENOMEM; - } - } - } - } - if (eno == 0) { - /* - * propagate data connection port to server - */ - my_ip = ntohl(fsp->myCtrlAddress.sin_addr.s_addr); - my_port = ntohs(fsp->myDataAddress.sin_port); - sprintf(port_buffer,"%s%u,%u,%u,%u,%u,%u\n", - FTP_PORT_CMD, - (my_ip >> 24) & 0x00ff, - (my_ip >> 16) & 0x00ff, - (my_ip >> 8) & 0x00ff, - (my_ip >> 0) & 0x00ff, - (my_port>> 8) & 0x00ff, - (my_port>> 0) & 0x00ff); -#ifdef DEBUG_OUT - write(1,port_buffer,strlen(port_buffer)); -#endif - if (0 > send(fsp->ctrl_socket,port_buffer,strlen(port_buffer),0)) { - eno = EIO; - } - else { - eno = rtems_ftp_get_message(fsp,&msg_tmp); - } - } - if (eno == 0) { - /* - * check for a "PORT command successful" reply - */ - if (msg_tmp != FTP_REPLY_SUCCESS) { - eno = EBUSY; - } - } - /* - * prepare port socket to listen for incoming connections - */ - if (eno == 0) { - if (0 > listen(fsp->port_socket,1)) { - eno = EBUSY; - } - } - if (eno == 0) { - /* - * send retrive/store command with filename - */ - if (is_write) { -#ifdef DEBUG_OUT - write(1,FTP_STOR_CMD,strlen(FTP_STOR_CMD)); - write(1,filename ,strlen(filename) ); - write(1,"\n",1); -#endif - if ((0 > send(fsp->ctrl_socket,FTP_STOR_CMD,strlen(FTP_STOR_CMD),0)) || - (0 > send(fsp->ctrl_socket,filename, strlen(filename), 0)) || - (0 > send(fsp->ctrl_socket,"\n", 1, 0))) { - eno = EIO; - } - } - else { -#ifdef DEBUG_OUT - write(1,FTP_RETR_CMD,strlen(FTP_RETR_CMD)); - write(1,filename ,strlen(filename) ); - write(1,"\n",1); -#endif - if ((0 > send(fsp->ctrl_socket,FTP_RETR_CMD,strlen(FTP_RETR_CMD),0)) || - (0 > send(fsp->ctrl_socket,filename, strlen(filename), 0)) || - (0 > send(fsp->ctrl_socket,"\n", 1, 0))) { - eno = EIO; - } - } - } -#if 1 - if (eno == 0) { - eno = rtems_ftp_get_message(fsp,&msg_tmp); - } - if (eno == 0) { - /* - * check for a "OPENING binary connection" reply - */ - if (msg_tmp != FTP_REPLY_OPENCONN) { - eno = EACCES; - } - } -#endif - /* - * wait for connect on data connection - * FIXME: this should become a select instead with a timeout - */ - if (eno == 0) { - sockaddr_size = sizeof(fsp->farDataAddress); - fsp->data_socket = accept(fsp->port_socket, - (struct sockaddr *)&(fsp->farDataAddress), - &sockaddr_size); - if (0 > fsp->data_socket) { - eno = EIO; - } - } - /* - * FIXME: check, that fardataAddr is really from our ftp server - */ - - /* - * clean up temp strings... - */ - if (uname != NULL) { - free(uname); - uname = NULL; - } - if (upass != NULL) { - free(upass); - upass = NULL; - } - if (hostname != NULL) { - free(hostname); - hostname = NULL; - } - if (filename != NULL) { - free(filename); - filename = NULL; - } - /* - * close part socket, no longer needed - */ - if (fsp->port_socket != -1) { - close(fsp->port_socket); - fsp->port_socket = -1; - } - /* - * if error, clean up everything - */ - if (eno != 0) { - if (fsp != NULL) { - /* - * check and close ctrl/data connection - */ - if (fsp->data_socket != -1) { - close(fsp->data_socket); - fsp->data_socket = -1; - } - if (fsp->ctrl_socket != -1) { - close(fsp->ctrl_socket); - fsp->ctrl_socket = -1; - } - /* - * free ftpStream structure - */ - ftpStreams[s] = NULL; - free(fsp); - fsp = NULL; - } - } - /* - * return sema, if still occupied - */ - if (sema_obtained) { - rtems_semaphore_release (ftp_mutex); - sema_obtained = FALSE; - } -#if 0 - if (eno != 0) { - set_errno_and_return_minus_one(eno); - } - return 0; -#else - return eno; -#endif -} - -/* - * Read from a FTP stream - */ -int rtems_ftp_read( - rtems_libio_t *iop, - void *buffer, - unsigned32 count -) -{ - int eno = 0; - struct ftpStream *fsp; - size_t want_cnt; - ssize_t rd_cnt; - int msg_tmp; - - fsp = iop->data1; - want_cnt = count; - /* - * check, that data connection present - */ - if (eno == 0) { - if ((fsp == NULL) || - (fsp->data_socket < 0)) { - eno = EBADF; - } - } - - /* - * perform read from data socket - * read multiple junks, if smaller than wanted - */ - while ((eno == 0) && - (want_cnt > 0) && - !(fsp->eof_reached) ) { - rd_cnt = read(fsp->data_socket,buffer,want_cnt); - if (rd_cnt > 0) { - buffer += rd_cnt; - want_cnt -= rd_cnt; - } - else { - eno = rtems_ftp_get_message(fsp,&msg_tmp); - fsp->eof_reached = TRUE; - if ((eno == 0) && - (msg_tmp != FTP_REPLY_TFERCMPL)) { - eno = EIO; - } - if (rd_cnt < 0) { - eno = EIO; - } - } - } - if (eno != 0) { - set_errno_and_return_minus_one(eno); - } - return count - want_cnt; -} - -int rtems_ftp_write( - rtems_libio_t *iop, - const void *buffer, - unsigned32 count -) -{ - int eno = EIO; - struct ftpStream *fsp; - size_t want_cnt; - ssize_t wr_cnt; - int msg_tmp; - - fsp = iop->data1; - want_cnt = count; - /* - * check, that data connection present - */ - if (eno == 0) { - if ((fsp == NULL) || - (fsp->data_socket < 0)) { - eno = EBADF; - } - } - - /* - * perform write to data socket - */ - if (eno == 0) { - wr_cnt = write(fsp->data_socket,buffer,want_cnt); - if (wr_cnt > 0) { - buffer += wr_cnt; - want_cnt -= wr_cnt; - } - else { - eno = rtems_ftp_get_message(fsp,&msg_tmp); - if ((eno == 0) && - (msg_tmp != FTP_REPLY_TFERCMPL)) { - eno = EIO; - } - if (wr_cnt < 0) { - eno = EIO; - } - } - } - if (eno != 0) { - set_errno_and_return_minus_one(eno); - } - return count - want_cnt; -} - -/* - * Close a FTP stream - */ -int rtems_ftp_close( - rtems_libio_t *iop -) -{ - int s = iop->data0; - struct ftpStream *fsp = iop->data1; - - /* - * close ctrl/data connection, if needed - */ - if (fsp->data_socket >= 0) { - close(fsp->data_socket); - fsp->data_socket = -1; - } - if (fsp->ctrl_socket >= 0) { - close(fsp->ctrl_socket); - fsp->ctrl_socket = -1; - } - /* - * free any used space... - */ - rtems_semaphore_obtain (ftp_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - free (ftpStreams[s]); - ftpStreams[s] = NULL; - rtems_semaphore_release (ftp_mutex); - - return 0; -} - -rtems_device_driver rtems_ftp_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp -) -{ - return RTEMS_NOT_CONFIGURED; -} - -/* - * Dummy version to let fopen(xxxx,"w") work properly. - */ -static int rtems_ftp_ftruncate( - rtems_libio_t *iop, - off_t count -) -{ - return 0; -} - -rtems_filesystem_node_types_t rtems_ftp_node_type( - rtems_filesystem_location_info_t *pathloc /* IN */ -) -{ - return RTEMS_FILESYSTEM_MEMORY_FILE; -} - -rtems_filesystem_operations_table rtems_ftp_ops = { - rtems_ftp_eval_path, /* eval_path */ - rtems_ftp_evaluate_for_make, /* evaluate_for_make */ - NULL, /* link */ - NULL, /* unlink */ - rtems_ftp_node_type, /* node_type */ - NULL, /* mknod */ - NULL, /* chown */ - NULL, /* freenodinfo */ - NULL, /* mount */ - rtems_ftp_mount_me, /* initialize */ - NULL, /* unmount */ - NULL, /* fsunmount */ - NULL, /* utime, */ - NULL, /* evaluate_link */ - NULL, /* symlink */ - NULL, /* readlin */ -}; - -rtems_filesystem_file_handlers_r rtems_ftp_handlers = { - rtems_ftp_open, /* open */ - rtems_ftp_close, /* close */ - rtems_ftp_read, /* read */ - rtems_ftp_write, /* write */ - NULL, /* ioctl */ - NULL, /* lseek */ - NULL, /* fstat */ - NULL, /* fchmod */ - rtems_ftp_ftruncate, /* ftruncate */ - NULL, /* fpathconf */ - NULL, /* fsync */ - NULL, /* fdatasync */ - NULL, /* fcntl */ - NULL /* rmnod */ -}; diff --git a/c/src/exec/libnetworking/lib/getprotoby.c b/c/src/exec/libnetworking/lib/getprotoby.c deleted file mode 100644 index cefa5c1ff2..0000000000 --- a/c/src/exec/libnetworking/lib/getprotoby.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id$ - */ - -#include -#include -#include -#include -#include - -static const struct protoent prototab[] = { - { "ip", NULL, IPPROTO_IP }, - { "icmp", NULL, IPPROTO_ICMP }, - { "tcp", NULL, IPPROTO_TCP }, - { "udp", NULL, IPPROTO_UDP }, - }; - -/* - * Dummy version of BSD getprotobyname() - */ -struct protoent * -getprotobyname_static (const char *name) -{ - int i; - - for (i = 0 ; i < (sizeof prototab / sizeof prototab[0]) ; i++) { - if (strcmp (name, prototab[i].p_name) == 0) - return (struct protoent *) &prototab[i]; - } - return NULL; -} - -/* - * Dummy version of BSD getprotobynumber() - */ -struct protoent * -getprotobynumber_static (int proto) -{ - int i; - - for (i = 0 ; i < (sizeof prototab / sizeof prototab[0]) ; i++) { - if (proto == prototab[i].p_proto) - return (struct protoent *) &prototab[i]; - } - return NULL; -} diff --git a/c/src/exec/libnetworking/lib/rtems_bsdnet_ntp.c b/c/src/exec/libnetworking/lib/rtems_bsdnet_ntp.c deleted file mode 100644 index 87514bd14c..0000000000 --- a/c/src/exec/libnetworking/lib/rtems_bsdnet_ntp.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Synchronize with an NTP server - * - * This program may be distributed and used for any purpose. - * I ask only that you: - * 1. Leave this author information intact. - * 2. Document any changes you make. - * - * W. Eric Norum - * Canadian Light Source - * University of Saskatchewan - * Saskatoon, Saskatchewan, CANADA - * eric@cls.usask.ca - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * RTEMS base: 1988, January 1 - * UNIX base: 1970, January 1 - * NTP base: 1900, January 1 - */ -#define UNIX_BASE_TO_NTP_BASE (((70UL*365UL)+17UL) * (24*60*60)) - -struct timestamp { - rtems_unsigned32 integer; - rtems_unsigned32 fraction; -}; - -struct ntpPacketSmall { - rtems_unsigned8 li_vn_mode; - rtems_unsigned8 stratum; - rtems_signed8 poll_interval; - rtems_signed8 precision; - rtems_signed32 root_delay; - rtems_signed32 root_dispersion; - char reference_identifier[4]; - struct timestamp reference_timestamp; - struct timestamp originate_timestamp; - struct timestamp receive_timestamp; - struct timestamp transmit_timestamp; -}; - -struct ntpPacket { - struct ntpPacketSmall ntp; - char authenticator[96]; -}; - -static int -processPacket (struct ntpPacketSmall *p) -{ - time_t tbuf; - struct tm *lt; - rtems_time_of_day rt; - rtems_interval ticks_per_second; - - if (((p->li_vn_mode & (0x7 << 3)) != (3 << 3)) - || ((p->transmit_timestamp.integer == 0) && (p->transmit_timestamp.fraction == 0))) - return 0; - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second); - tbuf = ntohl (p->transmit_timestamp.integer) - UNIX_BASE_TO_NTP_BASE - rtems_bsdnet_timeoffset; - lt = gmtime (&tbuf); - rt.year = lt->tm_year + 1900; - rt.month = lt->tm_mon + 1; - rt.day = lt->tm_mday; - rt.hour = lt->tm_hour; - rt.minute = lt->tm_min; - rt.second = lt->tm_sec; - rt.ticks = ntohl (p->transmit_timestamp.fraction) / (ULONG_MAX / ticks_per_second); - if (rt.ticks >= ticks_per_second) - rt.ticks = ticks_per_second - 1; - rtems_clock_set (&rt); - return 1; -} - -static int -tryServer (int i, int s) -{ - int l; - struct timeval tv; - int farlen; - struct sockaddr_in farAddr; - struct ntpPacketSmall packet; - - if (i < 0) - tv.tv_sec = 80; - else - tv.tv_sec = 5; - tv.tv_usec = 0; - if (setsockopt (s, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof tv) < 0) { - printf ("Can't set socket receive timeout: %s\n", strerror (errno)); - close (s); - return -1; - } - if (i >= 0) { - memset (&farAddr, 0, sizeof farAddr); - farAddr.sin_family = AF_INET; - farAddr.sin_port = htons (123); - farAddr.sin_addr = rtems_bsdnet_ntpserver[i]; - memset (&packet, 0, sizeof packet); - packet.li_vn_mode = (3 << 3) | 3; /* NTP version 3, client */ - l = sendto (s, &packet, sizeof packet, 0, (struct sockaddr *)&farAddr, sizeof farAddr); - if (l != sizeof packet) { - printf ("Can't send: %s\n", strerror (errno)); - return -1; - } - } - farlen = sizeof farAddr; - i = recvfrom (s, &packet, sizeof packet, 0, (struct sockaddr *)&farAddr, &farlen); - if (i == 0) - printf ("Unexpected EOF"); - if (i < 0) { - if ((errno == EWOULDBLOCK) || (errno == EAGAIN)) - return -1; - printf ("Can't receive: %s\n", strerror (errno)); - } - if ((i >= sizeof packet) && processPacket (&packet)) - return 0; - return -1; -} - -int -rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority) -{ - int s; - int i; - int retry; - struct sockaddr_in myAddr; - int reuseFlag; - int ret; - - if (interval != 0) { - printf ("Daemon-mode note yet supported.\n"); - errno = EINVAL; - return -1; - } - s = socket (AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - printf ("Can't create socket: %s\n", strerror (errno)); - return -1; - } - reuseFlag = 1; - if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseFlag, sizeof reuseFlag) < 0) { - printf ("Can't set socket reuse: %s\n", strerror (errno)); - close (s); - return -1; - } - memset (&myAddr, 0, sizeof myAddr); - myAddr.sin_family = AF_INET; - myAddr.sin_port = htons (123); - myAddr.sin_addr.s_addr = htonl (INADDR_ANY); - if (bind (s, (struct sockaddr *)&myAddr, sizeof myAddr) < 0) { - printf ("Can't bind socket: %s\n", strerror (errno)); - close (s); - return -1; - } - ret = -1; - for (retry = 0 ; (ret == -1) && (retry < 5) ; retry++) { - /* - * If there's no server we just have to wait - * and hope that there's an NTP broadcast - * server out there somewhere. - */ - if (rtems_bsdnet_ntpserver_count < 0) { - ret = tryServer (-1, s); - } - else { - for (i = 0 ; (ret == -1) && (i < rtems_bsdnet_ntpserver_count) ; i++) { - ret = tryServer (i, s); - } - } - } - close (s); - return ret; -} diff --git a/c/src/exec/libnetworking/lib/syslog.c b/c/src/exec/libnetworking/lib/syslog.c deleted file mode 100644 index 0bb15bc78e..0000000000 --- a/c/src/exec/libnetworking/lib/syslog.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * RTEMS version of syslog and associated routines - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -static int LogStatus = LOG_CONS; -static const char *LogTag = "syslog"; -static int LogFacility = LOG_USER; -static int LogMask = 0xff; - -static int LogFd = -1; -static rtems_id LogSemaphore; -extern struct in_addr rtems_bsdnet_log_host_address; - -#define SYSLOG_PORT 514 - -void -syslog (int pri, const char *fmt, ...) -{ - va_list ap; - - va_start (ap, fmt); - vsyslog (pri, fmt, ap); - va_end (ap); -} - -/* - * FIXME: Should cbuf be static? It could be if we put the mutex - * around the entire body of this routine. Then we wouldn't - * have to worry about blowing stacks with a local variable - * that large. Could make cbuf bigger, too. - */ -void -vsyslog (int pri, const char *fmt, va_list ap) -{ - int cnt; - char *cp; - char *msgp, cbuf[200]; - int sent; - - if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) { - syslog (LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID, - "syslog: unknown facility/priority: %#x", pri); - pri &= LOG_PRIMASK|LOG_FACMASK; - } - - if (!LOG_MASK(LOG_PRI(pri)) & LogMask) - return; - - if ((pri & LOG_FACMASK) == 0) - pri |= LogFacility; - - cnt = sprintf (cbuf, "<%d>", pri); - cp = msgp = cbuf + cnt; - if (LogTag) { - const char *lp = LogTag; - while ((*cp = *lp++) != '\0') - cp++; - } - if (LogStatus & LOG_PID) { - rtems_id tid; - rtems_task_ident (RTEMS_SELF, 0, &tid); - cnt = sprintf (cp, "[%#lx]", (unsigned long)tid); - cp += cnt; - } - if (LogTag) { - *cp++ = ':'; - *cp++ = ' '; - } - cnt = vsprintf (cp, fmt, ap); - cnt += cp - cbuf; - if (cbuf[cnt-1] == '\n') - cbuf[--cnt] = '\0'; - - if (LogStatus & LOG_PERROR) - printf ("%s\n", cbuf); - - /* - * Grab the mutex - */ - sent = 0; - if ((rtems_bsdnet_log_host_address.s_addr != INADDR_ANY) - && (LogFd >= 0) - && (rtems_semaphore_obtain (LogSemaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT) == RTEMS_SUCCESSFUL)) { - /* - * Set the destination address/port - */ - struct sockaddr_in farAddress; - farAddress.sin_family = AF_INET; - farAddress.sin_port = htons (SYSLOG_PORT); - farAddress.sin_addr = rtems_bsdnet_log_host_address; - memset (farAddress.sin_zero, '\0', sizeof farAddress.sin_zero); - - /* - * Send the message - */ - if (sendto (LogFd, cbuf, cnt, 0, (struct sockaddr *)&farAddress, sizeof farAddress) >= 0) - sent = 1; - rtems_semaphore_release (LogSemaphore); - } - if (!sent && (LogStatus & LOG_CONS) && !(LogStatus & LOG_PERROR)) - printf ("%s\n", msgp); -} - -void -openlog (const char *ident, int logstat, int logfac) -{ - rtems_status_code sc; - struct sockaddr_in myAddress; - - if (ident != NULL) - LogTag = ident; - LogStatus = logstat; - if (logfac != 0 && (logfac & ~LOG_FACMASK) == 0) - LogFacility = logfac; - - /* - * Create the socket - */ - if ((LogFd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { - printf ("Can't create syslog socket: %d\n", errno); - return; - } - - /* - * Bind socket to name - */ - myAddress.sin_family = AF_INET; - myAddress.sin_addr.s_addr = INADDR_ANY; - myAddress.sin_port = 0; - memset (myAddress.sin_zero, '\0', sizeof myAddress.sin_zero); - if (bind (LogFd, (struct sockaddr *)&myAddress, sizeof (myAddress)) < 0) { - close (LogFd); - LogFd = -1; - printf ("Can't bind syslog socket: %d\n", errno); - return; - } - - /* - * Create the mutex - */ - sc = rtems_semaphore_create (rtems_build_name('s', 'L', 'o', 'g'), - 1, - RTEMS_PRIORITY | - RTEMS_BINARY_SEMAPHORE | - RTEMS_INHERIT_PRIORITY | - RTEMS_NO_PRIORITY_CEILING | - RTEMS_LOCAL, - 0, - &LogSemaphore); - if (sc != RTEMS_SUCCESSFUL) { - printf ("Can't create syslog seamphore: %d\n", sc); - close (LogFd); - LogFd = -1; - } -} - -void -closelog(void) -{ - if (LogFd >= 0) { - close (LogFd); - LogFd = -1; - rtems_semaphore_delete (LogSemaphore); - } -} - -int -setlogmask (int pmask) -{ - int omask; - - omask = LogMask; - if (pmask != 0) - LogMask = pmask; - return (omask); -} diff --git a/c/src/exec/libnetworking/lib/tftpDriver.c b/c/src/exec/libnetworking/lib/tftpDriver.c deleted file mode 100644 index 52f51748a5..0000000000 --- a/c/src/exec/libnetworking/lib/tftpDriver.c +++ /dev/null @@ -1,1049 +0,0 @@ -/* - * vim: set expandtab tabstop=4 shiftwidth=4 ai : - * - * Trivial File Transfer Protocol (RFC 1350) - * - * Transfer file to/from remote host - * - * W. Eric Norum - * Saskatchewan Accelerator Laboratory - * University of Saskatchewan - * Saskatoon, Saskatchewan, CANADA - * eric@skatter.usask.ca - * - * $Id$ - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef RTEMS_TFTP_DRIVER_DEBUG -int rtems_tftp_driver_debug = 1; -#endif - -/* - * Range of UDP ports to try - */ -#define UDP_PORT_BASE 3180 - -/* - * Pathname prefix - */ -#define TFTP_PATHNAME_PREFIX "/TFTP/" - -/* - * Root node_access value - * By using the address of a local static variable - * we ensure a unique value for this identifier. - */ -#define ROOT_NODE_ACCESS (&tftp_mutex) - -/* - * Default limits - */ -#define PACKET_FIRST_TIMEOUT_MILLISECONDS 400 -#define PACKET_TIMEOUT_MILLISECONDS 6000 -#define OPEN_RETRY_LIMIT 10 -#define IO_RETRY_LIMIT 10 - -/* - * TFTP opcodes - */ -#define TFTP_OPCODE_RRQ 1 -#define TFTP_OPCODE_WRQ 2 -#define TFTP_OPCODE_DATA 3 -#define TFTP_OPCODE_ACK 4 -#define TFTP_OPCODE_ERROR 5 - -/* - * Largest data transfer - */ -#define TFTP_BUFSIZE 512 - -/* - * Packets transferred between machines - */ -union tftpPacket { - /* - * RRQ/WRQ packet - */ - struct tftpRWRQ { - rtems_unsigned16 opcode; - char filename_mode[TFTP_BUFSIZE]; - } tftpRWRQ; - - /* - * DATA packet - */ - struct tftpDATA { - rtems_unsigned16 opcode; - rtems_unsigned16 blocknum; - rtems_unsigned8 data[TFTP_BUFSIZE]; - } tftpDATA; - - /* - * ACK packet - */ - struct tftpACK { - rtems_unsigned16 opcode; - rtems_unsigned16 blocknum; - } tftpACK; - - /* - * ERROR packet - */ - struct tftpERROR { - rtems_unsigned16 opcode; - rtems_unsigned16 errorCode; - char errorMessage[TFTP_BUFSIZE]; - } tftpERROR; -}; - -/* - * State of each TFTP stream - */ -struct tftpStream { - /* - * Buffer for storing most recently-received packet - */ - union tftpPacket pkbuf; - - /* - * Last block number transferred - */ - rtems_unsigned16 blocknum; - - /* - * Data transfer socket - */ - int socket; - struct sockaddr_in myAddress; - struct sockaddr_in farAddress; - - /* - * Indices into buffer - */ - int nleft; - int nused; - - /* - * Flags - */ - int firstReply; - int eof; - int writing; -}; - -/* - * Number of streams open at the same time - */ -static rtems_id tftp_mutex; -static int nStreams; -static struct tftpStream ** volatile tftpStreams; - -typedef const char *tftp_node; -extern rtems_filesystem_operations_table rtems_tftp_ops; -extern rtems_filesystem_file_handlers_r rtems_tftp_handlers; - -/* - * Direct copy from the IMFS. Look at this. - */ - -rtems_filesystem_limits_and_options_t rtems_tftp_limits_and_options = { - 5, /* link_max */ - 6, /* max_canon */ - 7, /* max_input */ - 255, /* name_max */ - 255, /* path_max */ - 2, /* pipe_buf */ - 1, /* posix_async_io */ - 2, /* posix_chown_restrictions */ - 3, /* posix_no_trunc */ - 4, /* posix_prio_io */ - 5, /* posix_sync_io */ - 6 /* posix_vdisable */ -}; - -static int rtems_tftp_mount_me( - rtems_filesystem_mount_table_entry_t *temp_mt_entry -) -{ - rtems_status_code sc; - - temp_mt_entry->mt_fs_root.handlers = &rtems_tftp_handlers; - temp_mt_entry->mt_fs_root.ops = &rtems_tftp_ops; - - /* - * We have no tftp filesystem specific data to maintain. This - * filesystem may only be mounted ONCE. - * - * And we maintain no real filesystem nodes, so there is no real root. - */ - - temp_mt_entry->fs_info = NULL; - temp_mt_entry->mt_fs_root.node_access = ROOT_NODE_ACCESS; - - /* - * These need to be looked at for full POSIX semantics. - */ - - temp_mt_entry->pathconf_limits_and_options = rtems_tftp_limits_and_options; - - - /* - * Now allocate a semaphore for mutual exclusion. - * - * NOTE: This could be in an fsinfo for this filesystem type. - */ - - sc = rtems_semaphore_create ( - rtems_build_name('T', 'F', 'T', 'P'), - 1, - RTEMS_FIFO | - RTEMS_BINARY_SEMAPHORE | - RTEMS_NO_INHERIT_PRIORITY | - RTEMS_NO_PRIORITY_CEILING | - RTEMS_LOCAL, - 0, - &tftp_mutex - ); - - if (sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one( ENOMEM ); - - return 0; -} - -/* - * Initialize the TFTP driver - */ - -int rtems_bsdnet_initialize_tftp_filesystem () -{ - int status; - rtems_filesystem_mount_table_entry_t *entry; - - status = mkdir( TFTP_PATHNAME_PREFIX, S_IRWXU | S_IRWXG | S_IRWXO ); - if ( status == -1 ) - return status; - - status = mount( - &entry, - &rtems_tftp_ops, - RTEMS_FILESYSTEM_READ_WRITE, - NULL, - TFTP_PATHNAME_PREFIX - ); - - if ( status ) - perror( "TFTP mount failed" ); - - return status; -} - -/* - * Map error message - */ -static int -tftpErrno (struct tftpStream *tp) -{ - unsigned int tftpError; - static const int errorMap[] = { - EINVAL, - ENOENT, - EPERM, - ENOSPC, - EINVAL, - ENXIO, - EEXIST, - ESRCH, - }; - - tftpError = ntohs (tp->pkbuf.tftpERROR.errorCode); - if (tftpError < (sizeof errorMap / sizeof errorMap[0])) - return errorMap[tftpError]; - else - return 1000 + tftpError; -} - -/* - * Send a message to make the other end shut up - */ -static void -sendStifle (struct tftpStream *tp, struct sockaddr_in *to) -{ - int len; - struct { - rtems_unsigned16 opcode; - rtems_unsigned16 errorCode; - char errorMessage[12]; - } msg; - - /* - * Create the error packet (Unknown transfer ID). - */ - msg.opcode = htons (TFTP_OPCODE_ERROR); - msg.errorCode = htons (5); - len = sizeof msg.opcode + sizeof msg.errorCode + 1; - len += sprintf (msg.errorMessage, "GO AWAY"); - - /* - * Send it - */ - sendto (tp->socket, (char *)&msg, len, 0, (struct sockaddr *)to, sizeof *to); -} - -/* - * Wait for a data packet - */ -static int -getPacket (struct tftpStream *tp, int retryCount) -{ - int len; - struct timeval tv; - - if (retryCount == 0) { - tv.tv_sec = PACKET_FIRST_TIMEOUT_MILLISECONDS / 1000; - tv.tv_usec = (PACKET_FIRST_TIMEOUT_MILLISECONDS % 1000) * 1000; - } - else { - tv.tv_sec = PACKET_TIMEOUT_MILLISECONDS / 1000; - tv.tv_usec = (PACKET_TIMEOUT_MILLISECONDS % 1000) * 1000; - } - setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv); - for (;;) { - union { - struct sockaddr s; - struct sockaddr_in i; - } from; - int fromlen = sizeof from; - len = recvfrom (tp->socket, (char *)&tp->pkbuf, - sizeof tp->pkbuf, 0, - &from.s, &fromlen); - if (len < 0) - break; - if (from.i.sin_addr.s_addr == tp->farAddress.sin_addr.s_addr) { - if (tp->firstReply) { - tp->firstReply = 0; - tp->farAddress.sin_port = from.i.sin_port; - } - if (tp->farAddress.sin_port == from.i.sin_port) - break; - } - - /* - * Packet is from someone with whom we are - * not interested. Tell them to go away. - */ - sendStifle (tp, &from.i); - } - tv.tv_sec = 0; - tv.tv_usec = 0; - setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv); -#ifdef RTEMS_TFTP_DRIVER_DEBUG - if (rtems_tftp_driver_debug) { - if (len >= (int) sizeof tp->pkbuf.tftpACK) { - int opcode = ntohs (tp->pkbuf.tftpDATA.opcode); - switch (opcode) { - default: - printf ("TFTP: OPCODE %d\n", opcode); - break; - - case TFTP_OPCODE_DATA: - printf ("TFTP: RECV %d\n", ntohs (tp->pkbuf.tftpDATA.blocknum)); - break; - - case TFTP_OPCODE_ACK: - printf ("TFTP: GOT ACK %d\n", ntohs (tp->pkbuf.tftpACK.blocknum)); - break; - } - } - else { - printf ("TFTP: %d-byte packet\n", len); - } - } -#endif - return len; -} - -/* - * Send an acknowledgement - */ -static int -sendAck (struct tftpStream *tp) -{ -#ifdef RTEMS_TFTP_DRIVER_DEBUG - if (rtems_tftp_driver_debug) - printf ("TFTP: ACK %d\n", tp->blocknum); -#endif - - /* - * Create the acknowledgement - */ - tp->pkbuf.tftpACK.opcode = htons (TFTP_OPCODE_ACK); - tp->pkbuf.tftpACK.blocknum = htons (tp->blocknum); - - /* - * Send it - */ - if (sendto (tp->socket, (char *)&tp->pkbuf, sizeof tp->pkbuf.tftpACK, 0, - (struct sockaddr *)&tp->farAddress, - sizeof tp->farAddress) < 0) - return errno; - return 0; -} - -/* - * Release a stream and clear the pointer to it - */ -static void -releaseStream (int s) -{ - rtems_semaphore_obtain (tftp_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - free (tftpStreams[s]); - tftpStreams[s] = NULL; - rtems_semaphore_release (tftp_mutex); -} - -static int rtems_tftp_evaluate_for_make( - const char *path, /* IN */ - rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ - const char **name /* OUT */ -) -{ - pathloc->node_access = NULL; - rtems_set_errno_and_return_minus_one( EIO ); -} - -/* - * Convert a path to canonical form - */ -static void -fixPath (char *path) -{ - char *inp, *outp, *base; - - outp = inp = path; - base = NULL; - for (;;) { - if (inp[0] == '.') { - if (inp[1] == '\0') - break; - if (inp[1] == '/') { - inp += 2; - continue; - } - if (inp[1] == '.') { - if (inp[2] == '\0') { - if ((base != NULL) && (outp > base)) { - outp--; - while ((outp > base) && (outp[-1] != '/')) - outp--; - } - break; - } - if (inp[2] == '/') { - inp += 3; - if (base == NULL) - continue; - if (outp > base) { - outp--; - while ((outp > base) && (outp[-1] != '/')) - outp--; - } - continue; - } - } - } - if (base == NULL) - base = inp; - while (inp[0] != '/') { - if ((*outp++ = *inp++) == '\0') - return; - } - *outp++ = '/'; - while (inp[0] == '/') - inp++; - } - *outp = '\0'; - return; -} - -static int rtems_tftp_eval_path( - const char *pathname, /* IN */ - int flags, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */ -) -{ - pathloc->handlers = &rtems_tftp_handlers; - - /* - * Hack to provide the illusion of directories inside the TFTP file system. - * Paths ending in a / are assumed to be directories. - */ - if (pathname[strlen(pathname)-1] == '/') { - int isRelative = (pathloc->node_access != ROOT_NODE_ACCESS); - char *cp; - - /* - * Reject attempts to open() directories - */ - if (flags & RTEMS_LIBIO_PERMS_RDWR) - rtems_set_errno_and_return_minus_one( EISDIR ); - if (isRelative) { - cp = malloc (strlen(pathloc->node_access)+strlen(pathname)+1); - if (cp == NULL) - rtems_set_errno_and_return_minus_one( ENOMEM ); - strcpy (cp, pathloc->node_access); - strcat (cp, pathname); - } - else { - cp = strdup (pathname); - if (cp == NULL) - rtems_set_errno_and_return_minus_one( ENOMEM ); - } - fixPath (cp); - pathloc->node_access = cp; - return 0; - } - if (pathloc->node_access != ROOT_NODE_ACCESS) - pathloc->node_access = 0; - - /* - * Reject it if it's not read-only or write-only. - */ - flags &= RTEMS_LIBIO_PERMS_READ | RTEMS_LIBIO_PERMS_WRITE; - if ((flags != RTEMS_LIBIO_PERMS_READ) && (flags != RTEMS_LIBIO_PERMS_WRITE) ) - rtems_set_errno_and_return_minus_one( EINVAL ); - return 0; -} - -/* - * The routine which does most of the work for the IMFS open handler - */ -static int rtems_tftp_open_worker( - rtems_libio_t *iop, - char *full_path_name, - unsigned32 flags, - unsigned32 mode -) -{ - struct tftpStream *tp; - int retryCount; - struct in_addr farAddress; - int s; - int len; - char *cp1; - char *cp2; - char *remoteFilename; - rtems_interval now; - rtems_status_code sc; - char *hostname; - - /* - * Extract the host name component - */ - cp2 = full_path_name; - while (*cp2 == '/') - cp2++; - hostname = cp2; - while (*cp2 != '/') { - if (*cp2 == '\0') - return ENOENT; - cp2++; - } - *cp2++ = '\0'; - - /* - * Convert hostname to Internet address - */ - if (strcmp (hostname, "BOOTP_HOST") == 0) - farAddress = rtems_bsdnet_bootp_server_address; - else - farAddress.s_addr = inet_addr (hostname); - if ((farAddress.s_addr == 0) || (farAddress.s_addr == ~0)) - return ENOENT; - - /* - * Extract file pathname component - */ - while (*cp2 == '/') - cp2++; - if (strcmp (cp2, "BOOTP_FILE") == 0) { - cp2 = rtems_bsdnet_bootp_boot_file_name; - while (*cp2 == '/') - cp2++; - } - if (*cp2 == '\0') - return ENOENT; - remoteFilename = cp2; - if (strlen (remoteFilename) > (TFTP_BUFSIZE - 10)) - return ENOENT; - - /* - * Find a free stream - */ - sc = rtems_semaphore_obtain (tftp_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - return EBUSY; - for (s = 0 ; s < nStreams ; s++) { - if (tftpStreams[s] == NULL) - break; - } - if (s == nStreams) { - /* - * Reallocate stream pointers - * Guard against the case where realloc() returns NULL. - */ - struct tftpStream **np; - - np = realloc (tftpStreams, ++nStreams * sizeof *tftpStreams); - if (np == NULL) { - rtems_semaphore_release (tftp_mutex); - return ENOMEM; - } - tftpStreams = np; - } - tp = tftpStreams[s] = malloc (sizeof (struct tftpStream)); - rtems_semaphore_release (tftp_mutex); - if (tp == NULL) - return ENOMEM; - iop->data0 = s; - iop->data1 = tp; - - /* - * Create the socket - */ - if ((tp->socket = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { - releaseStream (s); - return ENOMEM; - } - - /* - * Bind the socket to a local address - */ - retryCount = 0; - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); - for (;;) { - int try = (now + retryCount) % 10; - - tp->myAddress.sin_family = AF_INET; - tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + s); - tp->myAddress.sin_addr.s_addr = htonl (INADDR_ANY); - if (bind (tp->socket, (struct sockaddr *)&tp->myAddress, sizeof tp->myAddress) >= 0) - break; - if (++retryCount == 10) { - close (tp->socket); - releaseStream (s); - return EBUSY; - } - } - - /* - * Set the UDP destination to the TFTP server - * port on the remote machine. - */ - tp->farAddress.sin_family = AF_INET; - tp->farAddress.sin_addr = farAddress; - tp->farAddress.sin_port = htons (69); - - /* - * Start the transfer - */ - tp->firstReply = 1; - retryCount = 0; - for (;;) { - /* - * Create the request - */ - if ((flags & O_ACCMODE) == O_RDONLY) { - tp->writing = 0; - tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_RRQ); - } - else { - tp->writing = 1; - tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_WRQ); - } - cp1 = (char *) tp->pkbuf.tftpRWRQ.filename_mode; - cp2 = (char *) remoteFilename; - while ((*cp1++ = *cp2++) != '\0') - continue; - cp2 = "octet"; - while ((*cp1++ = *cp2++) != '\0') - continue; - len = cp1 - (char *)&tp->pkbuf.tftpRWRQ; - - /* - * Send the request - */ - if (sendto (tp->socket, (char *)&tp->pkbuf, len, 0, - (struct sockaddr *)&tp->farAddress, - sizeof tp->farAddress) < 0) { - close (tp->socket); - releaseStream (s); - return EIO; - } - - /* - * Get reply - */ - len = getPacket (tp, retryCount); - if (len >= (int) sizeof tp->pkbuf.tftpACK) { - int opcode = ntohs (tp->pkbuf.tftpDATA.opcode); - if (!tp->writing - && (opcode == TFTP_OPCODE_DATA) - && (ntohs (tp->pkbuf.tftpDATA.blocknum) == 1)) { - tp->nused = 0; - tp->blocknum = 1; - tp->nleft = len - 2 * sizeof (rtems_unsigned16); - tp->eof = (tp->nleft < TFTP_BUFSIZE); - if (sendAck (tp) != 0) { - close (tp->socket); - releaseStream (s); - return EIO; - } - break; - } - if (tp->writing - && (opcode == TFTP_OPCODE_ACK) - && (ntohs (tp->pkbuf.tftpACK.blocknum) == 0)) { - tp->nused = 0; - tp->blocknum = 1; - break; - } - if (opcode == TFTP_OPCODE_ERROR) { - int e = tftpErrno (tp); - close (tp->socket); - releaseStream (s); - return e; - } - } - - /* - * Keep trying - */ - if (++retryCount >= OPEN_RETRY_LIMIT) { - close (tp->socket); - releaseStream (s); - return EIO; - } - } - return 0; -} - -/* - * The IMFS open handler - */ -static int rtems_tftp_open( - rtems_libio_t *iop, - const char *new_name, - unsigned32 flags, - unsigned32 mode -) -{ - char *full_path_name; - char *s1; - int err; - - /* - * Tack the `current directory' on to relative paths. - * We know that the current directory ends in a / character. - */ - if (*new_name == '/') { - /* - * Skip the TFTP filesystem prefix. - */ - int len = strlen (TFTP_PATHNAME_PREFIX); - if (strncmp (new_name, TFTP_PATHNAME_PREFIX, len)) - return ENOENT; - new_name += len; - s1 = ""; - } - else { - s1 = rtems_filesystem_current.node_access; - } - full_path_name = malloc (strlen (s1) + strlen (new_name) + 1); - if (full_path_name == NULL) - return ENOMEM; - strcpy (full_path_name, s1); - strcat (full_path_name, new_name); - fixPath (full_path_name); - err = rtems_tftp_open_worker (iop, full_path_name, flags, mode); - free (full_path_name); - return err; -} - -/* - * Read from a TFTP stream - */ -static int rtems_tftp_read( - rtems_libio_t *iop, - void *buffer, - unsigned32 count -) -{ - char *bp; - struct tftpStream *tp = iop->data1; - int retryCount; - int nwant; - - - /* - * Read till user request is satisfied or EOF is reached - */ - bp = buffer; - nwant = count; - while (nwant) { - if (tp->nleft) { - int ncopy; - if (nwant < tp->nleft) - ncopy = nwant; - else - ncopy = tp->nleft; - memcpy (bp, &tp->pkbuf.tftpDATA.data[tp->nused], ncopy); - tp->nused += ncopy; - tp->nleft -= ncopy; - bp += ncopy; - nwant -= ncopy; - if (nwant == 0) - break; - } - if (tp->eof) - break; - - /* - * Wait for the next packet - */ - retryCount = 0; - for (;;) { - int len = getPacket (tp, retryCount); - if (len >= (int)sizeof tp->pkbuf.tftpACK) { - int opcode = ntohs (tp->pkbuf.tftpDATA.opcode); - rtems_unsigned16 nextBlock = tp->blocknum + 1; - if ((opcode == TFTP_OPCODE_DATA) - && (ntohs (tp->pkbuf.tftpDATA.blocknum) == nextBlock)) { - tp->nused = 0; - tp->nleft = len - 2 * sizeof (rtems_unsigned16); - tp->eof = (tp->nleft < TFTP_BUFSIZE); - tp->blocknum++; - if (sendAck (tp) != 0) - rtems_set_errno_and_return_minus_one( EIO ); - break; - } - if (opcode == TFTP_OPCODE_ERROR) - rtems_set_errno_and_return_minus_one( tftpErrno (tp) ); - } - - /* - * Keep trying? - */ - if (++retryCount == IO_RETRY_LIMIT) - rtems_set_errno_and_return_minus_one( EIO ); - if (sendAck (tp) != 0) - rtems_set_errno_and_return_minus_one( EIO ); - } - } - return count - nwant; -} - -/* - * Flush a write buffer and wait for acknowledgement - */ -static int rtems_tftp_flush ( struct tftpStream *tp ) -{ - int wlen, rlen; - int retryCount = 0; - - wlen = tp->nused + 2 * sizeof (rtems_unsigned16); - for (;;) { - tp->pkbuf.tftpDATA.opcode = htons (TFTP_OPCODE_DATA); - tp->pkbuf.tftpDATA.blocknum = htons (tp->blocknum); -#ifdef RTEMS_TFTP_DRIVER_DEBUG - if (rtems_tftp_driver_debug) - printf ("TFTP: SEND %d (%d)\n", tp->blocknum, tp->nused); -#endif - if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0, - (struct sockaddr *)&tp->farAddress, - sizeof tp->farAddress) < 0) - return EIO; - rlen = getPacket (tp, retryCount); - /* - * Our last packet won't necessarily be acknowledged! - */ - if ((rlen < 0) && (tp->nused < sizeof tp->pkbuf.tftpDATA.data)) - return 0; - if (rlen >= (int)sizeof tp->pkbuf.tftpACK) { - int opcode = ntohs (tp->pkbuf.tftpACK.opcode); - if ((opcode == TFTP_OPCODE_ACK) - && (ntohs (tp->pkbuf.tftpACK.blocknum) == tp->blocknum)) { - tp->nused = 0; - tp->blocknum++; - return 0; - } - if (opcode == TFTP_OPCODE_ERROR) - return tftpErrno (tp); - } - - /* - * Keep trying? - */ - if (++retryCount == IO_RETRY_LIMIT) - return EIO; - } -} - -/* - * Close a TFTP stream - */ -static int rtems_tftp_close( - rtems_libio_t *iop -) -{ - struct tftpStream *tp = iop->data1;; - - if (tp->writing) - rtems_tftp_flush (tp); - if (!tp->eof && !tp->firstReply) { - /* - * Tell the other end to stop - */ - rtems_interval ticksPerSecond; - sendStifle (tp, &tp->farAddress); - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond); - rtems_task_wake_after (1 + ticksPerSecond / 10); - } - close (tp->socket); - releaseStream (iop->data0); - return RTEMS_SUCCESSFUL; -} - -static int rtems_tftp_write( - rtems_libio_t *iop, - const void *buffer, - unsigned32 count -) -{ - const char *bp; - struct tftpStream *tp = iop->data1; - int nleft, nfree, ncopy; - - /* - * Bail out if an error has occurred - */ - if (!tp->writing) - return EIO; - - - /* - * Write till user request is satisfied - * Notice that the buffer is flushed as soon as it is filled rather - * than waiting for the next write or a close. This ensures that - * the flush in close writes a less than full buffer so the far - * end can detect the end-of-file condition. - */ - bp = buffer; - nleft = count; - while (nleft) { - nfree = sizeof tp->pkbuf.tftpDATA.data - tp->nused; - if (nleft < nfree) - ncopy = nleft; - else - ncopy = nfree; - memcpy (&tp->pkbuf.tftpDATA.data[tp->nused], bp, ncopy); - tp->nused += ncopy; - nleft -= ncopy; - bp += ncopy; - if (tp->nused == sizeof tp->pkbuf.tftpDATA.data) { - int e = rtems_tftp_flush (tp); - if (e) { - tp->writing = 0; - rtems_set_errno_and_return_minus_one (e); - } - } - } - return count; -} - -/* - * Dummy version to let fopen(xxxx,"w") work properly. - */ -static int rtems_tftp_ftruncate( - rtems_libio_t *iop, - off_t count -) -{ - return 0; -} - -static rtems_filesystem_node_types_t rtems_tftp_node_type( - rtems_filesystem_location_info_t *pathloc /* IN */ -) -{ - if ((pathloc->node_access == NULL) - || (pathloc->node_access == ROOT_NODE_ACCESS)) - return RTEMS_FILESYSTEM_MEMORY_FILE; - return RTEMS_FILESYSTEM_DIRECTORY; -} - -static int rtems_tftp_free_node_info( - rtems_filesystem_location_info_t *pathloc /* IN */ -) -{ - if (pathloc->node_access && (pathloc->node_access != ROOT_NODE_ACCESS)) { - free (pathloc->node_access); - pathloc->node_access = NULL; - } - return 0; -} - - -rtems_filesystem_operations_table rtems_tftp_ops = { - rtems_tftp_eval_path, /* eval_path */ - rtems_tftp_evaluate_for_make, /* evaluate_for_make */ - NULL, /* link */ - NULL, /* unlink */ - rtems_tftp_node_type, /* node_type */ - NULL, /* mknod */ - NULL, /* chown */ - rtems_tftp_free_node_info, /* freenodinfo */ - NULL, /* mount */ - rtems_tftp_mount_me, /* initialize */ - NULL, /* unmount */ - NULL, /* fsunmount */ - NULL, /* utime, */ - NULL, /* evaluate_link */ - NULL, /* symlink */ - NULL, /* readlin */ -}; - -rtems_filesystem_file_handlers_r rtems_tftp_handlers = { - rtems_tftp_open, /* open */ - rtems_tftp_close, /* close */ - rtems_tftp_read, /* read */ - rtems_tftp_write, /* write */ - NULL, /* ioctl */ - NULL, /* lseek */ - NULL, /* fstat */ - NULL, /* fchmod */ - rtems_tftp_ftruncate, /* ftruncate */ - NULL, /* fpathconf */ - NULL, /* fsync */ - NULL, /* fdatasync */ - NULL, /* fcntl */ - NULL /* rmnod */ -}; diff --git a/c/src/exec/libnetworking/libc/.cvsignore b/c/src/exec/libnetworking/libc/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/exec/libnetworking/libc/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/exec/libnetworking/libc/Makefile.am b/c/src/exec/libnetworking/libc/Makefile.am deleted file mode 100644 index e007445c13..0000000000 --- a/c/src/exec/libnetworking/libc/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -## -## $Id$ -## - - -LIBNAME = lib.a -LIB = $(ARCH)/$(LIBNAME) - -C_FILES = addr2ascii.c ascii2addr.c base64.c gethostbydns.c gethostbyht.c \ - gethostbynis.c gethostnamadr.c getnetbydns.c getnetbyht.c getnetbynis.c \ - getnetnamadr.c getproto.c getprotoent.c getprotoname.c getservbyname.c \ - getservbyport.c getservent.c herror.c inet_addr.c inet_lnaof.c \ - inet_makeaddr.c inet_netof.c inet_network.c inet_ntoa.c inet_ntop.c \ - inet_pton.c linkaddr.c map_v4v6.c nsap_addr.c ns_name.c ns_netint.c \ - ns_parse.c ns_print.c ns_ttl.c res_comp.c res_data.c res_debug.c \ - res_init.c res_mkquery.c res_mkupdate.c res_query.c res_send.c \ - res_stubs.c res_update.c strsep.c rcmd.c -C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) - -OBJS = $(C_O_FILES) - -include $(top_srcdir)/../automake/multilib.am -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/lib.am - -man_MANS = addr2ascii.3 byteorder.3 ethers.3 gethostbyname.3 getnetent.3 \ - getprotoent.3 getservent.3 inet.3 iso_addr.3 linkaddr.3 ns.3 rcmd.3 \ - resolver.3 - -# -# Add local stuff here using += -# - -AM_CPPFLAGS += -DNOPOLL -DNOSELECT - -$(LIB): $(OBJS) - $(make-library) - -all-local: $(ARCH) $(OBJS) $(LIB) - -.PRECIOUS: $(LIB) - -EXTRA_DIST = addr2ascii.3 addr2ascii.c ascii2addr.c base64.c byteorder.3 \ - ether_addr.c ethers.3 gethostbydns.c gethostbyht.c gethostbyname.3 \ - gethostbynis.c gethostnamadr.c gethostname.c getnetbydns.c getnetbyht.c \ - getnetbynis.c getnetent.3 getnetnamadr.c getproto.c getprotoent.3 \ - getprotoent.c getprotoname.c getservbyname.c getservbyport.c \ - getservent.3 getservent.c herror.c inet.3 inet_addr.c inet_lnaof.c \ - inet_makeaddr.c inet_net_ntop.c inet_net_pton.c inet_neta.c inet_netof.c \ - inet_network.c inet_ntoa.c inet_ntop.c inet_pton.c map_v4v6.c linkaddr.3 \ - linkaddr.c ns.3 ns_addr.c ns_name.c ns_netint.c ns_ntoa.c ns_parse.c \ - ns_print.c ns_ttl.c nsap_addr.c rcmd.3 rcmd.c recv.c res_comp.c \ - res_config.h res_data.c res_debug.c res_init.c res_mkquery.c \ - res_mkupdate.c res_query.c res_send.c res_stubs.c res_update.c \ - resolver.3 send.c strsep.c - -include $(top_srcdir)/../automake/local.am diff --git a/c/src/exec/libnetworking/libc/addr2ascii.3 b/c/src/exec/libnetworking/libc/addr2ascii.3 deleted file mode 100644 index 10c839ea74..0000000000 --- a/c/src/exec/libnetworking/libc/addr2ascii.3 +++ /dev/null @@ -1,217 +0,0 @@ -.\" -.\" Copyright 1996 Massachusetts Institute of Technology -.\" -.\" Permission to use, copy, modify, and distribute this software and -.\" its documentation for any purpose and without fee is hereby -.\" granted, provided that both the above copyright notice and this -.\" permission notice appear in all copies, that both the above -.\" copyright notice and this permission notice appear in all -.\" supporting documentation, and that the name of M.I.T. not be used -.\" in advertising or publicity pertaining to distribution of the -.\" software without specific, written prior permission. M.I.T. makes -.\" no representations about the suitability of this software for any -.\" purpose. It is provided "as is" without express or implied -.\" warranty. -.\" -.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS -.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, -.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT -.\" SHALL M.I.T. 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. -.\" -.\" $ANA: addr2ascii.3,v 1.1 1996/06/13 18:41:46 wollman Exp $ -.\" $Id$ -.\" -.Dd June 13, 1996 -.Dt ADDR2ASCII 3 -.Os -.Sh NAME -.Nm addr2ascii , -.Nm ascii2addr -.Nd Generic address formatting routines -.Sh SYNOPSIS -.Fd #include -.Fd #include -.Fd #include -.Ft "char *" -.Fn addr2ascii "int af" "const void *addrp" "int len" "char *buf" -.Ft int -.Fn ascii2addr "int af" "const char *ascii" "void *result" -.Sh DESCRIPTION -The routines -.Fn addr2ascii -and -.Fn ascii2addr -are used to convert network addresses between binary form and a -printable form appropriate to the address family. Both functions take -an -.Fa af -argument, specifying the address family to be used in the conversion -process. -(Currently, only the -.Dv AF_INET -and -.Dv AF_LINK -address families are supported.) -.Pp -The -.Fn addr2ascii -function -is used to convert binary, network-format addresses into printable -form. In addition to -.Fa af , -there are three other arguments. The -.Fa addrp -argument is a pointer to the network address to be converted. -The -.Fa len -argument is the length of the address. The -.Fa buf -argument is an optional pointer to a caller-allocated buffer to hold -the result; if a null pointer is passed, -.Fn addr2ascii -uses a statically-allocated buffer. -.Pp -The -.Fn ascii2addr -function performs the inverse operation to -.Fn addr2ascii . -In addition to -.Fa af , -it takes two parameters, -.Fa ascii -and -.Fa result . -The -.Fa ascii -parameter is a pointer to the string which is to be converted into -binary. The -.Fa result -parameter is a pointer to an appropriate network address structure for -the specified family. -.Pp -The following gives the appropriate structure to use for binary -addresses in the specified family: -.Pp -.Bl -tag -width AF_INETxxxx -compact -.It Dv AF_INET -.Li struct in_addr -.Pq in Aq Pa netinet/in.h -.It Dv AF_LINK -.Li struct sockaddr_dl -.Pq in Aq Pa net/if_dl.h -.\" .It Dv AF_INET6 -.\" .Li struct in6_addr -.\" .Pq in Aq Pa netinet6/in6.h -.El -.Sh RETURN VALUES -The -.Fn addr2ascii -function returns the address of the buffer it was passed, or a static -buffer if the a null pointer was passed; on failure, it returns a null -pointer. -The -.Fn ascii2addr -function returns the length of the binary address in bytes, or -1 on -failure. -.Sh EXAMPLES -The -.Xr inet 3 -functions -.Fn inet_ntoa -and -.Fn inet_aton -could be implemented thusly: -.Bd -literal -offset indent -#include -#include -#include -#include - -char * -inet_ntoa(struct in_addr addr) -{ - return addr2ascii(AF_INET, &addr, sizeof addr, 0); -} - -int -inet_aton(const char *ascii, struct in_addr *addr) -{ - return (ascii2addr(AF_INET, ascii, addr) - == sizeof(*addr)); -} -.Ed -.Pp -In actuality, this cannot be done because -.Fn addr2ascii -and -.Fn ascii2addr -are implemented in terms of the -.Xr inet 3 -functions, rather than the other way around. -.Sh ERRORS -When a failure is returned, -.Li errno -is set to one of the following values: -.Bl -tag -width [EPROTONOSUPPORT] -.It Bq Er ENAMETOOLONG -The -.Fn addr2ascii -routine was passed a -.Fa len -parameter which was inappropriate for the address family given by -.Fa af . -.It Bq Er EPROTONOSUPPORT -Either routine was passed an -.Fa af -parameter other than -.Dv AF_INET -or -.Dv AF_LINK . -.It Bq Er EINVAL -The string passed to -.Fn ascii2addr -was improperly formatted for address family -.Fa af . -.El -.Sh SEE ALSO -.Xr inet 3 , -.Xr linkaddr 3 , -.Xr inet 4 -.Sh HISTORY -An interface close to this one was originally suggested by Craig -Partridge. This particular interface originally appeared in the -.Tn INRIA -.Tn IPv6 -implementation. -.Sh AUTHORS -Code and documentation by -.An Garrett A. Wollman , -MIT Laboratory for Computer Science. -.Sh BUGS -The original implementations supported IPv6. This support should -eventually be resurrected. The -.Tn NRL -implementation also included support for the -.Dv AF_ISO -and -.Dv AF_NS -address families. -.Pp -The genericity of this interface is somewhat questionable. A truly -generic interface would provide a means for determining the length of -the buffer to be used so that it could be dynamically allocated, and -would always require a -.Dq Li "struct sockaddr" -to hold the binary address. Unfortunately, this is incompatible with existing -practice. This limitation means that a routine for printing network -addresses from arbitrary address families must still have internal -knowledge of the maximum buffer length needed and the appropriate part -of the address to use as the binary address. diff --git a/c/src/exec/libnetworking/libc/addr2ascii.c b/c/src/exec/libnetworking/libc/addr2ascii.c deleted file mode 100644 index dc651743b6..0000000000 --- a/c/src/exec/libnetworking/libc/addr2ascii.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 1996 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. 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. - * - * $ANA: addr2ascii.c,v 1.1 1996/06/13 18:41:46 wollman Exp $ - * - * $Id$ - */ - -#include -#include - -#include -#include - -#include -#include -#include - -/*- - * Convert a network address from binary to printable numeric format. - * This API is copied from INRIA's IPv6 implementation, but it is a - * bit bogus in two ways: - * - * 1) There is no value in passing both an address family and - * an address length; either one should imply the other, - * or we should be passing sockaddrs instead. - * 2) There should by contrast be /added/ a length for the buffer - * that we pass in, so that programmers are spared the need to - * manually calculate (read: ``guess'') the maximum length. - * - * Flash: the API is also the same in the NRL implementation, and seems to - * be some sort of standard, so we appear to be stuck with both the bad - * naming and the poor choice of arguments. - */ -char * -addr2ascii(af, addrp, len, buf) - int af; - const void *addrp; - int len; /* should be size_t XXX */ - char *buf; /* XXX should pass length of buffer */ -{ - static char staticbuf[64]; /* 64 for AF_LINK > 16 for AF_INET */ - - if (!buf) - buf = staticbuf; - - switch(af) { - case AF_INET: - if (len != sizeof(struct in_addr)) { - errno = ENAMETOOLONG; - return 0; - } - strcpy(buf, inet_ntoa(*(const struct in_addr *)addrp)); - break; - - case AF_LINK: - if (len != sizeof(struct sockaddr_dl)) { - errno = ENAMETOOLONG; - return 0; - } - strcpy(buf, link_ntoa((const struct sockaddr_dl *)addrp)); - break; - - default: - errno = EPROTONOSUPPORT; - return 0; - } - return buf; -} diff --git a/c/src/exec/libnetworking/libc/ascii2addr.c b/c/src/exec/libnetworking/libc/ascii2addr.c deleted file mode 100644 index e140244737..0000000000 --- a/c/src/exec/libnetworking/libc/ascii2addr.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 1996 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. 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. - * - * $ANA: ascii2addr.c,v 1.2 1996/06/13 18:46:02 wollman Exp $ - * - * $Id$ - */ - -#include -#include - -#include -#include - -#include -#include -#include - -int -ascii2addr(af, ascii, result) - int af; - const char *ascii; - void *result; -{ - struct in_addr *ina; - char strbuf[4*sizeof("123")]; /* long enough for V4 only */ - - switch(af) { - case AF_INET: - ina = result; - strbuf[0] = '\0'; - strncat(strbuf, ascii, (sizeof strbuf)-1); - if (inet_aton(strbuf, ina)) - return sizeof(struct in_addr); - errno = EINVAL; - break; - - case AF_LINK: - link_addr(ascii, result); - /* oops... no way to detect failure */ - return sizeof(struct sockaddr_dl); - - default: - errno = EPROTONOSUPPORT; - break; - } - - return -1; -} diff --git a/c/src/exec/libnetworking/libc/base64.c b/c/src/exec/libnetworking/libc/base64.c deleted file mode 100644 index 3017ccc01c..0000000000 --- a/c/src/exec/libnetworking/libc/base64.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) 1996, 1998 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* - * Portions Copyright (c) 1995 by International Business Machines, Inc. - * - * International Business Machines, Inc. (hereinafter called IBM) grants - * permission under its copyrights to use, copy, modify, and distribute this - * Software with or without fee, provided that the above copyright notice and - * all paragraphs of this notice appear in all copies, and that the name of IBM - * not be used in connection with the marketing of any product incorporating - * the Software or modifications thereof, without specific, written prior - * permission. - * - * To the extent it has a right to do so, IBM grants an immunity from suit - * under its patents, if any, for the use, sale or manufacture of products to - * the extent that such products are used for performing Domain Name System - * dynamic updates in TCP/IP networks by means of the Software. No immunity is - * granted for any product per se or for any other function of any product. - * - * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, - * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN - * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ - -#if !defined(__rtems__) -#if !defined(LINT) && !defined(CODECENTER) -static char rcsid[] = "$Id$"; -#endif /* not lint */ -#endif /* not rtems */ - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#define Assert(Cond) if (!(Cond)) abort() - -static const char Base64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static const char Pad64 = '='; - -/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) - The following encoding technique is taken from RFC 1521 by Borenstein - and Freed. It is reproduced here in a slightly edited form for - convenience. - - A 65-character subset of US-ASCII is used, enabling 6 bits to be - represented per printable character. (The extra 65th character, "=", - is used to signify a special processing function.) - - The encoding process represents 24-bit groups of input bits as output - strings of 4 encoded characters. Proceeding from left to right, a - 24-bit input group is formed by concatenating 3 8-bit input groups. - These 24 bits are then treated as 4 concatenated 6-bit groups, each - of which is translated into a single digit in the base64 alphabet. - - Each 6-bit group is used as an index into an array of 64 printable - characters. The character referenced by the index is placed in the - output string. - - Table 1: The Base64 Alphabet - - Value Encoding Value Encoding Value Encoding Value Encoding - 0 A 17 R 34 i 51 z - 1 B 18 S 35 j 52 0 - 2 C 19 T 36 k 53 1 - 3 D 20 U 37 l 54 2 - 4 E 21 V 38 m 55 3 - 5 F 22 W 39 n 56 4 - 6 G 23 X 40 o 57 5 - 7 H 24 Y 41 p 58 6 - 8 I 25 Z 42 q 59 7 - 9 J 26 a 43 r 60 8 - 10 K 27 b 44 s 61 9 - 11 L 28 c 45 t 62 + - 12 M 29 d 46 u 63 / - 13 N 30 e 47 v - 14 O 31 f 48 w (pad) = - 15 P 32 g 49 x - 16 Q 33 h 50 y - - Special processing is performed if fewer than 24 bits are available - at the end of the data being encoded. A full encoding quantum is - always completed at the end of a quantity. When fewer than 24 input - bits are available in an input group, zero bits are added (on the - right) to form an integral number of 6-bit groups. Padding at the - end of the data is performed using the '=' character. - - Since all base64 input is an integral number of octets, only the - ------------------------------------------------- - following cases can arise: - - (1) the final quantum of encoding input is an integral - multiple of 24 bits; here, the final unit of encoded - output will be an integral multiple of 4 characters - with no "=" padding, - (2) the final quantum of encoding input is exactly 8 bits; - here, the final unit of encoded output will be two - characters followed by two "=" padding characters, or - (3) the final quantum of encoding input is exactly 16 bits; - here, the final unit of encoded output will be three - characters followed by one "=" padding character. - */ - -int -b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { - size_t datalength = 0; - u_char input[3]; - u_char output[4]; - size_t i; - - while (2 < srclength) { - input[0] = *src++; - input[1] = *src++; - input[2] = *src++; - srclength -= 3; - - output[0] = input[0] >> 2; - output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); - output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); - output[3] = input[2] & 0x3f; - Assert(output[0] < 64); - Assert(output[1] < 64); - Assert(output[2] < 64); - Assert(output[3] < 64); - - if (datalength + 4 > targsize) - return (-1); - target[datalength++] = Base64[output[0]]; - target[datalength++] = Base64[output[1]]; - target[datalength++] = Base64[output[2]]; - target[datalength++] = Base64[output[3]]; - } - - /* Now we worry about padding. */ - if (0 != srclength) { - /* Get what's left. */ - input[0] = input[1] = input[2] = '\0'; - for (i = 0; i < srclength; i++) - input[i] = *src++; - - output[0] = input[0] >> 2; - output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); - output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); - Assert(output[0] < 64); - Assert(output[1] < 64); - Assert(output[2] < 64); - - if (datalength + 4 > targsize) - return (-1); - target[datalength++] = Base64[output[0]]; - target[datalength++] = Base64[output[1]]; - if (srclength == 1) - target[datalength++] = Pad64; - else - target[datalength++] = Base64[output[2]]; - target[datalength++] = Pad64; - } - if (datalength >= targsize) - return (-1); - target[datalength] = '\0'; /* Returned value doesn't count \0. */ - return (datalength); -} - -/* skips all whitespace anywhere. - converts characters, four at a time, starting at (or after) - src from base - 64 numbers into three 8 bit bytes in the target area. - it returns the number of data bytes stored at the target, or -1 on error. - */ - -int -b64_pton(src, target, targsize) - char const *src; - u_char *target; - size_t targsize; -{ - int tarindex, state, ch; - char *pos; - - state = 0; - tarindex = 0; - - while ((ch = *src++) != '\0') { - if (isspace(ch)) /* Skip whitespace anywhere. */ - continue; - - if (ch == Pad64) - break; - - pos = strchr(Base64, ch); - if (pos == 0) /* A non-base64 character. */ - return (-1); - - switch (state) { - case 0: - if (target) { - if ((size_t)tarindex >= targsize) - return (-1); - target[tarindex] = (pos - Base64) << 2; - } - state = 1; - break; - case 1: - if (target) { - if ((size_t)tarindex + 1 >= targsize) - return (-1); - target[tarindex] |= (pos - Base64) >> 4; - target[tarindex+1] = ((pos - Base64) & 0x0f) - << 4 ; - } - tarindex++; - state = 2; - break; - case 2: - if (target) { - if ((size_t)tarindex + 1 >= targsize) - return (-1); - target[tarindex] |= (pos - Base64) >> 2; - target[tarindex+1] = ((pos - Base64) & 0x03) - << 6; - } - tarindex++; - state = 3; - break; - case 3: - if (target) { - if ((size_t)tarindex >= targsize) - return (-1); - target[tarindex] |= (pos - Base64); - } - tarindex++; - state = 0; - break; - default: - abort(); - } - } - - /* - * We are done decoding Base-64 chars. Let's see if we ended - * on a byte boundary, and/or with erroneous trailing characters. - */ - - if (ch == Pad64) { /* We got a pad char. */ - ch = *src++; /* Skip it, get next. */ - switch (state) { - case 0: /* Invalid = in first position */ - case 1: /* Invalid = in second position */ - return (-1); - - case 2: /* Valid, means one byte of info */ - /* Skip any number of spaces. */ - for ((void)NULL; ch != '\0'; ch = *src++) - if (!isspace(ch)) - break; - /* Make sure there is another trailing = sign. */ - if (ch != Pad64) - return (-1); - ch = *src++; /* Skip the = */ - /* Fall through to "single trailing =" case. */ - /* FALLTHROUGH */ - - case 3: /* Valid, means two bytes of info */ - /* - * We know this char is an =. Is there anything but - * whitespace after it? - */ - for ((void)NULL; ch != '\0'; ch = *src++) - if (!isspace(ch)) - return (-1); - - /* - * Now make sure for cases 2 and 3 that the "extra" - * bits that slopped past the last full byte were - * zeros. If we don't check them, they become a - * subliminal channel. - */ - if (target && target[tarindex] != 0) - return (-1); - } - } else { - /* - * We ended by seeing the end of the string. Make sure we - * have no partial bytes lying around. - */ - if (state != 0) - return (-1); - } - - return (tarindex); -} diff --git a/c/src/exec/libnetworking/libc/byteorder.3 b/c/src/exec/libnetworking/libc/byteorder.3 deleted file mode 100644 index 81bf604867..0000000000 --- a/c/src/exec/libnetworking/libc/byteorder.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" 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. -.\" -.\" @(#)byteorder.3 8.1 (Berkeley) 6/4/93 -.\" $Id$ -.\" -.Dd June 4, 1993 -.Dt BYTEORDER 3 -.Os BSD 4.2 -.Sh NAME -.Nm htonl , -.Nm htons , -.Nm ntohl , -.Nm ntohs -.Nd convert values between host and network byte order -.Sh SYNOPSIS -.Fd #include -.Ft u_long -.Fn htonl "u_long hostlong" -.Ft u_short -.Fn htons "u_short hostshort" -.Ft u_long -.Fn ntohl "u_long netlong" -.Ft u_short -.Fn ntohs "u_short netshort" -.Sh DESCRIPTION -These routines convert 16 and 32 bit quantities between network -byte order and host byte order. -On machines which have a byte order which is the same as the network -order, routines are defined as null macros. -.Pp -These routines are most often used in conjunction with Internet -addresses and ports as returned by -.Xr gethostbyname 3 -and -.Xr getservent 3 . -.Sh SEE ALSO -.Xr gethostbyname 3 , -.Xr getservent 3 -.Sh HISTORY -The -.Nm byteorder -functions appeared in -.Bx 4.2 . -.Sh BUGS -On the -.Tn VAX -bytes are handled backwards from most everyone else in -the world. This is not expected to be fixed in the near future. diff --git a/c/src/exec/libnetworking/libc/ether_addr.c b/c/src/exec/libnetworking/libc/ether_addr.c deleted file mode 100644 index 9b7a9abf44..0000000000 --- a/c/src/exec/libnetworking/libc/ether_addr.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 1995 - * Bill Paul . 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 Bill Paul. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY Bill Paul 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. - * - * ethernet address conversion and lookup routines - * - * Written by Bill Paul - * Center for Telecommunications Research - * Columbia University, New York City - * - * $Id$ - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef YP -#include -#include -#include -#endif - -#ifndef _PATH_ETHERS -#define _PATH_ETHERS "/etc/ethers" -#endif - -/* - * Parse a string of text containing an ethernet address and hostname - * and separate it into its component parts. - */ -int ether_line(l, e, hostname) - char *l; - struct ether_addr *e; - char *hostname; -{ - int i, o[6]; - - i = sscanf(l, "%x:%x:%x:%x:%x:%x %s", &o[0], &o[1], &o[2], - &o[3], &o[4], &o[5], - hostname); - if (i != 7) - return (i); - - for (i=0; i<6; i++) - e->octet[i] = o[i]; - return (0); -} - -/* - * Convert an ASCII representation of an ethernet address to - * binary form. - */ -struct ether_addr *ether_aton(a) - char *a; -{ - int i; - static struct ether_addr o; - unsigned int o0, o1, o2, o3, o4, o5; - - i = sscanf(a, "%x:%x:%x:%x:%x:%x", &o0, &o1, &o2, &o3, &o4, &o5); - - if (i != 6) - return (NULL); - - o.octet[0]=o0; - o.octet[1]=o1; - o.octet[2]=o2; - o.octet[3]=o3; - o.octet[4]=o4; - o.octet[5]=o5; - - return ((struct ether_addr *)&o); -} - -/* - * Convert a binary representation of an ethernet address to - * an ASCII string. - */ -char *ether_ntoa(n) - struct ether_addr *n; -{ - int i; - static char a[18]; - - i = sprintf(a,"%x:%x:%x:%x:%x:%x",n->octet[0],n->octet[1],n->octet[2], - n->octet[3],n->octet[4],n->octet[5]); - if (i < 11) - return (NULL); - return ((char *)&a); -} - -/* - * Map an ethernet address to a hostname. Use either /etc/ethers or - * NIS/YP. - */ - -int ether_ntohost(hostname, e) - char *hostname; - struct ether_addr *e; -{ - FILE *fp; - char buf[BUFSIZ + 2]; - struct ether_addr local_ether; - char local_host[MAXHOSTNAMELEN]; -#ifdef YP - char *result; - int resultlen; - char *ether_a; - char *yp_domain; -#endif - if ((fp = fopen(_PATH_ETHERS, "r")) == NULL) - return (1); - - while (fgets(buf,BUFSIZ,fp)) { - if (buf[0] == '#') - continue; -#ifdef YP - if (buf[0] == '+') { - if (yp_get_default_domain(&yp_domain)) - continue; - ether_a = ether_ntoa(e); - if (yp_match(yp_domain, "ethers.byaddr", ether_a, - strlen(ether_a), &result, &resultlen)) { - continue; - } - strncpy(buf, result, resultlen); - buf[resultlen] = '\0'; - free(result); - } -#endif - if (!ether_line(buf, &local_ether, local_host)) { - if (!bcmp((char *)&local_ether.octet[0], - (char *)&e->octet[0], 6)) { - /* We have a match */ - strcpy(hostname, local_host); - fclose(fp); - return(0); - } - } - } - fclose(fp); - return (1); -} - -/* - * Map a hostname to an ethernet address using /etc/ethers or - * NIS/YP. - */ -int ether_hostton(hostname, e) - char *hostname; - struct ether_addr *e; -{ - FILE *fp; - char buf[BUFSIZ + 2]; - struct ether_addr local_ether; - char local_host[MAXHOSTNAMELEN]; -#ifdef YP - char *result; - int resultlen; - char *yp_domain; -#endif - if ((fp = fopen(_PATH_ETHERS, "r")) == NULL) - return (1); - - while (fgets(buf,BUFSIZ,fp)) { - if (buf[0] == '#') - continue; -#ifdef YP - if (buf[0] == '+') { - if (yp_get_default_domain(&yp_domain)) - continue; - if (yp_match(yp_domain, "ethers.byname", hostname, - strlen(hostname), &result, &resultlen)) { - continue; - } - strncpy(buf, result, resultlen); - buf[resultlen] = '\0'; - free(result); - } -#endif - if (!ether_line(buf, &local_ether, local_host)) { - if (!strcmp(hostname, local_host)) { - /* We have a match */ - bcopy((char *)&local_ether.octet[0], - (char *)&e->octet[0], 6); - fclose(fp); - return(0); - } - } - } - fclose(fp); - return (1); -} diff --git a/c/src/exec/libnetworking/libc/ethers.3 b/c/src/exec/libnetworking/libc/ethers.3 deleted file mode 100644 index afea48320a..0000000000 --- a/c/src/exec/libnetworking/libc/ethers.3 +++ /dev/null @@ -1,193 +0,0 @@ -.\" Copyright (c) 1995 -.\" Bill Paul . 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 Bill Paul. -.\" 4. Neither the name of the author nor the names of any co-contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY Bill Paul 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$ -.\" -.Dd April 12, 1995 -.Dt ETHERS 3 -.Os FreeBSD 2.1 -.Sh NAME -.Nm ethers , -.Nm ether_line , -.Nm ether_aton , -.Nm ether_ntoa , -.Nm ether_ntohost , -.Nm ether_hostton -.Nd Ethernet address conversion and lookup routines -.Sh SYNOPSIS -.Fd #include -.Fd #include -.Fd #include -.Ft int -.Fn ether_line "char *l" "struct ether_addr *e" "char *hostname" -.Ft struct ether_addr * -.Fn ether_aton "char *a" -.Ft char * -.Fn ether_ntoa "struct ether_addr *n" -.Ft int -.Fn ether_ntohost "char *hostname" "struct ether_addr *e" -.Ft int -.Fn ether_hostton "char *hostname" "struct ether_addr *e" -.Sh DESCRIPTION -These functions operate on ethernet addresses using an -.Ar ether_addr -structure, which is defined in the header file -.Aq Pa netinet/if_ether.h : -.Bd -literal -offset indent -/* - * The number of bytes in an ethernet (MAC) address. - */ -#define ETHER_ADDR_LEN 6 - -/* - * Structure of a 48-bit Ethernet address. - */ -struct ether_addr { - u_char octet[ETHER_ADDR_LEN]; -}; -.Ed -.Pp -The function -.Fn ether_line -scans -.Ar l , -an -.Tn ASCII -string in -.Xr ethers 5 -format and sets -.Ar e -to the ethernet address specified in the string and -.Ar h -to the hostname. This function is used to parse lines from -.Pa /etc/ethers -into their component parts. -.Pp -The -.Fn ether_aton -function converts an -.Tn ASCII -representation of an ethernet address into an -.Ar ether_addr -structure. Likewise, -.Fn ether_ntoa -converts an ethernet address specified as an -.Ar ether_addr -structure into an -.Tn ASCII -string. -.Pp -The -.Fn ether_ntohost -and -.Fn ether_hostton -functions map ethernet addresses to their corresponding hostnames -as specified in the -.Pa /etc/ethers -database. -.Fn ether_ntohost -converts from ethernet address to hostname, and -.Fn ether_hostton -converts from hostname to ethernet address. -.Sh RETURN VALUES -.Fn ether_line -returns zero on success and non-zero if it was unable to parse -any part of the supplied line -.Ar l . -It returns the extracted ethernet address in the supplied -.Ar ether_addr -structure -.Ar e -and the hostname in the supplied string -.Ar h . -.Pp -On success, -.Fn ether_ntoa -returns a pointer to a string containing an -.Tn ASCII -representation of an ethernet address. If it is unable to convert -the supplied -.Ar ether_addr -structure, it returns a -.Dv NULL -pointer. Likewise, -.Fn ether_aton -returns a pointer to an -.Ar ether_addr -structure on success and a -.Dv NULL -pointer on failure. -.Pp -The -.Fn ether_ntohost -and -.Fn ether_hostton -functions both return zero on success or non-zero if they were -unable to find a match in the -.Pa /etc/ethers -database. -.Sh NOTES -The user must insure that the hostname strings passed to the -the -.Fn ether_line , -.Fn ether_ntohost -and -.Fn ether_hostton -functions are large enough to contain the returned hostnames. -.Sh NIS INTERACTION -If the -.Pa /etc/ethers -contains a line with a single + in it, the -.Fn ether_ntohost -and -.Fn ether_hostton -functions will attempt to consult the NIS -.Pa ethers.byname -and -.Pa ethers.byaddr -maps in addition to the data in the -.Pa /etc/ethers -file. -.Sh SEE ALSO -.Xr yp 4 , -.Xr ethers 5 -.Sh BUGS -.Pp -The -.Fn ether_aton -and -.Fn ether_ntoa -functions returns values that are stored in static memory areas -which may be overwritten the next time they are called. -.Sh HISTORY -This particular implementation of the -.Nm ethers -library functions were written for and first appeared in -.Fx 2.1 . diff --git a/c/src/exec/libnetworking/libc/gethostbydns.c b/c/src/exec/libnetworking/libc/gethostbydns.c deleted file mode 100644 index 3d80ffde7a..0000000000 --- a/c/src/exec/libnetworking/libc/gethostbydns.c +++ /dev/null @@ -1,773 +0,0 @@ -/* - * ++Copyright++ 1985, 1988, 1993 - * - - * Copyright (c) 1985, 1988, 1993 - * 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. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char fromrcsid[] = "From: Id: gethnamaddr.c,v 8.23 1998/04/07 04:59:46 vixie Exp $"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "res_config.h" - -#define SPRINTF(x) ((size_t)sprintf x) - -#define MAXALIASES 35 -#define MAXADDRS 35 - -static const char AskedForGot[] = - "gethostby*.gethostanswer: asked for \"%s\", got \"%s\""; - -static char *h_addr_ptrs[MAXADDRS + 1]; - -static struct hostent host; -static char *host_aliases[MAXALIASES]; -static char hostbuf[8*1024]; -static u_char host_addr[16]; /* IPv4 or IPv6 */ - -#ifdef RESOLVSORT -static void addrsort __P((char **, int)); -#endif - -#if PACKETSZ > 1024 -#define MAXPACKET PACKETSZ -#else -#define MAXPACKET 1024 -#endif - -typedef union { - HEADER hdr; - u_char buf[MAXPACKET]; -} querybuf; - -typedef union { - int32_t al; - char ac; -} align; - -extern int h_errno; -int _dns_ttl_; - -#ifdef DEBUG -static void -dprintf(msg, num) - char *msg; - int num; -{ - if (_res.options & RES_DEBUG) { - int save = errno; - - printf(msg, num); - errno = save; - } -} -#else -# define dprintf(msg, num) /*nada*/ -#endif - -#define BOUNDED_INCR(x) \ - do { \ - cp += x; \ - if (cp > eom) { \ - h_errno = NO_RECOVERY; \ - return (NULL); \ - } \ - } while (0) - -#define BOUNDS_CHECK(ptr, count) \ - do { \ - if ((ptr) + (count) > eom) { \ - h_errno = NO_RECOVERY; \ - return (NULL); \ - } \ - } while (0) - -static struct hostent * -gethostanswer(answer, anslen, qname, qtype) - const querybuf *answer; - int anslen; - const char *qname; - int qtype; -{ - register const HEADER *hp; - register const u_char *cp; - register int n; - const u_char *eom, *erdata; - char *bp, **ap, **hap; - int type, class, buflen, ancount, qdcount; - int haveanswer, had_error; - int toobig = 0; - char tbuf[MAXDNAME]; - const char *tname; - int (*name_ok) __P((const char *)); - - tname = qname; - host.h_name = NULL; - eom = answer->buf + anslen; - switch (qtype) { - case T_A: - case T_AAAA: - name_ok = res_hnok; - break; - case T_PTR: - name_ok = res_dnok; - break; - default: - h_errno = NO_RECOVERY; - return (NULL); /* XXX should be abort(); */ - } - /* - * find first satisfactory answer - */ - hp = &answer->hdr; - ancount = ntohs(hp->ancount); - qdcount = ntohs(hp->qdcount); - bp = hostbuf; - buflen = sizeof hostbuf; - cp = answer->buf; - BOUNDED_INCR(HFIXEDSZ); - if (qdcount != 1) { - h_errno = NO_RECOVERY; - return (NULL); - } - n = dn_expand(answer->buf, eom, cp, bp, buflen); - if ((n < 0) || !(*name_ok)(bp)) { - h_errno = NO_RECOVERY; - return (NULL); - } - BOUNDED_INCR(n + QFIXEDSZ); - if (qtype == T_A || qtype == T_AAAA) { - /* res_send() has already verified that the query name is the - * same as the one we sent; this just gets the expanded name - * (i.e., with the succeeding search-domain tacked on). - */ - n = strlen(bp) + 1; /* for the \0 */ - if (n >= MAXHOSTNAMELEN) { - h_errno = NO_RECOVERY; - return (NULL); - } - host.h_name = bp; - bp += n; - buflen -= n; - /* The qname can be abbreviated, but h_name is now absolute. */ - qname = host.h_name; - } - ap = host_aliases; - *ap = NULL; - host.h_aliases = host_aliases; - hap = h_addr_ptrs; - *hap = NULL; - host.h_addr_list = h_addr_ptrs; - haveanswer = 0; - had_error = 0; - _dns_ttl_ = -1; - while (ancount-- > 0 && cp < eom && !had_error) { - n = dn_expand(answer->buf, eom, cp, bp, buflen); - if ((n < 0) || !(*name_ok)(bp)) { - had_error++; - continue; - } - cp += n; /* name */ - BOUNDS_CHECK(cp, 3 * INT16SZ + INT32SZ); - type = _getshort(cp); - cp += INT16SZ; /* type */ - class = _getshort(cp); - cp += INT16SZ; /* class */ - if (qtype == T_A && type == T_A) - _dns_ttl_ = _getlong(cp); - cp += INT32SZ; /* TTL */ - n = _getshort(cp); - cp += INT16SZ; /* len */ - BOUNDS_CHECK(cp, n); - erdata = cp + n; - if (class != C_IN) { - /* XXX - debug? syslog? */ - cp += n; - continue; /* XXX - had_error++ ? */ - } - if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME) { - if (ap >= &host_aliases[MAXALIASES-1]) - continue; - n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); - if ((n < 0) || !(*name_ok)(tbuf)) { - had_error++; - continue; - } - cp += n; - if (cp != erdata) { - h_errno = NO_RECOVERY; - return (NULL); - } - /* Store alias. */ - *ap++ = bp; - n = strlen(bp) + 1; /* for the \0 */ - if (n >= MAXHOSTNAMELEN) { - had_error++; - continue; - } - bp += n; - buflen -= n; - /* Get canonical name. */ - n = strlen(tbuf) + 1; /* for the \0 */ - if (n > buflen || n >= MAXHOSTNAMELEN) { - had_error++; - continue; - } - strcpy(bp, tbuf); - host.h_name = bp; - bp += n; - buflen -= n; - continue; - } - if (qtype == T_PTR && type == T_CNAME) { - n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); - if (n < 0 || !res_dnok(tbuf)) { - had_error++; - continue; - } - cp += n; - if (cp != erdata) { - h_errno = NO_RECOVERY; - return (NULL); - } - /* Get canonical name. */ - n = strlen(tbuf) + 1; /* for the \0 */ - if (n > buflen || n >= MAXHOSTNAMELEN) { - had_error++; - continue; - } - strcpy(bp, tbuf); - tname = bp; - bp += n; - buflen -= n; - continue; - } - if (type != qtype) { - syslog(LOG_NOTICE|LOG_AUTH, - "gethostby*.gethostanswer: asked for \"%s %s %s\", got type \"%s\"", - qname, p_class(C_IN), p_type(qtype), - p_type(type)); - cp += n; - continue; /* XXX - had_error++ ? */ - } - switch (type) { - case T_PTR: - if (strcasecmp(tname, bp) != 0) { - syslog(LOG_NOTICE|LOG_AUTH, - AskedForGot, qname, bp); - cp += n; - continue; /* XXX - had_error++ ? */ - } - n = dn_expand(answer->buf, eom, cp, bp, buflen); - if ((n < 0) || !res_hnok(bp)) { - had_error++; - break; - } -#if MULTI_PTRS_ARE_ALIASES - cp += n; - if (cp != erdata) { - h_errno = NO_RECOVERY; - return (NULL); - } - if (!haveanswer) - host.h_name = bp; - else if (ap < &host_aliases[MAXALIASES-1]) - *ap++ = bp; - else - n = -1; - if (n != -1) { - n = strlen(bp) + 1; /* for the \0 */ - if (n >= MAXHOSTNAMELEN) { - had_error++; - break; - } - bp += n; - buflen -= n; - } - break; -#else - host.h_name = bp; - if (_res.options & RES_USE_INET6) { - n = strlen(bp) + 1; /* for the \0 */ - if (n >= MAXHOSTNAMELEN) { - had_error++; - break; - } - bp += n; - buflen -= n; - _map_v4v6_hostent(&host, &bp, &buflen); - } - h_errno = NETDB_SUCCESS; - return (&host); -#endif - case T_A: - case T_AAAA: - if (strcasecmp(host.h_name, bp) != 0) { - syslog(LOG_NOTICE|LOG_AUTH, - AskedForGot, host.h_name, bp); - cp += n; - continue; /* XXX - had_error++ ? */ - } - if (n != host.h_length) { - cp += n; - continue; - } - if (!haveanswer) { - register int nn; - - host.h_name = bp; - nn = strlen(bp) + 1; /* for the \0 */ - bp += nn; - buflen -= nn; - } - - bp += sizeof(align) - ((u_long)bp % sizeof(align)); - - if (bp + n >= &hostbuf[sizeof hostbuf]) { - dprintf("size (%d) too big\n", n); - had_error++; - continue; - } - if (hap >= &h_addr_ptrs[MAXADDRS-1]) { - if (!toobig++) - dprintf("Too many addresses (%d)\n", - MAXADDRS); - cp += n; - continue; - } - bcopy(cp, *hap++ = bp, n); - bp += n; - buflen -= n; - cp += n; - if (cp != erdata) { - h_errno = NO_RECOVERY; - return (NULL); - } - break; - default: - dprintf("Impossible condition (type=%d)\n", type); - h_errno = NO_RECOVERY; - return (NULL); - /* BIND has abort() here, too risky on bad data */ - } - if (!had_error) - haveanswer++; - } - if (haveanswer) { - *ap = NULL; - *hap = NULL; -# if defined(RESOLVSORT) - /* - * Note: we sort even if host can take only one address - * in its return structures - should give it the "best" - * address in that case, not some random one - */ - if (_res.nsort && haveanswer > 1 && qtype == T_A) - addrsort(h_addr_ptrs, haveanswer); -# endif /*RESOLVSORT*/ - if (!host.h_name) { - n = strlen(qname) + 1; /* for the \0 */ - if (n > buflen || n >= MAXHOSTNAMELEN) - goto no_recovery; - strcpy(bp, qname); - host.h_name = bp; - bp += n; - buflen -= n; - } - if (_res.options & RES_USE_INET6) - _map_v4v6_hostent(&host, &bp, &buflen); - h_errno = NETDB_SUCCESS; - return (&host); - } - no_recovery: - h_errno = NO_RECOVERY; - return (NULL); -} - -struct hostent * -__dns_getanswer(answer, anslen, qname, qtype) - const char *answer; - int anslen; - const char *qname; - int qtype; -{ - switch(qtype) { - case T_AAAA: - host.h_addrtype = AF_INET6; - host.h_length = IN6ADDRSZ; - break; - case T_A: - default: - host.h_addrtype = AF_INET; - host.h_length = INADDRSZ; - break; - } - - return(gethostanswer((const querybuf *)answer, anslen, qname, qtype)); -} - -struct hostent * -_gethostbydnsname(name, af) - const char *name; - int af; -{ - querybuf buf; - register const char *cp; - char *bp; - int n, size, type, len; - - if ((_res.options & RES_INIT) == 0 && res_init() == -1) { - h_errno = NETDB_INTERNAL; - return (NULL); - } - - switch (af) { - case AF_INET: - size = INADDRSZ; - type = T_A; - break; - case AF_INET6: - size = IN6ADDRSZ; - type = T_AAAA; - break; - default: - h_errno = NETDB_INTERNAL; - errno = EAFNOSUPPORT; - return (NULL); - } - - host.h_addrtype = af; - host.h_length = size; - - /* - * if there aren't any dots, it could be a user-level alias. - * this is also done in res_query() since we are not the only - * function that looks up host names. - */ - if (!strchr(name, '.') && (cp = __hostalias(name))) - name = cp; - - /* - * disallow names consisting only of digits/dots, unless - * they end in a dot. - */ - if (isdigit((int)name[0])) - for (cp = name;; ++cp) { - if (!*cp) { - if (*--cp == '.') - break; - /* - * All-numeric, no dot at the end. - * Fake up a hostent as if we'd actually - * done a lookup. - */ - if (inet_pton(af, name, host_addr) <= 0) { - h_errno = HOST_NOT_FOUND; - return (NULL); - } - strncpy(hostbuf, name, MAXDNAME); - hostbuf[MAXDNAME] = '\0'; - bp = hostbuf + MAXDNAME; - len = sizeof hostbuf - MAXDNAME; - host.h_name = hostbuf; - host.h_aliases = host_aliases; - host_aliases[0] = NULL; - h_addr_ptrs[0] = (char *)host_addr; - h_addr_ptrs[1] = NULL; - host.h_addr_list = h_addr_ptrs; - if (_res.options & RES_USE_INET6) - _map_v4v6_hostent(&host, &bp, &len); - h_errno = NETDB_SUCCESS; - return (&host); - } - if (!isdigit((int)*cp) && *cp != '.') - break; - } - if ((isxdigit((int)name[0]) && strchr(name, ':') != NULL) || - name[0] == ':') - for (cp = name;; ++cp) { - if (!*cp) { - if (*--cp == '.') - break; - /* - * All-IPv6-legal, no dot at the end. - * Fake up a hostent as if we'd actually - * done a lookup. - */ - if (inet_pton(af, name, host_addr) <= 0) { - h_errno = HOST_NOT_FOUND; - return (NULL); - } - strncpy(hostbuf, name, MAXDNAME); - hostbuf[MAXDNAME] = '\0'; - bp = hostbuf + MAXDNAME; - len = sizeof hostbuf - MAXDNAME; - host.h_name = hostbuf; - host.h_aliases = host_aliases; - host_aliases[0] = NULL; - h_addr_ptrs[0] = (char *)host_addr; - h_addr_ptrs[1] = NULL; - host.h_addr_list = h_addr_ptrs; - h_errno = NETDB_SUCCESS; - return (&host); - } - if (!isxdigit((int)*cp) && *cp != ':' && *cp != '.') - break; - } - - if ((n = res_search(name, C_IN, type, buf.buf, sizeof(buf))) < 0) { - dprintf("res_search failed (%d)\n", n); - return (NULL); - } - return (gethostanswer(&buf, n, name, type)); -} - -struct hostent * -_gethostbydnsaddr(addr, len, af) - const char *addr; /* XXX should have been def'd as u_char! */ - int len, af; -{ - const u_char *uaddr = (const u_char *)addr; - static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff }; - static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 }; - int n, size; - querybuf buf; - register struct hostent *hp; - char qbuf[MAXDNAME+1], *qp; -#ifdef SUNSECURITY - register struct hostent *rhp; - char **haddr; - u_long old_options; - char hname2[MAXDNAME+1]; -#endif /*SUNSECURITY*/ - - if ((_res.options & RES_INIT) == 0 && res_init() == -1) { - h_errno = NETDB_INTERNAL; - return (NULL); - } - if (af == AF_INET6 && len == IN6ADDRSZ && - (!bcmp(uaddr, mapped, sizeof mapped) || - !bcmp(uaddr, tunnelled, sizeof tunnelled))) { - /* Unmap. */ - addr += sizeof mapped; - uaddr += sizeof mapped; - af = AF_INET; - len = INADDRSZ; - } - switch (af) { - case AF_INET: - size = INADDRSZ; - break; - case AF_INET6: - size = IN6ADDRSZ; - break; - default: - errno = EAFNOSUPPORT; - h_errno = NETDB_INTERNAL; - return (NULL); - } - if (size != len) { - errno = EINVAL; - h_errno = NETDB_INTERNAL; - return (NULL); - } - switch (af) { - case AF_INET: - (void) sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa", - (uaddr[3] & 0xff), - (uaddr[2] & 0xff), - (uaddr[1] & 0xff), - (uaddr[0] & 0xff)); - break; - case AF_INET6: - qp = qbuf; - for (n = IN6ADDRSZ - 1; n >= 0; n--) { - qp += SPRINTF((qp, "%x.%x.", - uaddr[n] & 0xf, - (uaddr[n] >> 4) & 0xf)); - } - strcpy(qp, "ip6.int"); - break; - default: - abort(); - } - n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf); - if (n < 0) { - dprintf("res_query failed (%d)\n", n); - return (NULL); - } - if (!(hp = gethostanswer(&buf, n, qbuf, T_PTR))) - return (NULL); /* h_errno was set by gethostanswer() */ -#ifdef SUNSECURITY - if (af == AF_INET) { - /* - * turn off search as the name should be absolute, - * 'localhost' should be matched by defnames - */ - strncpy(hname2, hp->h_name, MAXDNAME); - hname2[MAXDNAME] = '\0'; - old_options = _res.options; - _res.options &= ~RES_DNSRCH; - _res.options |= RES_DEFNAMES; - if (!(rhp = gethostbyname(hname2))) { - syslog(LOG_NOTICE|LOG_AUTH, - "gethostbyaddr: No A record for %s (verifying [%s])", - hname2, inet_ntoa(*((struct in_addr *)addr))); - _res.options = old_options; - h_errno = HOST_NOT_FOUND; - return (NULL); - } - _res.options = old_options; - for (haddr = rhp->h_addr_list; *haddr; haddr++) - if (!memcmp(*haddr, addr, INADDRSZ)) - break; - if (!*haddr) { - syslog(LOG_NOTICE|LOG_AUTH, - "gethostbyaddr: A record of %s != PTR record [%s]", - hname2, inet_ntoa(*((struct in_addr *)addr))); - h_errno = HOST_NOT_FOUND; - return (NULL); - } - } -#endif /*SUNSECURITY*/ - hp->h_addrtype = af; - hp->h_length = len; - bcopy(addr, host_addr, len); - h_addr_ptrs[0] = (char *)host_addr; - h_addr_ptrs[1] = NULL; - if (af == AF_INET && (_res.options & RES_USE_INET6)) { - _map_v4v6_address((char*)host_addr, (char*)host_addr); - hp->h_addrtype = AF_INET6; - hp->h_length = IN6ADDRSZ; - } - h_errno = NETDB_SUCCESS; - return (hp); -} - -#ifdef RESOLVSORT -static void -addrsort(ap, num) - char **ap; - int num; -{ - int i, j; - char **p; - short aval[MAXADDRS]; - int needsort = 0; - - p = ap; - for (i = 0; i < num; i++, p++) { - for (j = 0 ; (unsigned)j < _res.nsort; j++) - if (_res.sort_list[j].addr.s_addr == - (((struct in_addr *)(*p))->s_addr & _res.sort_list[j].mask)) - break; - aval[i] = j; - if (needsort == 0 && i > 0 && j < aval[i-1]) - needsort = i; - } - if (!needsort) - return; - - while (needsort < num) { - for (j = needsort - 1; j >= 0; j--) { - if (aval[j] > aval[j+1]) { - char *hp; - - i = aval[j]; - aval[j] = aval[j+1]; - aval[j+1] = i; - - hp = ap[j]; - ap[j] = ap[j+1]; - ap[j+1] = hp; - - } else - break; - } - needsort++; - } -} -#endif -void -_sethostdnsent(stayopen) - int stayopen; -{ - if ((_res.options & RES_INIT) == 0 && res_init() == -1) - return; - if (stayopen) - _res.options |= RES_STAYOPEN | RES_USEVC; -} - -void -_endhostdnsent() -{ - _res.options &= ~(RES_STAYOPEN | RES_USEVC); - res_close(); -} diff --git a/c/src/exec/libnetworking/libc/gethostbyht.c b/c/src/exec/libnetworking/libc/gethostbyht.c deleted file mode 100644 index 29f2805367..0000000000 --- a/c/src/exec/libnetworking/libc/gethostbyht.c +++ /dev/null @@ -1,202 +0,0 @@ -/*- - * Copyright (c) 1985, 1988, 1993 - * 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. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* XXX */ -#include /* XXX */ - -#define MAXALIASES 35 - -static struct hostent host; -static char *host_aliases[MAXALIASES]; -static char hostbuf[BUFSIZ+1]; -static FILE *hostf = NULL; -static u_char host_addr[16]; /* IPv4 or IPv6 */ -static char *h_addr_ptrs[2]; -static int stayopen = 0; - -void -_sethosthtent(f) - int f; -{ - if (!hostf) - hostf = fopen(_PATH_HOSTS, "r" ); - else - rewind(hostf); - stayopen = f; -} - -void -_endhosthtent() -{ - if (hostf && !stayopen) { - (void) fclose(hostf); - hostf = NULL; - } -} - -struct hostent * -gethostent() -{ - char *p; - register char *cp, **q; - int af, len; - - if (!hostf && !(hostf = fopen(_PATH_HOSTS, "r" ))) { - h_errno = NETDB_INTERNAL; - return (NULL); - } - again: - if (!(p = fgets(hostbuf, sizeof hostbuf, hostf))) { - h_errno = HOST_NOT_FOUND; - return (NULL); - } - if (*p == '#') - goto again; - if (!(cp = strpbrk(p, "#\n"))) - goto again; - *cp = '\0'; - if (!(cp = strpbrk(p, " \t"))) - goto again; - *cp++ = '\0'; - if (inet_pton(AF_INET6, p, host_addr) > 0) { - af = AF_INET6; - len = IN6ADDRSZ; - } else if (inet_pton(AF_INET, p, host_addr) > 0) { - if (_res.options & RES_USE_INET6) { - _map_v4v6_address((char*)host_addr, (char*)host_addr); - af = AF_INET6; - len = IN6ADDRSZ; - } else { - af = AF_INET; - len = INADDRSZ; - } - } else { - goto again; - } - h_addr_ptrs[0] = (char *)host_addr; - h_addr_ptrs[1] = NULL; - host.h_addr_list = h_addr_ptrs; - host.h_length = len; - host.h_addrtype = af; - while (*cp == ' ' || *cp == '\t') - cp++; - host.h_name = cp; - q = host.h_aliases = host_aliases; - if ((cp = strpbrk(cp, " \t")) != NULL) - *cp++ = '\0'; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; - } - if (q < &host_aliases[MAXALIASES - 1]) - *q++ = cp; - if ((cp = strpbrk(cp, " \t")) != NULL) - *cp++ = '\0'; - } - *q = NULL; - h_errno = NETDB_SUCCESS; - return (&host); -} - -struct hostent * -_gethostbyhtname(name, af) - const char *name; - int af; -{ - register struct hostent *p; - register char **cp; - - sethostent(0); - while ((p = gethostent()) != NULL) { - if (p->h_addrtype != af) - continue; - if (strcasecmp(p->h_name, name) == 0) - break; - for (cp = p->h_aliases; *cp != 0; cp++) - if (strcasecmp(*cp, name) == 0) - goto found; - } -found: - endhostent(); - return (p); -} - -struct hostent * -_gethostbyhtaddr(addr, len, af) - const char *addr; - int len, af; -{ - register struct hostent *p; - - sethostent(0); - while ((p = gethostent()) != NULL) - if (p->h_addrtype == af && !bcmp(p->h_addr, addr, len)) - break; - endhostent(); - return (p); -} diff --git a/c/src/exec/libnetworking/libc/gethostbyname.3 b/c/src/exec/libnetworking/libc/gethostbyname.3 deleted file mode 100644 index e21dc79f1d..0000000000 --- a/c/src/exec/libnetworking/libc/gethostbyname.3 +++ /dev/null @@ -1,305 +0,0 @@ -.\" Copyright (c) 1983, 1987, 1991, 1993 -.\" 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. -.\" -.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95 -.\" $Id$ -.\" -.Dd May 25, 1995 -.Dt GETHOSTBYNAME 3 -.Os BSD 4.2 -.Sh NAME -.Nm gethostbyname , -.Nm gethostbyname2 , -.Nm gethostbyaddr , -.Nm gethostent , -.Nm sethostent , -.Nm endhostent , -.Nm herror , -.Nm hstrerror -.Nd get network host entry -.Sh SYNOPSIS -.Fd #include -.Vt extern int h_errno; -.Ft struct hostent * -.Fn gethostbyname "const char *name" -.Ft struct hostent * -.Fn gethostbyname2 "const char *name" "int af" -.Ft struct hostent * -.Fn gethostbyaddr "const char *addr" "int len" "int type" -.Ft struct hostent * -.Fn gethostent void -.Ft void -.Fn sethostent "int stayopen" -.Ft void -.Fn endhostent void -.Ft void -.Fn herror "const char *string" -.Ft const char * -.Fn hstrerror "int err" -.Sh DESCRIPTION -The -.Fn gethostbyname , -.Fn gethostbyname2 -and -.Fn gethostbyaddr -functions -each return a pointer to an object with the -following structure describing an internet host -referenced by name or by address, respectively. -This structure contains either the information obtained from the name server, -.Xr named 8 , -or broken-out fields from a line in -.Pa /etc/hosts . -If the local name server is not running these routines do a lookup in -.Pa /etc/hosts . -.Bd -literal -struct hostent { - char *h_name; /* official name of host */ - char **h_aliases; /* alias list */ - int h_addrtype; /* host address type */ - int h_length; /* length of address */ - char **h_addr_list; /* list of addresses from name server */ -}; -#define h_addr h_addr_list[0] /* address, for backward compatibility */ -.Ed -.Pp -The members of this structure are: -.Bl -tag -width h_addr_list -.It Fa h_name -Official name of the host. -.It Fa h_aliases -A NULL-terminated array of alternate names for the host. -.It Fa h_addrtype -The type of address being returned; usually -.Dv AF_INET . -.It Fa h_length -The length, in bytes, of the address. -.It Fa h_addr_list -A NULL-terminated array of network addresses for the host. -Host addresses are returned in network byte order. -.It Fa h_addr -The first address in -.Fa h_addr_list ; -this is for backward compatibility. -.El -.Pp -When using the nameserver, -.Fn gethostbyname -and -.Fn gethostbyname -will search for the named host in the current domain and its parents -unless the name ends in a dot. -If the name contains no dot, and if the environment variable -.Dq Ev HOSTALIASES -contains the name of an alias file, the alias file will first be searched -for an alias matching the input name. -See -.Xr hostname 7 -for the domain search procedure and the alias file format. -.Pp -The -.Fn gethostbyname2 -function is an evolution of -.Fn gethostbyname -which is intended to allow lookups in address families other than -.Dv AF_INET , -for example -.Dv AF_INET6 . -Currently the -.Fa af -argument must be specified as -.Dv AF_INET -else the function will return -.Dv NULL -after having set -.Va h_errno -to -.Dv NETDB_INTERNAL -.Pp -The -.Fn sethostent -function -may be used to request the use of a connected -.Tn TCP -socket for queries. -If the -.Fa stayopen -flag is non-zero, -this sets the option to send all queries to the name server using -.Tn TCP -and to retain the connection after each call to -.Fn gethostbyname , -.Fn gethostbyname2 -or -.Fn gethostbyaddr . -Otherwise, queries are performed using -.Tn UDP -datagrams. -.Pp -The -.Fn endhostent -function -closes the -.Tn TCP -connection. -.Pp -The -.Fn herror -function writes a message to the diagnostic output consisting of the -string parameter -.Fa s , -the constant string ": ", and a message corresponding to the value of -.Va h_errno . -.Pp -The -.Fn hstrerror -function returns a string which is the message text corresponding to the -value of the -.Fa err -parameter. -.Sh FILES -.Bl -tag -width /etc/resolv.conf -compact -.It Pa /etc/hosts -.It Pa /etc/host.conf -.It Pa /etc/resolv.conf -.El -.Sh DIAGNOSTICS -Error return status from -.Fn gethostbyname , -.Fn gethostbyname2 -and -.Fn gethostbyaddr -is indicated by return of a null pointer. -The external integer -.Va h_errno -may then be checked to see whether this is a temporary failure -or an invalid or unknown host. -The routine -.Fn herror -can be used to print an error message describing the failure. -If its argument -.Fa string -is -.Pf non Dv -NULL , -it is printed, followed by a colon and a space. -The error message is printed with a trailing newline. -.Pp -The variable -.Va h_errno -can have the following values: -.Bl -tag -width HOST_NOT_FOUND -.It Dv HOST_NOT_FOUND -No such host is known. -.It Dv TRY_AGAIN -This is usually a temporary error -and means that the local server did not receive -a response from an authoritative server. -A retry at some later time may succeed. -.It Dv NO_RECOVERY -Some unexpected server failure was encountered. -This is a non-recoverable error. -.It Dv NO_DATA -The requested name is valid but does not have an IP address; -this is not a temporary error. -This means that the name is known to the name server but there is no address -associated with this name. -Another type of request to the name server using this domain name -will result in an answer; -for example, a mail-forwarder may be registered for this domain. -.El -.Sh SEE ALSO -.Xr resolver 3 , -.Xr hosts 5 , -.Xr hostname 7 , -.Xr named 8 -.Sh CAVEAT -The -.Fn gethostent -function -is defined, and -.Fn sethostent -and -.Fn endhostent -are redefined, -when -.Xr libc 3 -is built to use only the routines to lookup in -.Pa /etc/hosts -and not the name server. -.Pp -The -.Fn gethostent -function -reads the next line of -.Pa /etc/hosts , -opening the file if necessary. -.Pp -The -.Fn sethostent -function -opens and/or rewinds the file -.Pa /etc/hosts . -If the -.Fa stayopen -argument is non-zero, -the file will not be closed after each call to -.Fn gethostbyname , -.Fn gethostbyname2 -or -.Fn gethostbyaddr . -.Pp -The -.Fn endhostent -function -closes the file. -.Sh HISTORY -The -.Fn herror -function appeared in -.Bx 4.3 . -The -.Fn endhostent , -.Fn gethostbyaddr , -.Fn gethostbyname , -.Fn gethostent , -and -.Fn sethostent -functions appeared in -.Bx 4.2 . -The -.Fn gethostbyname2 -function first appeared in bind-4.9.4. -.Sh BUGS -These functions use static data storage; -if the data is needed for future use, it should be -copied before any subsequent calls overwrite it. -Only the Internet -address format is currently understood. diff --git a/c/src/exec/libnetworking/libc/gethostbynis.c b/c/src/exec/libnetworking/libc/gethostbynis.c deleted file mode 100644 index 45dbe5a85d..0000000000 --- a/c/src/exec/libnetworking/libc/gethostbynis.c +++ /dev/null @@ -1,142 +0,0 @@ -/*- - * Copyright (c) 1994, Garrett Wollman - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE 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[] = "@(#)$Id$"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef YP -#include -#include -#include -#endif - -#define MAXALIASES 35 -#define MAXADDRS 35 - -#ifdef YP -static char *host_aliases[MAXALIASES]; -static char hostaddr[MAXADDRS]; -static char *host_addrs[2]; -#endif /* YP */ - -static struct hostent * -_gethostbynis(name, map, af) - const char *name; - char *map; - int af; -{ -#ifdef YP - register char *cp, **q; - char *result; - int resultlen; - static struct hostent h; - static char *domain = (char *)NULL; - static char ypbuf[YPMAXRECORD + 2]; - - switch(af) { - case AF_INET: - break; - default: - case AF_INET6: - errno = EAFNOSUPPORT; - return NULL; - } - - if (domain == (char *)NULL) - if (yp_get_default_domain (&domain)) - return ((struct hostent *)NULL); - - if (yp_match(domain, map, name, strlen(name), &result, &resultlen)) - return ((struct hostent *)NULL); - - /* avoid potential memory leak */ - bcopy((char *)result, (char *)&ypbuf, resultlen); - ypbuf[resultlen] = '\0'; - free(result); - result = (char *)&ypbuf; - - if ((cp = index(result, '\n'))) - *cp = '\0'; - - cp = strpbrk(result, " \t"); - *cp++ = '\0'; - h.h_addr_list = host_addrs; - h.h_addr = hostaddr; - *((u_long *)h.h_addr) = inet_addr(result); - h.h_length = sizeof(u_long); - h.h_addrtype = AF_INET; - while (*cp == ' ' || *cp == '\t') - cp++; - h.h_name = cp; - q = h.h_aliases = host_aliases; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; - } - if (q < &host_aliases[MAXALIASES - 1]) - *q++ = cp; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - } - *q = NULL; - return (&h); -#else - return (NULL); -#endif /* YP */ -} - -struct hostent * -_gethostbynisname(name, af) - const char *name; - int af; -{ - return _gethostbynis(name, "hosts.byname", af); -} - -struct hostent * -_gethostbynisaddr(addr, len, af) - const char *addr; - int len; - int af; -{ - return _gethostbynis(inet_ntoa(*(struct in_addr *)addr),"hosts.byaddr", af); -} diff --git a/c/src/exec/libnetworking/libc/gethostnamadr.c b/c/src/exec/libnetworking/libc/gethostnamadr.c deleted file mode 100644 index 92f7a21014..0000000000 --- a/c/src/exec/libnetworking/libc/gethostnamadr.c +++ /dev/null @@ -1,224 +0,0 @@ -/*- - * Copyright (c) 1994, Garrett Wollman - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE 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[] = "@(#)$Id$"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* XXX hack for _res */ -#include /* XXX hack for _res */ - -#define _PATH_HOSTCONF "/etc/host.conf" - -enum service_type { - SERVICE_NONE = 0, - SERVICE_BIND, - SERVICE_HOSTS, - SERVICE_NIS }; -#define SERVICE_MAX SERVICE_NIS - -static struct { - const char *name; - enum service_type type; -} service_names[] = { - { "hosts", SERVICE_HOSTS }, - { "/etc/hosts", SERVICE_HOSTS }, - { "hosttable", SERVICE_HOSTS }, - { "htable", SERVICE_HOSTS }, - { "bind", SERVICE_BIND }, - { "dns", SERVICE_BIND }, - { "domain", SERVICE_BIND }, - { "yp", SERVICE_NIS }, - { "yellowpages", SERVICE_NIS }, - { "nis", SERVICE_NIS }, - { 0, SERVICE_NONE } -}; - -static enum service_type service_order[SERVICE_MAX + 1]; -static int service_done = 0; - -static enum service_type -get_service_name(const char *name) { - int i; - for(i = 0; service_names[i].type != SERVICE_NONE; i++) { - if(!strcasecmp(name, service_names[i].name)) { - return service_names[i].type; - } - } - return SERVICE_NONE; -} - -static void -init_services() -{ - char *cp, *p, buf[BUFSIZ]; - register int cc = 0; - FILE *fd; - - if ((fd = (FILE *)fopen(_PATH_HOSTCONF, "r")) == NULL) { - /* make some assumptions */ - service_order[0] = SERVICE_BIND; - service_order[1] = SERVICE_HOSTS; - service_order[2] = SERVICE_NONE; - } else { - while (fgets(buf, BUFSIZ, fd) != NULL && cc < SERVICE_MAX) { - if(buf[0] == '#') - continue; - - p = buf; - while ((cp = strsep(&p, "\n \t,:;")) != NULL && *cp == '\0') - ; - if (cp == NULL) - continue; - do { - if (isalpha((int)cp[0])) { - service_order[cc] = get_service_name(cp); - if(service_order[cc] != SERVICE_NONE) - cc++; - } - while ((cp = strsep(&p, "\n \t,:;")) != NULL && *cp == '\0') - ; - } while(cp != NULL && cc < SERVICE_MAX); - } - service_order[cc] = SERVICE_NONE; - fclose(fd); - } - service_done = 1; -} - -struct hostent * -gethostbyname(const char *name) -{ - struct hostent *hp; - - if (_res.options & RES_USE_INET6) { /* XXX */ - hp = gethostbyname2(name, AF_INET6); /* XXX */ - if (hp) /* XXX */ - return (hp); /* XXX */ - } /* XXX */ - return (gethostbyname2(name, AF_INET)); -} - -struct hostent * -gethostbyname2(const char *name, int type) -{ - struct hostent *hp = 0; - int nserv = 0; - - if (!service_done) - init_services(); - - while (!hp) { - switch (service_order[nserv]) { - case SERVICE_NONE: - return NULL; - case SERVICE_HOSTS: - hp = _gethostbyhtname(name, type); - break; - case SERVICE_BIND: - hp = _gethostbydnsname(name, type); - break; - case SERVICE_NIS: - hp = _gethostbynisname(name, type); - break; - } - nserv++; - } - return hp; -} - -struct hostent * -gethostbyaddr(const char *addr, int len, int type) -{ - struct hostent *hp = 0; - int nserv = 0; - - if (!service_done) - init_services(); - - while (!hp) { - switch (service_order[nserv]) { - case SERVICE_NONE: - return 0; - case SERVICE_HOSTS: - hp = _gethostbyhtaddr(addr, len, type); - break; - case SERVICE_BIND: - hp = _gethostbydnsaddr(addr, len, type); - break; - case SERVICE_NIS: - hp = _gethostbynisaddr(addr, len, type); - break; - } - nserv++; - } - return hp; -} - -#ifdef _THREAD_SAFE -struct hostent_data; - -/* - * Temporary function (not thread safe) - */ -int gethostbyaddr_r(const char *addr, int len, int type, - struct hostent *result, struct hostent_data *buffer) -{ - struct hostent *hp; - int ret; - if ((hp = gethostbyaddr(addr, len, type)) == NULL) { - ret = -1; - } else { - memcpy(result, hp, sizeof(struct hostent)); - ret = 0; - } - return(ret); -} -#endif - -void -sethostent(stayopen) - int stayopen; -{ - _sethosthtent(stayopen); - _sethostdnsent(stayopen); -} - -void -endhostent() -{ - _endhosthtent(); - _endhostdnsent(); -} diff --git a/c/src/exec/libnetworking/libc/gethostname.c b/c/src/exec/libnetworking/libc/gethostname.c deleted file mode 100644 index 81dc2267c2..0000000000 --- a/c/src/exec/libnetworking/libc/gethostname.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * $Id$ - */ - -#include "config.h" - -/* - * Solaris doesn't include the gethostname call by default. - */ -#include -#include - -#include - -/* - * PUBLIC: #ifndef HAVE_GETHOSTNAME - * PUBLIC: int gethostname __P((char *, int)); - * PUBLIC: #endif - */ -int -gethostname(host, len) - char *host; - int len; -{ - return (sysinfo(SI_HOSTNAME, host, len) == -1 ? -1 : 0); -} diff --git a/c/src/exec/libnetworking/libc/getnetbydns.c b/c/src/exec/libnetworking/libc/getnetbydns.c deleted file mode 100644 index 8f8c576332..0000000000 --- a/c/src/exec/libnetworking/libc/getnetbydns.c +++ /dev/null @@ -1,313 +0,0 @@ -/*- - * Copyright (c) 1985, 1988, 1993 - * 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. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ -/* Portions Copyright (c) 1993 Carlos Leandro and Rui Salgueiro - * Dep. Matematica Universidade de Coimbra, Portugal, Europe - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "res_config.h" - -extern int h_errno; - -#define BYADDR 0 -#define BYNAME 1 -#define MAXALIASES 35 - -#if PACKETSZ > 1024 -#define MAXPACKET PACKETSZ -#else -#define MAXPACKET 1024 -#endif - -typedef union { - HEADER hdr; - u_char buf[MAXPACKET]; -} querybuf; - -typedef union { - long al; - char ac; -} align; - -static struct netent * -getnetanswer(answer, anslen, net_i) - querybuf *answer; - int anslen; - int net_i; -{ - - register HEADER *hp; - register u_char *cp; - register int n; - u_char *eom; - int type, class, buflen, ancount, qdcount, haveanswer, i, nchar; - char aux1[MAXHOSTNAMELEN], aux2[MAXHOSTNAMELEN], ans[MAXHOSTNAMELEN]; - char *in, *st, *pauxt, *bp, **ap; - char *paux1 = &aux1[0], *paux2 = &aux2[0], flag = 0; -static struct netent net_entry; -static char *net_aliases[MAXALIASES], netbuf[PACKETSZ]; - - /* - * find first satisfactory answer - * - * answer --> +------------+ ( MESSAGE ) - * | Header | - * +------------+ - * | Question | the question for the name server - * +------------+ - * | Answer | RRs answering the question - * +------------+ - * | Authority | RRs pointing toward an authority - * | Additional | RRs holding additional information - * +------------+ - */ - eom = answer->buf + anslen; - hp = &answer->hdr; - ancount = ntohs(hp->ancount); /* #/records in the answer section */ - qdcount = ntohs(hp->qdcount); /* #/entries in the question section */ - bp = netbuf; - buflen = sizeof(netbuf); - cp = answer->buf + HFIXEDSZ; - if (!qdcount) { - if (hp->aa) - h_errno = HOST_NOT_FOUND; - else - h_errno = TRY_AGAIN; - return (NULL); - } - while (qdcount-- > 0) - cp += __dn_skipname(cp, eom) + QFIXEDSZ; - ap = net_aliases; - *ap = NULL; - net_entry.n_aliases = net_aliases; - haveanswer = 0; - while (--ancount >= 0 && cp < eom) { - n = dn_expand(answer->buf, eom, cp, bp, buflen); - if ((n < 0) || !res_dnok(bp)) - break; - cp += n; - ans[0] = '\0'; - (void)strncpy(&ans[0], bp, sizeof(ans) - 1); - ans[sizeof(ans) - 1] = '\0'; - GETSHORT(type, cp); - GETSHORT(class, cp); - cp += INT32SZ; /* TTL */ - GETSHORT(n, cp); - if (class == C_IN && type == T_PTR) { - n = dn_expand(answer->buf, eom, cp, bp, buflen); - if ((n < 0) || !res_hnok(bp)) { - cp += n; - return (NULL); - } - cp += n; - *ap++ = bp; - bp += strlen(bp) + 1; - net_entry.n_addrtype = - (class == C_IN) ? AF_INET : AF_UNSPEC; - haveanswer++; - } - } - if (haveanswer) { - *ap = NULL; - switch (net_i) { - case BYADDR: - net_entry.n_name = *net_entry.n_aliases; - net_entry.n_net = 0L; - break; - case BYNAME: - in = *net_entry.n_aliases; - net_entry.n_name = &ans[0]; - aux2[0] = '\0'; - for (i = 0; i < 4; i++) { - for (st = in, nchar = 0; - *st != '.'; - st++, nchar++) - ; - if (nchar != 1 || *in != '0' || flag) { - flag = 1; - (void)strncpy(paux1, - (i==0) ? in : in-1, - (i==0) ?nchar : nchar+1); - paux1[(i==0) ? nchar : nchar+1] = '\0'; - pauxt = paux2; - paux2 = strcat(paux1, paux2); - paux1 = pauxt; - } - in = ++st; - } - net_entry.n_net = inet_network(paux2); - break; - } - net_entry.n_aliases++; - return (&net_entry); - } - h_errno = TRY_AGAIN; - return (NULL); -} - -struct netent * -_getnetbydnsaddr(net, net_type) - register unsigned long net; - register int net_type; -{ - unsigned int netbr[4]; - int nn, anslen; - querybuf buf; - char qbuf[MAXDNAME]; - unsigned long net2; - struct netent *net_entry; - - if (net_type != AF_INET) - return (NULL); - - for (nn = 4, net2 = net; net2; net2 >>= 8) - netbr[--nn] = net2 & 0xff; - switch (nn) { - case 3: /* Class A */ - sprintf(qbuf, "0.0.0.%u.in-addr.arpa", netbr[3]); - break; - case 2: /* Class B */ - sprintf(qbuf, "0.0.%u.%u.in-addr.arpa", netbr[3], netbr[2]); - break; - case 1: /* Class C */ - sprintf(qbuf, "0.%u.%u.%u.in-addr.arpa", netbr[3], netbr[2], - netbr[1]); - break; - case 0: /* Class D - E */ - sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa", netbr[3], netbr[2], - netbr[1], netbr[0]); - break; - } - anslen = res_query(qbuf, C_IN, T_PTR, (u_char *)&buf, sizeof(buf)); - if (anslen < 0) { -#ifdef DEBUG - if (_res.options & RES_DEBUG) - printf("res_query failed\n"); -#endif - return (NULL); - } - net_entry = getnetanswer(&buf, anslen, BYADDR); - if (net_entry) { - unsigned u_net = net; /* maybe net should be unsigned ? */ - - /* Strip trailing zeros */ - while ((u_net & 0xff) == 0 && u_net != 0) - u_net >>= 8; - net_entry->n_net = u_net; - return (net_entry); - } - return (NULL); -} - -struct netent * -_getnetbydnsname(net) - register const char *net; -{ - int anslen; - querybuf buf; - char qbuf[MAXDNAME]; - - if ((_res.options & RES_INIT) == 0 && res_init() == -1) { - h_errno = NETDB_INTERNAL; - return (NULL); - } - strncpy(qbuf, net, sizeof(qbuf) - 1); - qbuf[sizeof(qbuf) - 1] = '\0'; - anslen = res_search(qbuf, C_IN, T_PTR, (u_char *)&buf, sizeof(buf)); - if (anslen < 0) { -#ifdef DEBUG - if (_res.options & RES_DEBUG) - printf("res_query failed\n"); -#endif - return (NULL); - } - return getnetanswer(&buf, anslen, BYNAME); -} - -void -_setnetdnsent(stayopen) - int stayopen; -{ - if (stayopen) - _res.options |= RES_STAYOPEN | RES_USEVC; -} - -void -_endnetdnsent() -{ - _res.options &= ~(RES_STAYOPEN | RES_USEVC); - res_close(); -} diff --git a/c/src/exec/libnetworking/libc/getnetbyht.c b/c/src/exec/libnetworking/libc/getnetbyht.c deleted file mode 100644 index f7b7b1091d..0000000000 --- a/c/src/exec/libnetworking/libc/getnetbyht.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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. - */ - -/* Portions Copyright (c) 1993 Carlos Leandro and Rui Salgueiro - * Dep. Matematica Universidade de Coimbra, Portugal, Europe - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * from getnetent.c 1.1 (Coimbra) 93/06/02 - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93"; -static char orig_rcsid[] = "From: Id: getnetent.c,v 8.4 1997/06/01 20:34:37 vixie Exp"; -static chat rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define MAXALIASES 35 - -static FILE *netf; -static char line[BUFSIZ+1]; -static struct netent net; -static char *net_aliases[MAXALIASES]; -static int _net_stayopen; - -void -_setnethtent(f) - int f; -{ - - if (netf == NULL) - netf = fopen(_PATH_NETWORKS, "r" ); - else - rewind(netf); - _net_stayopen |= f; -} - -void -_endnethtent() -{ - - if (netf) { - fclose(netf); - netf = NULL; - } - _net_stayopen = 0; -} - -struct netent * -getnetent() -{ - char *p; - register char *cp, **q; - - if (netf == NULL && (netf = fopen(_PATH_NETWORKS, "r" )) == NULL) - return (NULL); -again: - p = fgets(line, sizeof line, netf); - if (p == NULL) - return (NULL); - if (*p == '#') - goto again; - cp = strpbrk(p, "#\n"); - if (cp == NULL) - goto again; - *cp = '\0'; - net.n_name = p; - cp = strpbrk(p, " \t"); - if (cp == NULL) - goto again; - *cp++ = '\0'; - while (*cp == ' ' || *cp == '\t') - cp++; - p = strpbrk(cp, " \t"); - if (p != NULL) - *p++ = '\0'; - net.n_net = inet_network(cp); - net.n_addrtype = AF_INET; - q = net.n_aliases = net_aliases; - if (p != NULL) - cp = p; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; - } - if (q < &net_aliases[MAXALIASES - 1]) - *q++ = cp; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - } - *q = NULL; - return (&net); -} - -struct netent * -_getnetbyhtname(name) - register const char *name; -{ - register struct netent *p; - register char **cp; - - setnetent(_net_stayopen); - while ( (p = getnetent()) ) { - if (strcasecmp(p->n_name, name) == 0) - break; - for (cp = p->n_aliases; *cp != 0; cp++) - if (strcasecmp(*cp, name) == 0) - goto found; - } -found: - if (!_net_stayopen) - endnetent(); - return (p); -} - -struct netent * -_getnetbyhtaddr(net, type) - register unsigned long net; - register int type; -{ - register struct netent *p; - - setnetent(_net_stayopen); - while ( (p = getnetent()) ) - if (p->n_addrtype == type && p->n_net == net) - break; - if (!_net_stayopen) - endnetent(); - return (p); -} diff --git a/c/src/exec/libnetworking/libc/getnetbynis.c b/c/src/exec/libnetworking/libc/getnetbynis.c deleted file mode 100644 index 0549016ba2..0000000000 --- a/c/src/exec/libnetworking/libc/getnetbynis.c +++ /dev/null @@ -1,177 +0,0 @@ -/*- - * Copyright (c) 1994, Garrett Wollman - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE 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[] = "@(#)$Id$"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef YP -#include -#include -#include -#endif - -#define MAXALIASES 35 -#define MAXADDRS 35 - -#ifdef YP -static char *host_aliases[MAXALIASES]; -#endif /* YP */ - -static struct netent * -_getnetbynis(name, map, af) - const char *name; - char *map; - int af; -{ -#ifdef YP - register char *cp, **q; - static char *result; - int resultlen; - static struct netent h; - static char *domain = (char *)NULL; - static char ypbuf[YPMAXRECORD + 2]; - - switch(af) { - case AF_INET: - break; - default: - case AF_INET6: - errno = EAFNOSUPPORT; - return NULL; - } - - if (domain == (char *)NULL) - if (yp_get_default_domain (&domain)) - return (NULL); - - if (yp_match(domain, map, name, strlen(name), &result, &resultlen)) - return (NULL); - - bcopy((char *)result, (char *)&ypbuf, resultlen); - ypbuf[resultlen] = '\0'; - free(result); - result = (char *)&ypbuf; - - if ((cp = index(result, '\n'))) - *cp = '\0'; - - cp = strpbrk(result, " \t"); - *cp++ = '\0'; - h.n_name = result; - - while (*cp == ' ' || *cp == '\t') - cp++; - - h.n_net = inet_network(cp); - h.n_addrtype = AF_INET; - - q = h.n_aliases = host_aliases; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; - } - if (q < &host_aliases[MAXALIASES - 1]) - *q++ = cp; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - } - *q = NULL; - return (&h); -#else - return (NULL); -#endif -} - -struct netent * -_getnetbynisname(name) - const char *name; -{ - return _getnetbynis(name, "networks.byname", AF_INET); -} - -struct netent * -_getnetbynisaddr(addr, af) - unsigned long addr; - int af; -{ - char *str, *cp; - unsigned long net2; - int nn; - unsigned int netbr[4]; - char buf[MAXDNAME]; - - if (af != AF_INET) { - errno = EAFNOSUPPORT; - return (NULL); - } - - for (nn = 4, net2 = addr; net2; net2 >>= 8) { - netbr[--nn] = net2 & 0xff; - } - - switch (nn) { - case 3: /* Class A */ - sprintf(buf, "%u", netbr[3]); - break; - case 2: /* Class B */ - sprintf(buf, "%u.%u", netbr[2], netbr[3]); - break; - case 1: /* Class C */ - sprintf(buf, "%u.%u.%u", netbr[1], netbr[2], netbr[3]); - break; - case 0: /* Class D - E */ - sprintf(buf, "%u.%u.%u.%u", netbr[0], netbr[1], - netbr[2], netbr[3]); - break; - } - - str = (char *)&buf; - cp = str + (strlen(str) - 2); - - while(!strcmp(cp, ".0")) { - *cp = '\0'; - cp = str + (strlen(str) - 2); - } - - return _getnetbynis(str, "networks.byaddr", af); -} diff --git a/c/src/exec/libnetworking/libc/getnetent.3 b/c/src/exec/libnetworking/libc/getnetent.3 deleted file mode 100644 index aec93b5876..0000000000 --- a/c/src/exec/libnetworking/libc/getnetent.3 +++ /dev/null @@ -1,159 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" 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. -.\" -.\" @(#)getnetent.3 8.1 (Berkeley) 6/4/93 -.\" $Id$ -.\" -.Dd June 4, 1993 -.Dt GETNETENT 3 -.Os BSD 4.2 -.Sh NAME -.Nm getnetent , -.Nm getnetbyaddr , -.Nm getnetbyname , -.Nm setnetent , -.Nm endnetent -.Nd get network entry -.Sh SYNOPSIS -.Fd #include -.Ft struct netent * -.Fn getnetent void -.Ft struct netent * -.Fn getnetbyname "const char *name" -.Ft struct netent * -.Fn getnetbyaddr "unsigned long net" "int type" -.Ft void -.Fn setnetent "int stayopen" -.Ft void -.Fn endnetent void -.Sh DESCRIPTION -The -.Fn getnetent , -.Fn getnetbyname , -and -.Fn getnetbyaddr -functions -each return a pointer to an object with the -following structure -containing the broken-out -fields of a line in the network data base, -.Pa /etc/networks . -.Bd -literal -offset indent -struct netent { - char *n_name; /* official name of net */ - char **n_aliases; /* alias list */ - int n_addrtype; /* net number type */ - unsigned long n_net; /* net number */ -}; -.Ed -.Pp -The members of this structure are: -.Bl -tag -width n_addrtype -.It Fa n_name -The official name of the network. -.It Fa n_aliases -A zero terminated list of alternate names for the network. -.It Fa n_addrtype -The type of the network number returned; currently only AF_INET. -.It Fa n_net -The network number. Network numbers are returned in machine byte -order. -.El -.Pp -The -.Fn getnetent -function -reads the next line of the file, opening the file if necessary. -.Pp -The -.Fn setnetent -function -opens and rewinds the file. If the -.Fa stayopen -flag is non-zero, -the net data base will not be closed after each call to -.Fn getnetbyname -or -.Fn getnetbyaddr . -.Pp -The -.Fn endnetent -function -closes the file. -.Pp -The -.Fn getnetbyname -function -and -.Fn getnetbyaddr -sequentially search from the beginning -of the file until a matching -net name or -net address and type is found, -or until -.Dv EOF -is encountered. The -.Fa type -must be -.Dv AF_INET . -Network numbers are supplied in host order. -.Sh FILES -.Bl -tag -width /etc/networks -compact -.It Pa /etc/networks -.El -.Sh DIAGNOSTICS -Null pointer -(0) returned on -.Dv EOF -or error. -.Sh SEE ALSO -.Xr networks 5 -.Pp -.%T RFC 1101 -.Sh HISTORY -The -.Fn getnetent , -.Fn getnetbyaddr , -.Fn getnetbyname , -.Fn setnetent , -and -.Fn endnetent -functions appeared in -.Bx 4.2 . -.Sh BUGS -The data space used by -these functions is static; if future use requires the data, it should be -copied before any subsequent calls to these functions overwrite it. -Only Internet network -numbers are currently understood. -Expecting network numbers to fit -in no more than 32 bits is probably -naive. diff --git a/c/src/exec/libnetworking/libc/getnetnamadr.c b/c/src/exec/libnetworking/libc/getnetnamadr.c deleted file mode 100644 index 4d6597f98c..0000000000 --- a/c/src/exec/libnetworking/libc/getnetnamadr.c +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * Copyright (c) 1994, Garrett Wollman - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE 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 rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _PATH_NETCONF -#define _PATH_NETCONF "/etc/host.conf" -#endif - -enum service_type { - SERVICE_NONE = 0, - SERVICE_BIND, - SERVICE_TABLE, - SERVICE_NIS }; -#define SERVICE_MAX SERVICE_NIS - -static struct { - const char *name; - enum service_type type; -} service_names[] = { - { "hosts", SERVICE_TABLE }, - { "/etc/hosts", SERVICE_TABLE }, - { "hosttable", SERVICE_TABLE }, - { "htable", SERVICE_TABLE }, - { "bind", SERVICE_BIND }, - { "dns", SERVICE_BIND }, - { "domain", SERVICE_BIND }, - { "yp", SERVICE_NIS }, - { "yellowpages", SERVICE_NIS }, - { "nis", SERVICE_NIS }, - { 0, SERVICE_NONE } -}; - -static enum service_type service_order[SERVICE_MAX + 1]; -static int service_done = 0; - -static enum service_type -get_service_name(const char *name) { - int i; - for(i = 0; service_names[i].type != SERVICE_NONE; i++) { - if(!strcasecmp(name, service_names[i].name)) { - return service_names[i].type; - } - } - return SERVICE_NONE; -} - -static void -init_services() -{ - char *cp, *p, buf[BUFSIZ]; - register int cc = 0; - FILE *fd; - - if ((fd = (FILE *)fopen(_PATH_NETCONF, "r")) == NULL) { - /* make some assumptions */ - service_order[0] = SERVICE_TABLE; - service_order[1] = SERVICE_NONE; - } else { - while (fgets(buf, BUFSIZ, fd) != NULL && cc < SERVICE_MAX) { - if(buf[0] == '#') - continue; - - p = buf; - while ((cp = strsep(&p, "\n \t,:;")) != NULL && *cp == '\0') - ; - if (cp == NULL) - continue; - do { - if (isalpha(cp[0])) { - service_order[cc] = get_service_name(cp); - if(service_order[cc] != SERVICE_NONE) - cc++; - } - while ((cp = strsep(&p, "\n \t,:;")) != NULL && *cp == '\0') - ; - } while(cp != NULL && cc < SERVICE_MAX); - } - service_order[cc] = SERVICE_NONE; - fclose(fd); - } - service_done = 1; -} - -struct netent * -getnetbyname(const char *name) -{ - struct netent *hp = 0; - int nserv = 0; - - if (!service_done) - init_services(); - - while (!hp) { - switch (service_order[nserv]) { - case SERVICE_NONE: - return NULL; - case SERVICE_TABLE: - hp = _getnetbyhtname(name); - break; - case SERVICE_BIND: - hp = _getnetbydnsname(name); - break; - case SERVICE_NIS: - hp = _getnetbynisname(name); - break; - } - nserv++; - } - return hp; -} - -struct netent * -getnetbyaddr(addr, af) - u_long addr; - int af; -{ - struct netent *hp = 0; - int nserv = 0; - - if (!service_done) - init_services(); - - while (!hp) { - switch (service_order[nserv]) { - case SERVICE_NONE: - return 0; - case SERVICE_TABLE: - hp = _getnetbyhtaddr(addr, af); - break; - case SERVICE_BIND: - hp = _getnetbydnsaddr(addr, af); - break; - case SERVICE_NIS: - hp = _getnetbynisaddr(addr, af); - break; - } - nserv++; - } - return hp; -} - -void -setnetent(stayopen) - int stayopen; -{ - _setnethtent(stayopen); - _setnetdnsent(stayopen); -} - -void -endnetent() -{ - _endnethtent(); - _endnetdnsent(); -} diff --git a/c/src/exec/libnetworking/libc/getproto.c b/c/src/exec/libnetworking/libc/getproto.c deleted file mode 100644 index c2a653f4b4..0000000000 --- a/c/src/exec/libnetworking/libc/getproto.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)getproto.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include - -extern int _proto_stayopen; - -struct protoent * -getprotobynumber(proto) - register int proto; -{ - register struct protoent *p; - - setprotoent(_proto_stayopen); - while ( (p = getprotoent()) ) - if (p->p_proto == proto) - break; - if (!_proto_stayopen) - endprotoent(); - return (p); -} diff --git a/c/src/exec/libnetworking/libc/getprotoent.3 b/c/src/exec/libnetworking/libc/getprotoent.3 deleted file mode 100644 index 784461d7e3..0000000000 --- a/c/src/exec/libnetworking/libc/getprotoent.3 +++ /dev/null @@ -1,147 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" 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. -.\" -.\" @(#)getprotoent.3 8.1 (Berkeley) 6/4/93 -.\" $Id$ -.\" -.Dd June 4, 1993 -.Dt GETPROTOENT 3 -.Os BSD 4.2 -.Sh NAME -.Nm getprotoent , -.Nm getprotobynumber , -.Nm getprotobyname , -.Nm setprotoent , -.Nm endprotoent -.Nd get protocol entry -.Sh SYNOPSIS -.Fd #include -.Ft struct protoent * -.Fn getprotoent void -.Ft struct protoent * -.Fn getprotobyname "const char *name" -.Ft struct protoent * -.Fn getprotobynumber "int proto" -.Ft void -.Fn setprotoent "int stayopen" -.Ft void -.Fn endprotoent void -.Sh DESCRIPTION -The -.Fn getprotoent , -.Fn getprotobyname , -and -.Fn getprotobynumber -functions -each return a pointer to an object with the -following structure -containing the broken-out -fields of a line in the network protocol data base, -.Pa /etc/protocols . -.Bd -literal -offset indent -.Pp -struct protoent { - char *p_name; /* official name of protocol */ - char **p_aliases; /* alias list */ - int p_proto; /* protocol number */ -}; -.Ed -.Pp -The members of this structure are: -.Bl -tag -width p_aliases -.It Fa p_name -The official name of the protocol. -.It Fa p_aliases -A zero terminated list of alternate names for the protocol. -.It Fa p_proto -The protocol number. -.El -.Pp -The -.Fn getprotoent -function -reads the next line of the file, opening the file if necessary. -.Pp -The -.Fn setprotoent -function -opens and rewinds the file. If the -.Fa stayopen -flag is non-zero, -the net data base will not be closed after each call to -.Fn getprotobyname -or -.Fn getprotobynumber . -.Pp -The -.Fn endprotoent -function -closes the file. -.Pp -The -.Fn getprotobyname -function -and -.Fn getprotobynumber -sequentially search from the beginning -of the file until a matching -protocol name or -protocol number is found, -or until -.Dv EOF -is encountered. -.Sh RETURN VALUES -Null pointer -(0) returned on -.Dv EOF -or error. -.Sh FILES -.Bl -tag -width /etc/protocols -compact -.It Pa /etc/protocols -.El -.Sh SEE ALSO -.Xr protocols 5 -.Sh HISTORY -The -.Fn getprotoent , -.Fn getprotobynumber , -.Fn getprotobyname , -.Fn setprotoent , -and -.Fn endprotoent -functions appeared in -.Bx 4.2 . -.Sh BUGS -These functions use a static data space; -if the data is needed for future use, it should be -copied before any subsequent calls overwrite it. -Only the Internet -protocols are currently understood. diff --git a/c/src/exec/libnetworking/libc/getprotoent.c b/c/src/exec/libnetworking/libc/getprotoent.c deleted file mode 100644 index 0b9cefec68..0000000000 --- a/c/src/exec/libnetworking/libc/getprotoent.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)getprotoent.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include - -#define MAXALIASES 35 - -static FILE *protof = NULL; -static char line[BUFSIZ+1]; -static struct protoent proto; -static char *proto_aliases[MAXALIASES]; -int _proto_stayopen; - -void -setprotoent(f) - int f; -{ - if (protof == NULL) - protof = fopen(_PATH_PROTOCOLS, "r" ); - else - rewind(protof); - _proto_stayopen |= f; -} - -void -endprotoent() -{ - if (protof) { - fclose(protof); - protof = NULL; - } - _proto_stayopen = 0; -} - -struct protoent * -getprotoent() -{ - char *p; - register char *cp, **q; - - if (protof == NULL && (protof = fopen(_PATH_PROTOCOLS, "r" )) == NULL) - return (NULL); -again: - if ((p = fgets(line, BUFSIZ, protof)) == NULL) - return (NULL); - if (*p == '#') - goto again; - cp = strpbrk(p, "#\n"); - if (cp == NULL) - goto again; - *cp = '\0'; - proto.p_name = p; - cp = strpbrk(p, " \t"); - if (cp == NULL) - goto again; - *cp++ = '\0'; - while (*cp == ' ' || *cp == '\t') - cp++; - p = strpbrk(cp, " \t"); - if (p != NULL) - *p++ = '\0'; - proto.p_proto = atoi(cp); - q = proto.p_aliases = proto_aliases; - if (p != NULL) { - cp = p; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; - } - if (q < &proto_aliases[MAXALIASES - 1]) - *q++ = cp; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - } - } - *q = NULL; - return (&proto); -} diff --git a/c/src/exec/libnetworking/libc/getprotoname.c b/c/src/exec/libnetworking/libc/getprotoname.c deleted file mode 100644 index 46880eb005..0000000000 --- a/c/src/exec/libnetworking/libc/getprotoname.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)getprotoname.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -extern int _proto_stayopen; - -struct protoent * -getprotobyname(name) - register const char *name; -{ - register struct protoent *p; - register char **cp; - - setprotoent(_proto_stayopen); - while ( (p = getprotoent()) ) { - if (strcmp(p->p_name, name) == 0) - break; - for (cp = p->p_aliases; *cp != 0; cp++) - if (strcmp(*cp, name) == 0) - goto found; - } -found: - if (!_proto_stayopen) - endprotoent(); - return (p); -} diff --git a/c/src/exec/libnetworking/libc/getservbyname.c b/c/src/exec/libnetworking/libc/getservbyname.c deleted file mode 100644 index 19936907d3..0000000000 --- a/c/src/exec/libnetworking/libc/getservbyname.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)getservbyname.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -extern int _serv_stayopen; - -struct servent * -getservbyname(name, proto) - const char *name, *proto; -{ - register struct servent *p; - register char **cp; - -#ifdef YP - extern char *___getservbyname_yp; - extern char *___getservbyproto_yp; - - ___getservbyname_yp = (char *)name; - ___getservbyproto_yp = (char *)proto; -#endif - - setservent(_serv_stayopen); - while ( (p = getservent()) ) { - if (strcmp(name, p->s_name) == 0) - goto gotname; - for (cp = p->s_aliases; *cp; cp++) - if (strcmp(name, *cp) == 0) - goto gotname; - continue; -gotname: - if (proto == 0 || strcmp(p->s_proto, proto) == 0) - break; - } - if (!_serv_stayopen) - endservent(); - -#ifdef YP - ___getservbyname_yp = NULL; - ___getservbyproto_yp = NULL; -#endif - - return (p); -} diff --git a/c/src/exec/libnetworking/libc/getservbyport.c b/c/src/exec/libnetworking/libc/getservbyport.c deleted file mode 100644 index c8433954e1..0000000000 --- a/c/src/exec/libnetworking/libc/getservbyport.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)getservbyport.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -extern int _serv_stayopen; - -struct servent * -getservbyport(port, proto) - int port; - const char *proto; -{ - register struct servent *p; - -#ifdef YP - extern int ___getservbyport_yp; - extern char *___getservbyproto_yp; - - ___getservbyport_yp = port; - ___getservbyproto_yp = (char *)proto; -#endif - - setservent(_serv_stayopen); - while ( (p = getservent()) ) { - if (p->s_port != port) - continue; - if (proto == 0 || strcmp(p->s_proto, proto) == 0) - break; - } - if (!_serv_stayopen) - endservent(); - -#ifdef YP - ___getservbyport_yp = 0; - ___getservbyproto_yp = NULL; -#endif - - return (p); -} diff --git a/c/src/exec/libnetworking/libc/getservent.3 b/c/src/exec/libnetworking/libc/getservent.3 deleted file mode 100644 index 79c18a3beb..0000000000 --- a/c/src/exec/libnetworking/libc/getservent.3 +++ /dev/null @@ -1,156 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" 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. -.\" -.\" From: @(#)getservent.3 8.3 (Berkeley) 1/12/94 -.\" $Id$ -.\" -.Dd July 9, 1995 -.Dt GETSERVENT 3 -.Os BSD 4.2 -.Sh NAME -.Nm getservent , -.Nm getservbyport , -.Nm getservbyname , -.Nm setservent , -.Nm endservent -.Nd get service entry -.Sh SYNOPSIS -.Fd #include -.Ft struct servent * -.Fn getservent -.Ft struct servent * -.Fn getservbyname "const char *name" "const char *proto" -.Ft struct servent * -.Fn getservbyport "int port" "const char *proto" -.Ft void -.Fn setservent "int stayopen" -.Ft void -.Fn endservent void -.Sh DESCRIPTION -The -.Fn getservent , -.Fn getservbyname , -and -.Fn getservbyport -functions -each return a pointer to an object with the -following structure -containing the broken-out -fields of a line in the network services data base, -.Pa /etc/services . -.Bd -literal -offset indent -struct servent { - char *s_name; /* official name of service */ - char **s_aliases; /* alias list */ - int s_port; /* port service resides at */ - char *s_proto; /* protocol to use */ -}; -.Ed -.Pp -The members of this structure are: -.Bl -tag -width s_aliases -.It Fa s_name -The official name of the service. -.It Fa s_aliases -A zero terminated list of alternate names for the service. -.It Fa s_port -The port number at which the service resides. -Port numbers are returned in network byte order. -.It Fa s_proto -The name of the protocol to use when contacting the -service. -.El -.Pp -The -.Fn getservent -function -reads the next line of the file, opening the file if necessary. -.Pp -The -.Fn setservent -function -opens and rewinds the file. If the -.Fa stayopen -flag is non-zero, -the net data base will not be closed after each call to -.Fn getservbyname -or -.Fn getservbyport . -.Pp -The -.Fn endservent -function -closes the file. -.Pp -The -.Fn getservbyname -and -.Fn getservbyport -functions -sequentially search from the beginning -of the file until a matching -protocol name or -port number is found, -or until -.Dv EOF -is encountered. -If a protocol name is also supplied (non- -.Dv NULL ) , -searches must also match the protocol. -.ne 1i -.Sh FILES -.Bl -tag -width /etc/services -compact -.It Pa /etc/services -.El -.Sh DIAGNOSTICS -Null pointer -(0) returned on -.Dv EOF -or error. -.Sh SEE ALSO -.Xr getprotoent 3 , -.Xr services 5 -.Sh HISTORY -The -.Fn getservent , -.Fn getservbyport , -.Fn getservbyname , -.Fn setservent , -and -.Fn endservent -functions appeared in -.Bx 4.2 . -.Sh BUGS -These functions use static data storage; -if the data is needed for future use, it should be -copied before any subsequent calls overwrite it. -Expecting port numbers to fit in a 32 bit -quantity is probably naive. diff --git a/c/src/exec/libnetworking/libc/getservent.c b/c/src/exec/libnetworking/libc/getservent.c deleted file mode 100644 index 08a05c0975..0000000000 --- a/c/src/exec/libnetworking/libc/getservent.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#ifdef YP -#include -#include -#include -static int serv_stepping_yp = 0; -extern int _yp_check __P(( char ** )); -#endif - - -#define MAXALIASES 35 - -static FILE *servf = NULL; -static char line[BUFSIZ+1]; -static struct servent serv; -static char *serv_aliases[MAXALIASES]; -int _serv_stayopen; - -#ifdef YP -char *___getservbyname_yp = NULL; -char *___getservbyproto_yp = NULL; -int ___getservbyport_yp = 0; -static char *yp_domain = NULL; - -static int -_getservbyport_yp(line) - char *line; -{ - char *result; - int resultlen; - char buf[YPMAXRECORD + 2]; - int rv; - - snprintf(buf, sizeof(buf), "%d/%s", ntohs(___getservbyport_yp), - ___getservbyproto_yp); - - ___getservbyport_yp = 0; - ___getservbyproto_yp = NULL; - - if(!yp_domain) { - if(yp_get_default_domain(&yp_domain)) - return (0); - } - - /* - * We have to be a little flexible here. Ideally you're supposed - * to have both a services.byname and a services.byport map, but - * some systems have only services.byname. FreeBSD cheats a little - * by putting the services.byport information in the same map as - * services.byname so that either case will work. We allow for both - * possibilities here: if there is no services.byport map, we try - * services.byname instead. - */ - if ((rv = yp_match(yp_domain, "services.byport", buf, strlen(buf), - &result, &resultlen))) { - if (rv == YPERR_MAP) { - if (yp_match(yp_domain, "services.byname", buf, - strlen(buf), &result, &resultlen)) - return(0); - } else - return(0); - } - - /* getservent() expects lines terminated with \n -- make it happy */ - snprintf(line, BUFSIZ, "%.*s\n", resultlen, result); - - free(result); - return(1); -} - -static int -_getservbyname_yp(line) - char *line; -{ - char *result; - int resultlen; - char buf[YPMAXRECORD + 2]; - - if(!yp_domain) { - if(yp_get_default_domain(&yp_domain)) - return (0); - } - - snprintf(buf, sizeof(buf), "%s/%s", ___getservbyname_yp, - ___getservbyproto_yp); - - ___getservbyname_yp = 0; - ___getservbyproto_yp = NULL; - - if (yp_match(yp_domain, "services.byname", buf, strlen(buf), - &result, &resultlen)) { - return(0); - } - - /* getservent() expects lines terminated with \n -- make it happy */ - snprintf(line, BUFSIZ, "%.*s\n", resultlen, result); - - free(result); - return(1); -} - -static int -_getservent_yp(line) - char *line; -{ - static char *key = NULL; - static int keylen; - char *lastkey, *result; - int resultlen; - int rv; - - if(!yp_domain) { - if(yp_get_default_domain(&yp_domain)) - return (0); - } - - if (!serv_stepping_yp) { - if (key) - free(key); - if ((rv = yp_first(yp_domain, "services.byname", &key, &keylen, - &result, &resultlen))) { - serv_stepping_yp = 0; - return(0); - } - serv_stepping_yp = 1; - } else { - lastkey = key; - rv = yp_next(yp_domain, "services.byname", key, keylen, &key, - &keylen, &result, &resultlen); - free(lastkey); - if (rv) { - serv_stepping_yp = 0; - return (0); - } - } - - /* getservent() expects lines terminated with \n -- make it happy */ - snprintf(line, BUFSIZ, "%.*s\n", resultlen, result); - - free(result); - - return(1); -} -#endif - -void -setservent(f) - int f; -{ - if (servf == NULL) - servf = fopen(_PATH_SERVICES, "r" ); - else - rewind(servf); - _serv_stayopen |= f; -} - -void -endservent() -{ - if (servf) { - fclose(servf); - servf = NULL; - } - _serv_stayopen = 0; -} - -struct servent * -getservent() -{ - char *p; - register char *cp, **q; - -#ifdef YP - if (serv_stepping_yp && _getservent_yp(line)) { - p = (char *)&line; - goto unpack; - } -tryagain: -#endif - if (servf == NULL && (servf = fopen(_PATH_SERVICES, "r" )) == NULL) - return (NULL); -again: - if ((p = fgets(line, BUFSIZ, servf)) == NULL) - return (NULL); -#ifdef YP - if (*p == '+' && _yp_check(NULL)) { - if (___getservbyname_yp != NULL) { - if (!_getservbyname_yp(line)) - goto tryagain; - } - else if (___getservbyport_yp != 0) { - if (!_getservbyport_yp(line)) - goto tryagain; - } - else if (!_getservent_yp(line)) - goto tryagain; - } -unpack: -#endif - if (*p == '#') - goto again; - cp = strpbrk(p, "#\n"); - if (cp == NULL) - goto again; - *cp = '\0'; - serv.s_name = p; - p = strpbrk(p, " \t"); - if (p == NULL) - goto again; - *p++ = '\0'; - while (*p == ' ' || *p == '\t') - p++; - cp = strpbrk(p, ",/"); - if (cp == NULL) - goto again; - *cp++ = '\0'; - serv.s_port = htons((u_short)atoi(p)); - serv.s_proto = cp; - q = serv.s_aliases = serv_aliases; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; - } - if (q < &serv_aliases[MAXALIASES - 1]) - *q++ = cp; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - } - *q = NULL; - return (&serv); -} diff --git a/c/src/exec/libnetworking/libc/herror.c b/c/src/exec/libnetworking/libc/herror.c deleted file mode 100644 index ba1dae934d..0000000000 --- a/c/src/exec/libnetworking/libc/herror.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 1987, 1993 - * 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. - */ - -/* - * Portions Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include - -const char *h_errlist[] = { - "Resolver Error 0 (no error)", - "Unknown host", /* 1 HOST_NOT_FOUND */ - "Host name lookup failure", /* 2 TRY_AGAIN */ - "Unknown server error", /* 3 NO_RECOVERY */ - "No address associated with name", /* 4 NO_ADDRESS */ -}; -int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] }; - -int h_errno; - -/* - * herror -- - * print the error indicated by the h_errno value. - */ -void -herror(s) - const char *s; -{ -#if 0 - struct iovec iov[4]; - register struct iovec *v = iov; - - if (s && *s) { - v->iov_base = (char *)s; - v->iov_len = strlen(s); - v++; - v->iov_base = ": "; - v->iov_len = 2; - v++; - } - v->iov_base = (char *)hstrerror(h_errno); - v->iov_len = strlen(v->iov_base); - v++; - v->iov_base = "\n"; - v->iov_len = 1; - writev(STDERR_FILENO, iov, (v - iov) + 1); -#else - /* - * RTEMS: no writev yet - */ - if (s && *s) { - write (2, s, strlen (s)); - write (2, ": ", 2); - } - s = (char *)hstrerror(h_errno); - write (2, s, strlen (s)); - write (2, "\n", 1); -#endif -} - -const char * -hstrerror(err) - int err; -{ - if (err < 0) - return ("Resolver internal error"); - else if (err < h_nerr) - return (h_errlist[err]); - return ("Unknown resolver error"); -} diff --git a/c/src/exec/libnetworking/libc/inet.3 b/c/src/exec/libnetworking/libc/inet.3 deleted file mode 100644 index 1052f538f2..0000000000 --- a/c/src/exec/libnetworking/libc/inet.3 +++ /dev/null @@ -1,210 +0,0 @@ -.\" Copyright (c) 1983, 1990, 1991, 1993 -.\" 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. -.\" -.\" From: @(#)inet.3 8.1 (Berkeley) 6/4/93 -.\" $Id$ -.\" -.Dd June 17, 1996 -.Dt INET 3 -.Os BSD 4.2 -.Sh NAME -.Nm inet_aton , -.Nm inet_addr , -.Nm inet_network , -.Nm inet_ntoa , -.Nm inet_makeaddr , -.Nm inet_lnaof , -.Nm inet_netof -.Nd Internet address manipulation routines -.Sh SYNOPSIS -.Fd #include -.Fd #include -.Fd #include -.Fd #include -.Ft int -.Fn inet_aton "const char *cp" "struct in_addr *pin" -.Ft unsigned long -.Fn inet_addr "const char *cp" -.Ft unsigned long -.Fn inet_network "const char *cp" -.Ft char * -.Fn inet_ntoa "struct in_addr in" -.Ft struct in_addr -.Fn inet_makeaddr "unsigned long net" "unsigned long lna" -.Ft unsigned long -.Fn inet_lnaof "struct in_addr in" -.Ft unsigned long -.Fn inet_netof "struct in_addr in" -.Sh DESCRIPTION -The routines -.Fn inet_aton , -.Fn inet_addr -and -.Fn inet_network -interpret character strings representing -numbers expressed in the Internet standard -.Ql \&. -notation. -The -.Fn inet_aton -routine interprets the specified character string as an Internet address, -placing the address into the structure provided. -It returns 1 if the string was successfully interpreted, -or 0 if the string is invalid. -The -.Fn inet_addr -and -.Fn inet_network -functions return numbers suitable for use -as Internet addresses and Internet network -numbers, respectively. -The routine -.Fn inet_ntoa -takes an Internet address and returns an -.Tn ASCII -string representing the address in -.Ql \&. -notation. The routine -.Fn inet_makeaddr -takes an Internet network number and a local -network address and constructs an Internet address -from it. The routines -.Fn inet_netof -and -.Fn inet_lnaof -break apart Internet host addresses, returning -the network number and local network address part, -respectively. -.Pp -All Internet addresses are returned in network -order (bytes ordered from left to right). -All network numbers and local address parts are -returned as machine format integer values. -.Sh INTERNET ADDRESSES -Values specified using the -.Ql \&. -notation take one -of the following forms: -.Bd -literal -offset indent -a.b.c.d -a.b.c -a.b -a -.Ed -.Pp -When four parts are specified, each is interpreted -as a byte of data and assigned, from left to right, -to the four bytes of an Internet address. Note -that when an Internet address is viewed as a 32-bit -integer quantity on the -.Tn VAX -the bytes referred to -above appear as -.Dq Li d.c.b.a . -That is, -.Tn VAX -bytes are -ordered from right to left. -.Pp -When a three part address is specified, the last -part is interpreted as a 16-bit quantity and placed -in the right-most two bytes of the network address. -This makes the three part address format convenient -for specifying Class B network addresses as -.Dq Li 128.net.host . -.Pp -When a two part address is supplied, the last part -is interpreted as a 24-bit quantity and placed in -the right most three bytes of the network address. -This makes the two part address format convenient -for specifying Class A network addresses as -.Dq Li net.host . -.Pp -When only one part is given, the value is stored -directly in the network address without any byte -rearrangement. -.Pp -All numbers supplied as -.Dq parts -in a -.Ql \&. -notation -may be decimal, octal, or hexadecimal, as specified -in the C language (i.e., a leading 0x or 0X implies -hexadecimal; otherwise, a leading 0 implies octal; -otherwise, the number is interpreted as decimal). -.Pp -The -.Fn inet_aton -and -.Fn inet_ntoa -functions are semi-deprecated in favor of the -.Xr addr2ascii 3 -family. However, since those functions are not yet widely implemented, -portable programs cannot rely on their presence and will continue -to use the -.Xr inet 3 -functions for some time. -.Sh DIAGNOSTICS -The constant -.Dv INADDR_NONE -is returned by -.Fn inet_addr -and -.Fn inet_network -for malformed requests. -.Sh SEE ALSO -.Xr addr2ascii 3 , -.Xr gethostbyname 3 , -.Xr getnetent 3 , -.Xr hosts 5 , -.Xr networks 5 -.Sh HISTORY -These -functions appeared in -.Bx 4.2 . -.Sh BUGS -The value -.Dv INADDR_NONE -(0xffffffff) is a valid broadcast address, but -.Fn inet_addr -cannot return that value without indicating failure. -The newer -.Fn inet_aton -function does not share this problem. -The problem of host byte ordering versus network byte ordering is -confusing. -The string returned by -.Fn inet_ntoa -resides in a static memory area. -.Pp -Inet_addr should return a -.Fa struct in_addr . diff --git a/c/src/exec/libnetworking/libc/inet_addr.c b/c/src/exec/libnetworking/libc/inet_addr.c deleted file mode 100644 index 225ccc1269..0000000000 --- a/c/src/exec/libnetworking/libc/inet_addr.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * ++Copyright++ 1983, 1990, 1993 - * - - * Copyright (c) 1983, 1990, 1993 - * 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. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include - -/* - * Ascii internet address interpretation routine. - * The value returned is in network order. - */ -u_long -inet_addr(cp) - register const char *cp; -{ - struct in_addr val; - - if (inet_aton(cp, &val)) - return (val.s_addr); - return (INADDR_NONE); -} - -/* - * Check whether "cp" is a valid ascii representation - * of an Internet address and convert to a binary address. - * Returns 1 if the address is valid, 0 if not. - * This replaces inet_addr, the return value from which - * cannot distinguish between failure and a local broadcast address. - */ -int -inet_aton(cp, addr) - register const char *cp; - struct in_addr *addr; -{ - register u_long val; - register int base, n; - register char c; - u_int parts[4]; - register u_int *pp = parts; - - c = *cp; - for (;;) { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, isdigit=decimal. - */ - if (!isdigit((int)c)) - return (0); - val = 0; base = 10; - if (c == '0') { - c = *++cp; - if (c == 'x' || c == 'X') - base = 16, c = *++cp; - else - base = 8; - } - for (;;) { - if (isascii((int)c) && isdigit((int)c)) { - val = (val * base) + (c - '0'); - c = *++cp; - } else if (base == 16 && isascii((int)c) && isxdigit((int)c)) { - val = (val << 4) | - (c + 10 - (islower((int)c) ? 'a' : 'A')); - c = *++cp; - } else - break; - } - if (c == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16 bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3) - return (0); - *pp++ = val; - c = *++cp; - } else - break; - } - /* - * Check for trailing characters. - */ - if (c != '\0' && (!isascii((int)c) || !isspace((int)c))) - return (0); - /* - * Concoct the address according to - * the number of parts specified. - */ - n = pp - parts + 1; - switch (n) { - - case 0: - return (0); /* initial nondigit */ - - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if (val > 0xffffff) - return (0); - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - if (addr) - addr->s_addr = htonl(val); - return (1); -} diff --git a/c/src/exec/libnetworking/libc/inet_lnaof.c b/c/src/exec/libnetworking/libc/inet_lnaof.c deleted file mode 100644 index 6ec6a9aef1..0000000000 --- a/c/src/exec/libnetworking/libc/inet_lnaof.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -/* - * Return the local network address portion of an - * internet address; handles class a/b/c network - * number formats. - */ -u_long -inet_lnaof(in) - struct in_addr in; -{ - register u_long i = ntohl(in.s_addr); - - if (IN_CLASSA(i)) - return ((i)&IN_CLASSA_HOST); - else if (IN_CLASSB(i)) - return ((i)&IN_CLASSB_HOST); - else - return ((i)&IN_CLASSC_HOST); -} diff --git a/c/src/exec/libnetworking/libc/inet_makeaddr.c b/c/src/exec/libnetworking/libc/inet_makeaddr.c deleted file mode 100644 index ce84170ed9..0000000000 --- a/c/src/exec/libnetworking/libc/inet_makeaddr.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -/* - * Formulate an Internet address from network + host. Used in - * building addresses stored in the ifnet structure. - */ -struct in_addr -inet_makeaddr(net, host) - u_long net, host; -{ - u_long addr; - - if (net < 128) - addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); - else if (net < 65536) - addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); - else if (net < 16777216L) - addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); - else - addr = net | host; - addr = htonl(addr); - return (*(struct in_addr *)&addr); -} diff --git a/c/src/exec/libnetworking/libc/inet_net_ntop.c b/c/src/exec/libnetworking/libc/inet_net_ntop.c deleted file mode 100644 index 4c7893d417..0000000000 --- a/c/src/exec/libnetworking/libc/inet_net_ntop.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static const char orig_rcsid[] = "From Id: inet_net_ntop.c,v 8.2 1996/08/08 06:54:44 vixie Exp"; -static const char rcsid[] = "$Id$"; -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef SPRINTF_CHAR -# define SPRINTF(x) strlen(sprintf/**/x) -#else -# define SPRINTF(x) ((size_t)sprintf x) -#endif - -static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits, - char *dst, size_t size)); - -/* - * char * - * inet_net_ntop(af, src, bits, dst, size) - * convert network number from network to presentation format. - * generates CIDR style result always. - * return: - * pointer to dst, or NULL if an error occurred (check errno). - * author: - * Paul Vixie (ISC), July 1996 - */ -char * -inet_net_ntop(af, src, bits, dst, size) - int af; - const void *src; - int bits; - char *dst; - size_t size; -{ - switch (af) { - case AF_INET: - return (inet_net_ntop_ipv4(src, bits, dst, size)); - default: - errno = EAFNOSUPPORT; - return (NULL); - } -} - -/* - * static char * - * inet_net_ntop_ipv4(src, bits, dst, size) - * convert IPv4 network number from network to presentation format. - * generates CIDR style result always. - * return: - * pointer to dst, or NULL if an error occurred (check errno). - * note: - * network byte order assumed. this means 192.5.5.240/28 has - * 0x11110000 in its fourth octet. - * author: - * Paul Vixie (ISC), July 1996 - */ -static char * -inet_net_ntop_ipv4(src, bits, dst, size) - const u_char *src; - int bits; - char *dst; - size_t size; -{ - char *odst = dst; - char *t; - u_int m; - int b; - - if (bits < 0 || bits > 32) { - errno = EINVAL; - return (NULL); - } - if (bits == 0) { - if (size < sizeof "0") - goto emsgsize; - *dst++ = '0'; - *dst = '\0'; - } - - /* Format whole octets. */ - for (b = bits / 8; b > 0; b--) { - if (size < sizeof "255.") - goto emsgsize; - t = dst; - dst += SPRINTF((dst, "%u", *src++)); - if (b > 1) { - *dst++ = '.'; - *dst = '\0'; - } - size -= (size_t)(dst - t); - } - - /* Format partial octet. */ - b = bits % 8; - if (b > 0) { - if (size < sizeof ".255") - goto emsgsize; - t = dst; - if (dst != odst) - *dst++ = '.'; - m = ((1 << b) - 1) << (8 - b); - dst += SPRINTF((dst, "%u", *src & m)); - size -= (size_t)(dst - t); - } - - /* Format CIDR /width. */ - if (size < sizeof "/32") - goto emsgsize; - dst += SPRINTF((dst, "/%u", bits)); - return (odst); - - emsgsize: - errno = EMSGSIZE; - return (NULL); -} diff --git a/c/src/exec/libnetworking/libc/inet_net_pton.c b/c/src/exec/libnetworking/libc/inet_net_pton.c deleted file mode 100644 index 8915c2a5be..0000000000 --- a/c/src/exec/libnetworking/libc/inet_net_pton.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static const char orig_rcsid[] = "From Id: inet_net_pton.c,v 1.8 1996/11/21 10:28:12 vixie Exp $"; -static const char rcsid[] = "$Id$"; -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifdef SPRINTF_CHAR -# define SPRINTF(x) strlen(sprintf/**/x) -#else -# define SPRINTF(x) ((size_t)sprintf x) -#endif - -static int inet_net_pton_ipv4 __P((const char *src, u_char *dst, - size_t size)); - -/* - * static int - * inet_net_pton(af, src, dst, size) - * convert network number from presentation to network format. - * accepts hex octets, hex strings, decimal octets, and /CIDR. - * "size" is in bytes and describes "dst". - * return: - * number of bits, either imputed classfully or specified with /CIDR, - * or -1 if some failure occurred (check errno). ENOENT means it was - * not a valid network specification. - * author: - * Paul Vixie (ISC), June 1996 - */ -int -inet_net_pton(af, src, dst, size) - int af; - const char *src; - void *dst; - size_t size; -{ - switch (af) { - case AF_INET: - return (inet_net_pton_ipv4(src, dst, size)); - default: - errno = EAFNOSUPPORT; - return (-1); - } -} - -/* - * static int - * inet_net_pton_ipv4(src, dst, size) - * convert IPv4 network number from presentation to network format. - * accepts hex octets, hex strings, decimal octets, and /CIDR. - * "size" is in bytes and describes "dst". - * return: - * number of bits, either imputed classfully or specified with /CIDR, - * or -1 if some failure occurred (check errno). ENOENT means it was - * not an IPv4 network specification. - * note: - * network byte order assumed. this means 192.5.5.240/28 has - * 0x11110000 in its fourth octet. - * author: - * Paul Vixie (ISC), June 1996 - */ -static int -inet_net_pton_ipv4(src, dst, size) - const char *src; - u_char *dst; - size_t size; -{ - static const char - xdigits[] = "0123456789abcdef", - digits[] = "0123456789"; - int n, ch, tmp, dirty, bits; - const u_char *odst = dst; - - ch = *src++; - if (ch == '0' && (src[0] == 'x' || src[0] == 'X') - && isascii(src[1]) && isxdigit(src[1])) { - /* Hexadecimal: Eat nybble string. */ - if (size <= 0) - goto emsgsize; - *dst = 0, dirty = 0; - src++; /* skip x or X. */ - while ((ch = *src++) != '\0' && - isascii(ch) && isxdigit(ch)) { - if (isupper(ch)) - ch = tolower(ch); - n = strchr(xdigits, ch) - xdigits; - assert(n >= 0 && n <= 15); - *dst |= n; - if (!dirty++) - *dst <<= 4; - else if (size-- > 0) - *++dst = 0, dirty = 0; - else - goto emsgsize; - } - if (dirty) - size--; - } else if (isascii(ch) && isdigit(ch)) { - /* Decimal: eat dotted digit string. */ - for (;;) { - tmp = 0; - do { - n = strchr(digits, ch) - digits; - assert(n >= 0 && n <= 9); - tmp *= 10; - tmp += n; - if (tmp > 255) - goto enoent; - } while ((ch = *src++) != '\0' && - isascii(ch) && isdigit(ch)); - if (size-- <= 0) - goto emsgsize; - *dst++ = (u_char) tmp; - if (ch == '\0' || ch == '/') - break; - if (ch != '.') - goto enoent; - ch = *src++; - if (!isascii(ch) || !isdigit(ch)) - goto enoent; - } - } else - goto enoent; - - bits = -1; - if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) { - /* CIDR width specifier. Nothing can follow it. */ - ch = *src++; /* Skip over the /. */ - bits = 0; - do { - n = strchr(digits, ch) - digits; - assert(n >= 0 && n <= 9); - bits *= 10; - bits += n; - } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); - if (ch != '\0') - goto enoent; - if (bits > 32) - goto emsgsize; - } - - /* Firey death and destruction unless we prefetched EOS. */ - if (ch != '\0') - goto enoent; - - /* If nothing was written to the destination, we found no address. */ - if (dst == odst) - goto enoent; - /* If no CIDR spec was given, infer width from net class. */ - if (bits == -1) { - if (*odst >= 240) /* Class E */ - bits = 32; - else if (*odst >= 224) /* Class D */ - bits = 4; - else if (*odst >= 192) /* Class C */ - bits = 24; - else if (*odst >= 128) /* Class B */ - bits = 16; - else /* Class A */ - bits = 8; - /* If imputed mask is narrower than specified octets, widen. */ - if (bits >= 8 && bits < ((dst - odst) * 8)) - bits = (dst - odst) * 8; - } - /* Extend network to cover the actual mask. */ - while (bits > ((dst - odst) * 8)) { - if (size-- <= 0) - goto emsgsize; - *dst++ = '\0'; - } - return (bits); - - enoent: - errno = ENOENT; - return (-1); - - emsgsize: - errno = EMSGSIZE; - return (-1); -} diff --git a/c/src/exec/libnetworking/libc/inet_neta.c b/c/src/exec/libnetworking/libc/inet_neta.c deleted file mode 100644 index 59b156f7f6..0000000000 --- a/c/src/exec/libnetworking/libc/inet_neta.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static const char orig_rcsid[] = "From Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp"; -static const char rcsid[] = "$Id$"; -#endif - -#include -#include -#include -#include - -#include -#include -#include - -#ifdef SPRINTF_CHAR -# define SPRINTF(x) strlen(sprintf/**/x) -#else -# define SPRINTF(x) ((size_t)sprintf x) -#endif - -/* - * char * - * inet_neta(src, dst, size) - * format a u_long network number into presentation format. - * return: - * pointer to dst, or NULL if an error occurred (check errno). - * note: - * format of ``src'' is as for inet_network(). - * author: - * Paul Vixie (ISC), July 1996 - */ -char * -inet_neta(src, dst, size) - u_long src; - char *dst; - size_t size; -{ - char *odst = dst; - char *tp; - - while (src & 0xffffffff) { - u_char b = (src & 0xff000000) >> 24; - - src <<= 8; - if (b) { - if (size < sizeof "255.") - goto emsgsize; - tp = dst; - dst += SPRINTF((dst, "%u", b)); - if (src != 0L) { - *dst++ = '.'; - *dst = '\0'; - } - size -= (size_t)(dst - tp); - } - } - if (dst == odst) { - if (size < sizeof "0.0.0.0") - goto emsgsize; - strcpy(dst, "0.0.0.0"); - } - return (odst); - - emsgsize: - errno = EMSGSIZE; - return (NULL); -} diff --git a/c/src/exec/libnetworking/libc/inet_netof.c b/c/src/exec/libnetworking/libc/inet_netof.c deleted file mode 100644 index 179731efc3..0000000000 --- a/c/src/exec/libnetworking/libc/inet_netof.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -/* - * Return the network number from an internet - * address; handles class a/b/c network #'s. - */ -u_long -inet_netof(in) - struct in_addr in; -{ - register u_long i = ntohl(in.s_addr); - - if (IN_CLASSA(i)) - return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT); - else if (IN_CLASSB(i)) - return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT); - else - return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT); -} diff --git a/c/src/exec/libnetworking/libc/inet_network.c b/c/src/exec/libnetworking/libc/inet_network.c deleted file mode 100644 index ac0073bf0a..0000000000 --- a/c/src/exec/libnetworking/libc/inet_network.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include - -/* - * Internet network address interpretation routine. - * The library routines call this routine to interpret - * network numbers. - */ -u_long -inet_network(cp) - register const char *cp; -{ - register u_long val, base, n, i; - register char c; - u_long parts[4], *pp = parts; - -again: - val = 0; base = 10; - if (*cp == '0') - base = 8, cp++; - if (*cp == 'x' || *cp == 'X') - base = 16, cp++; - while ((c = *cp) != 0) { - if (isdigit(c)) { - val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isxdigit(c)) { - val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A')); - cp++; - continue; - } - break; - } - if (*cp == '.') { - if (pp >= parts + 3) - return (INADDR_NONE); - *pp++ = val, cp++; - goto again; - } - if (*cp && !isspace(*cp)) - return (INADDR_NONE); - *pp++ = val; - n = pp - parts; - for (val = 0, i = 0; i < n; i++) { - val <<= 8; - val |= parts[i] & 0xff; - } - return (val); -} diff --git a/c/src/exec/libnetworking/libc/inet_ntoa.c b/c/src/exec/libnetworking/libc/inet_ntoa.c deleted file mode 100644 index 44b686f0b3..0000000000 --- a/c/src/exec/libnetworking/libc/inet_ntoa.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * 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[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include - -/* - * Convert network-format internet address - * to base 256 d.d.d.d representation. - */ -char * -inet_ntoa(in) - struct in_addr in; -{ - static char ret[18]; - - strcpy(ret, "[inet_ntoa error]"); - (void) inet_ntop(AF_INET, &in, ret, sizeof ret); - return (ret); -} diff --git a/c/src/exec/libnetworking/libc/inet_ntop.c b/c/src/exec/libnetworking/libc/inet_ntop.c deleted file mode 100644 index 76a538755a..0000000000 --- a/c/src/exec/libnetworking/libc/inet_ntop.c +++ /dev/null @@ -1,191 +0,0 @@ -/* Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SPRINTF(x) ((size_t)sprintf x) - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size)); -static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size)); - -/* char * - * inet_ntop(af, src, dst, size) - * convert a network format address to presentation format. - * return: - * pointer to presentation format address (`dst'), or NULL (see errno). - * author: - * Paul Vixie, 1996. - */ -const char * -inet_ntop(af, src, dst, size) - int af; - const void *src; - char *dst; - size_t size; -{ - switch (af) { - case AF_INET: - return (inet_ntop4(src, dst, size)); - case AF_INET6: - return (inet_ntop6(src, dst, size)); - default: - errno = EAFNOSUPPORT; - return (NULL); - } - /* NOTREACHED */ -} - -/* const char * - * inet_ntop4(src, dst, size) - * format an IPv4 address, more or less like inet_ntoa() - * return: - * `dst' (as a const) - * notes: - * (1) uses no statics - * (2) takes a u_char* not an in_addr as input - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop4(src, dst, size) - const u_char *src; - char *dst; - size_t size; -{ - static const char fmt[] = "%u.%u.%u.%u"; - char tmp[sizeof "255.255.255.255"]; - - if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { - errno = ENOSPC; - return (NULL); - } - strcpy(dst, tmp); - return (dst); -} - -/* const char * - * inet_ntop6(src, dst, size) - * convert IPv6 binary address into presentation (printable) format - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop6(src, dst, size) - const u_char *src; - char *dst; - size_t size; -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; - struct { int base, len; } best, cur; - u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; - int i; - - /* - * Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset(words, '\0', sizeof words); - for (i = 0; i < NS_IN6ADDRSZ; i++) - words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); - best.base = -1; - cur.base = -1; - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { - if (words[i] == 0) { - if (cur.base == -1) - cur.base = i, cur.len = 1; - else - cur.len++; - } else { - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - } - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - } - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* - * Format the result. - */ - tp = tmp; - for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { - /* Are we inside the best run of 0x00's? */ - if (best.base != -1 && i >= best.base && - i < (best.base + best.len)) { - if (i == best.base) - *tp++ = ':'; - continue; - } - /* Are we following an initial run of 0x00s or any real hex? */ - if (i != 0) - *tp++ = ':'; - /* Is this address an encapsulated IPv4? */ - if (i == 6 && best.base == 0 && - (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { - if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) - return (NULL); - tp += strlen(tp); - break; - } - tp += SPRINTF((tp, "%x", words[i])); - } - /* Was it a trailing run of 0x00's? */ - if (best.base != -1 && (best.base + best.len) == - (NS_IN6ADDRSZ / NS_INT16SZ)) - *tp++ = ':'; - *tp++ = '\0'; - - /* - * Check for overflow, copy, and we're done. - */ - if ((size_t)(tp - tmp) > size) { - errno = ENOSPC; - return (NULL); - } - strcpy(dst, tmp); - return (dst); -} diff --git a/c/src/exec/libnetworking/libc/inet_pton.c b/c/src/exec/libnetworking/libc/inet_pton.c deleted file mode 100644 index 8d21111cfa..0000000000 --- a/c/src/exec/libnetworking/libc/inet_pton.c +++ /dev/null @@ -1,214 +0,0 @@ -/* Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static int inet_pton4 __P((const char *src, u_char *dst)); -static int inet_pton6 __P((const char *src, u_char *dst)); - -/* int - * inet_pton(af, src, dst) - * convert from presentation format (which usually means ASCII printable) - * to network format (which is usually some kind of binary format). - * return: - * 1 if the address was valid for the specified address family - * 0 if the address wasn't valid (`dst' is untouched in this case) - * -1 if some other error occurred (`dst' is untouched in this case, too) - * author: - * Paul Vixie, 1996. - */ -int -inet_pton(af, src, dst) - int af; - const char *src; - void *dst; -{ - switch (af) { - case AF_INET: - return (inet_pton4(src, dst)); - case AF_INET6: - return (inet_pton6(src, dst)); - default: - errno = EAFNOSUPPORT; - return (-1); - } - /* NOTREACHED */ -} - -/* int - * inet_pton4(src, dst) - * like inet_aton() but without all the hexadecimal and shorthand. - * return: - * 1 if `src' is a valid dotted quad, else 0. - * notice: - * does not touch `dst' unless it's returning 1. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton4(src, dst) - const char *src; - u_char *dst; -{ - static const char digits[] = "0123456789"; - int saw_digit, octets, ch; - u_char tmp[NS_INADDRSZ], *tp; - - saw_digit = 0; - octets = 0; - *(tp = tmp) = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr(digits, ch)) != NULL) { - u_int new = *tp * 10 + (pch - digits); - - if (new > 255) - return (0); - *tp = new; - if (! saw_digit) { - if (++octets > 4) - return (0); - saw_digit = 1; - } - } else if (ch == '.' && saw_digit) { - if (octets == 4) - return (0); - *++tp = 0; - saw_digit = 0; - } else - return (0); - } - if (octets < 4) - return (0); - - memcpy(dst, tmp, NS_INADDRSZ); - return (1); -} - -/* int - * inet_pton6(src, dst) - * convert presentation level address to network order binary form. - * return: - * 1 if `src' is a valid [RFC1884 2.2] address, else 0. - * notice: - * (1) does not touch `dst' unless it's returning 1. - * (2) :: in a full address is silently ignored. - * credit: - * inspired by Mark Andrews. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton6(src, dst) - const char *src; - u_char *dst; -{ - static const char xdigits_l[] = "0123456789abcdef", - xdigits_u[] = "0123456789ABCDEF"; - u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; - const char *xdigits, *curtok; - int ch, saw_xdigit; - u_int val; - - memset((tp = tmp), '\0', NS_IN6ADDRSZ); - endp = tp + NS_IN6ADDRSZ; - colonp = NULL; - /* Leading :: requires some special handling. */ - if (*src == ':') - if (*++src != ':') - return (0); - curtok = src; - saw_xdigit = 0; - val = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) - pch = strchr((xdigits = xdigits_u), ch); - if (pch != NULL) { - val <<= 4; - val |= (pch - xdigits); - if (val > 0xffff) - return (0); - saw_xdigit = 1; - continue; - } - if (ch == ':') { - curtok = src; - if (!saw_xdigit) { - if (colonp) - return (0); - colonp = tp; - continue; - } - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - saw_xdigit = 0; - val = 0; - continue; - } - if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && - inet_pton4(curtok, tp) > 0) { - tp += NS_INADDRSZ; - saw_xdigit = 0; - break; /* '\0' was seen by inet_pton4(). */ - } - return (0); - } - if (saw_xdigit) { - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - } - if (colonp != NULL) { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const int n = tp - colonp; - int i; - - for (i = 1; i <= n; i++) { - endp[- i] = colonp[n - i]; - colonp[n - i] = 0; - } - tp = endp; - } - if (tp != endp) - return (0); - memcpy(dst, tmp, NS_IN6ADDRSZ); - return (1); -} diff --git a/c/src/exec/libnetworking/libc/iso_addr.3 b/c/src/exec/libnetworking/libc/iso_addr.3 deleted file mode 100644 index 0c9973bef4..0000000000 --- a/c/src/exec/libnetworking/libc/iso_addr.3 +++ /dev/null @@ -1,111 +0,0 @@ -.\" Copyright (c) 1993 -.\" 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. -.\" -.\" @(#)iso_addr.3 8.1 (Berkeley) 6/4/93 -.\" $Id$ -.\" -.Dd June 4, 1993 -.Dt ISO_ADDR 3 -.Os -.Sh NAME -.Nm iso_addr , -.Nm iso_ntoa -.Nd "elementary network address conversion routines for Open System Interconnection -.Sh SYNOPSIS -.Fd #include -.Fd #include -.Ft struct iso_addr * -.Fn iso_addr "char *cp" -.Ft char * -.Fn iso_ntoa "struct iso_addr *isoa" -.Sh DESCRIPTION -The routine -.Fn iso_addr -interprets character strings representing -.Tn OSI -addresses, returning binary information suitable -for use in system calls. -The routine -.Fn iso_ntoa -takes -.Tn OSI -addresses and returns -.Tn ASCII -strings representing NSAPs (network service -access points) in a -notation inverse to that accepted by -.Fn iso_addr . -.Pp -Unfortunately, no universal standard exists for representing -.Tn OSI -network addresses. -.Pp -The format employed by -.Fn iso_addr -is a sequence of hexadecimal -.Dq digits -(optionally separated by periods), -of the form: -.Bd -filled -offset indent -.. -.Ed -.Pp -Each pair of hexadecimal digits represents a byte -with the leading digit indicating the higher-ordered bits. -A period following an even number of bytes has no -effect (but may be used to increase legibility). -A period following an odd number of bytes has the -effect of causing the byte of address being translated -to have its higher order bits filled with zeros. -.Sh RETURN VALUES -.Fn iso_ntoa -always returns a null terminated string. -.Fn iso_addr -always returns a pointer to a struct iso_addr. -(See -.Sx BUGS . ) -.Sh SEE ALSO -.Xr iso 4 -.Sh HISTORY -The -.Fn iso_addr -and -.Fn iso_ntoa -functions appeared in -.Bx 4.3 Reno . -.Sh BUGS -The returned values -reside in a static memory area. -.Pp -The function -.Fn iso_addr -should diagnose improperly formed input, and there should be an unambiguous -way to recognize this. diff --git a/c/src/exec/libnetworking/libc/iso_addr.c b/c/src/exec/libnetworking/libc/iso_addr.c deleted file mode 100644 index eb14e8a72b..0000000000 --- a/c/src/exec/libnetworking/libc/iso_addr.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * 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[] = "@(#)iso_addr.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -/* States*/ -#define VIRGIN 0 -#define GOTONE 1 -#define GOTTWO 2 -/* Inputs */ -#define DIGIT (4*0) -#define END (4*1) -#define DELIM (4*2) - -struct iso_addr * -iso_addr(addr) - register const char *addr; -{ - static struct iso_addr out_addr; - register char *cp = out_addr.isoa_genaddr; - char *cplim = cp + sizeof(out_addr.isoa_genaddr); - register int byte = 0, state = VIRGIN, new; - - bzero((char *)&out_addr, sizeof(out_addr)); - do { - if ((*addr >= '0') && (*addr <= '9')) { - new = *addr - '0'; - } else if ((*addr >= 'a') && (*addr <= 'f')) { - new = *addr - 'a' + 10; - } else if ((*addr >= 'A') && (*addr <= 'F')) { - new = *addr - 'A' + 10; - } else if (*addr == 0) - state |= END; - else - state |= DELIM; - addr++; - switch (state /* | INPUT */) { - case GOTTWO | DIGIT: - *cp++ = byte; /*FALLTHROUGH*/ - case VIRGIN | DIGIT: - state = GOTONE; byte = new; continue; - case GOTONE | DIGIT: - state = GOTTWO; byte = new + (byte << 4); continue; - default: /* | DELIM */ - state = VIRGIN; *cp++ = byte; byte = 0; continue; - case GOTONE | END: - case GOTTWO | END: - *cp++ = byte; /* FALLTHROUGH */ - case VIRGIN | END: - break; - } - break; - } while (cp < cplim); - out_addr.isoa_len = cp - out_addr.isoa_genaddr; - return (&out_addr); -} - -static char hexlist[] = "0123456789abcdef"; - -char * -iso_ntoa(isoa) - const struct iso_addr *isoa; -{ - static char tmpbuf[sizeof(isoa->isoa_genaddr)*3]; - const u_char *binary; - char *cp; - int i; - - binary = isoa->isoa_genaddr; - cp = tmpbuf; - - for (i = 0; i < isoa->isoa_len; i++) { - *cp++ = hexlist[*binary >> 4]; - *cp++ = hexlist[*binary++ & 0xf]; - - if ((((i % 2) == 0) && ((i + 1) < isoa->isoa_len))) - *cp++ = '.'; - } - *cp = '\0'; - return tmpbuf; -} diff --git a/c/src/exec/libnetworking/libc/linkaddr.3 b/c/src/exec/libnetworking/libc/linkaddr.3 deleted file mode 100644 index 6999add0e8..0000000000 --- a/c/src/exec/libnetworking/libc/linkaddr.3 +++ /dev/null @@ -1,138 +0,0 @@ -.\" Copyright (c) 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Donn Seeley at BSDI. -.\" -.\" 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. -.\" -.\" From: @(#)linkaddr.3 8.1 (Berkeley) 7/28/93 -.\" $Id$ -.\" -.Dd June 17, 1996 -.Dt LINK_ADDR 3 -.Os BSD 4.4 -.Sh NAME -.Nm link_addr , -.Nm link_ntoa -.Nd elementary address specification routines for link level access -.Sh SYNOPSIS -.Fd #include -.Fd #include -.Fd #include -.Ft void -.Fn link_addr "const char *addr" "struct sockaddr_dl *sdl" -.Ft char * -.Fn link_ntoa "const struct sockaddr_dl *sdl" -.Sh DESCRIPTION -The routine -.Fn link_addr -interprets character strings representing -link-level addresses, returning binary information suitable -for use in system calls. -The routine -.Fn link_ntoa -takes -a link-level -address and returns an -.Tn ASCII -string representing some of the information present, -including the link level address itself, and the interface name -or number, if present. -This facility is experimental and is -still subject to change. -.Pp -For -.Fn link_addr , -the string -.Fa addr -may contain -an optional network interface identifier of the form -.Dq "name unit-number" , -suitable for the first argument to -.Xr ifconfig 8 , -followed in all cases by a colon and -an interface address in the form of -groups of hexadecimal digits -separated by periods. -Each group represents a byte of address; -address bytes are filled left to right from -low order bytes through high order bytes. -.Pp -.\" A regular expression may make this format clearer: -.\" .Bd -literal -offset indent -.\" ([a-z]+[0-9]+:)?[0-9a-f]+(\e.[0-9a-f]+)* -.\" .Ed -.\" .Pp -Thus -.Li le0:8.0.9.13.d.30 -represents an ethernet address -to be transmitted on the first Lance ethernet interface. -.Pp -The direct use of these functions is deprecated in favor of the -.Xr addr2ascii 3 -interface; however, portable programs cannot rely on the latter as it is -not yet widely implemented. -.Sh RETURN VALUES -.Fn link_ntoa -always returns a null terminated string. -.Fn link_addr -has no return value. -(See -.Sx BUGS . ) -.Sh SEE ALSO -.Xr addr2ascii 3 -.\" .Xr iso 4 -.Sh HISTORY -The -.Fn link_addr -and -.Fn link_ntoa -functions appeared in -.Bx 4.3 Reno . -.Sh BUGS -The returned values for link_ntoa -reside in a static memory area. -.Pp -The function -.Fn link_addr -should diagnose improperly formed input, and there should be an unambiguous -way to recognize this. -.Pp -If the -.Va sdl_len -field of the link socket address -.Fa sdl -is 0, -.Fn link_ntoa -will not insert a colon before the interface address bytes. -If this translated address is given to -.Fn link_addr -without inserting an initial colon, -the latter will not interpret it correctly. diff --git a/c/src/exec/libnetworking/libc/linkaddr.c b/c/src/exec/libnetworking/libc/linkaddr.c deleted file mode 100644 index 2bad464b12..0000000000 --- a/c/src/exec/libnetworking/libc/linkaddr.c +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * 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[] = "@(#)linkaddr.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include - -/* States*/ -#define NAMING 0 -#define GOTONE 1 -#define GOTTWO 2 -#define RESET 3 -/* Inputs */ -#define DIGIT (4*0) -#define END (4*1) -#define DELIM (4*2) -#define LETTER (4*3) - -void -link_addr(addr, sdl) - register const char *addr; - register struct sockaddr_dl *sdl; -{ - register char *cp = sdl->sdl_data; - char *cplim = sdl->sdl_len + (char *)sdl; - register int byte = 0, state = NAMING, - new=0; /* new=0 to avoid warning */ - - bzero((char *)&sdl->sdl_family, sdl->sdl_len - 1); - sdl->sdl_family = AF_LINK; - do { - state &= ~LETTER; - if ((*addr >= '0') && (*addr <= '9')) { - new = *addr - '0'; - } else if ((*addr >= 'a') && (*addr <= 'f')) { - new = *addr - 'a' + 10; - } else if ((*addr >= 'A') && (*addr <= 'F')) { - new = *addr - 'A' + 10; - } else if (*addr == 0) { - state |= END; - } else if (state == NAMING && - (((*addr >= 'A') && (*addr <= 'Z')) || - ((*addr >= 'a') && (*addr <= 'z')))) - state |= LETTER; - else - state |= DELIM; - addr++; - switch (state /* | INPUT */) { - case NAMING | DIGIT: - case NAMING | LETTER: - *cp++ = addr[-1]; - continue; - case NAMING | DELIM: - state = RESET; - sdl->sdl_nlen = cp - sdl->sdl_data; - continue; - case GOTTWO | DIGIT: - *cp++ = byte; - /* FALLTHROUGH */ - case RESET | DIGIT: - state = GOTONE; - byte = new; - continue; - case GOTONE | DIGIT: - state = GOTTWO; - byte = new + (byte << 4); - continue; - default: /* | DELIM */ - state = RESET; - *cp++ = byte; - byte = 0; - continue; - case GOTONE | END: - case GOTTWO | END: - *cp++ = byte; - /* FALLTHROUGH */ - case RESET | END: - break; - } - break; - } while (cp < cplim); - sdl->sdl_alen = cp - LLADDR(sdl); - new = cp - (char *)sdl; - if (new > sizeof(*sdl)) - sdl->sdl_len = new; - return; -} - -static char hexlist[] = "0123456789abcdef"; - -char * -link_ntoa(sdl) - register const struct sockaddr_dl *sdl; -{ - static char obuf[64]; - register char *out = obuf; - register int i; - register u_char *in = (u_char *)LLADDR(sdl); - u_char *inlim = in + sdl->sdl_alen; - int firsttime = 1; - - if (sdl->sdl_nlen) { - bcopy(sdl->sdl_data, obuf, sdl->sdl_nlen); - out += sdl->sdl_nlen; - if (sdl->sdl_alen) - *out++ = ':'; - } - while (in < inlim) { - if (firsttime) - firsttime = 0; - else - *out++ = '.'; - i = *in++; - if (i > 0xf) { - out[1] = hexlist[i & 0xf]; - i >>= 4; - out[0] = hexlist[i]; - out += 2; - } else - *out++ = hexlist[i]; - } - *out = 0; - return (obuf); -} diff --git a/c/src/exec/libnetworking/libc/map_v4v6.c b/c/src/exec/libnetworking/libc/map_v4v6.c deleted file mode 100644 index 0f8658e117..0000000000 --- a/c/src/exec/libnetworking/libc/map_v4v6.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * ++Copyright++ 1985, 1988, 1993 - * - - * Copyright (c) 1985, 1988, 1993 - * 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. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -typedef union { - int32_t al; - char ac; -} align; - -void -_map_v4v6_address(src, dst) - const char *src; - char *dst; -{ - u_char *p = (u_char *)dst; - char tmp[INADDRSZ]; - int i; - - /* Stash a temporary copy so our caller can update in place. */ - bcopy(src, tmp, INADDRSZ); - /* Mark this ipv6 addr as a mapped ipv4. */ - for (i = 0; i < 10; i++) - *p++ = 0x00; - *p++ = 0xff; - *p++ = 0xff; - /* Retrieve the saved copy and we're done. */ - bcopy(tmp, (void*)p, INADDRSZ); -} - -void -_map_v4v6_hostent(hp, bpp, lenp) - struct hostent *hp; - char **bpp; - int *lenp; -{ - char **ap; - - if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ) - return; - hp->h_addrtype = AF_INET6; - hp->h_length = IN6ADDRSZ; - for (ap = hp->h_addr_list; *ap; ap++) { - int i = sizeof(align) - ((u_long)*bpp % sizeof(align)); - - if (*lenp < (i + IN6ADDRSZ)) { - /* Out of memory. Truncate address list here. XXX */ - *ap = NULL; - return; - } - *bpp += i; - *lenp -= i; - _map_v4v6_address(*ap, *bpp); - *ap = *bpp; - *bpp += IN6ADDRSZ; - *lenp -= IN6ADDRSZ; - } -} diff --git a/c/src/exec/libnetworking/libc/ns.3 b/c/src/exec/libnetworking/libc/ns.3 deleted file mode 100644 index e621ad2d90..0000000000 --- a/c/src/exec/libnetworking/libc/ns.3 +++ /dev/null @@ -1,131 +0,0 @@ -.\" Copyright (c) 1986, 1991, 1993 -.\" 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. -.\" -.\" @(#)ns.3 8.1 (Berkeley) 6/4/93 -.\" $Id$ -.\" -.Dd June 4, 1993 -.Dt NS 3 -.Os BSD 4.3 -.Sh NAME -.Nm ns_addr , -.Nm ns_ntoa -.Nd Xerox -.Tn NS Ns (tm) -address conversion routines -.Sh SYNOPSIS -.Fd #include -.Fd #include -.Ft struct ns_addr -.Fn ns_addr "char *cp" -.Ft char * -.Fn ns_ntoa "struct ns_addr ns" -.Sh DESCRIPTION -The routine -.Fn ns_addr -interprets character strings representing -.Tn XNS -addresses, returning binary information suitable -for use in system calls. -The routine -.Fn ns_ntoa -takes -.Tn XNS -addresses and returns -.Tn ASCII -strings representing the address in a -notation in common use in the Xerox Development Environment: -.Bd -filled -offset indent -.. -.Ed -.Pp -Trailing zero fields are suppressed, and each number is printed in hexadecimal, -in a format suitable for input to -.Fn ns_addr . -Any fields lacking super-decimal digits will have a -trailing -.Ql H -appended. -.Pp -Unfortunately, no universal standard exists for representing -.Tn XNS -addresses. -An effort has been made to insure that -.Fn ns_addr -be compatible with most formats in common use. -It will first separate an address into 1 to 3 fields using a single delimiter -chosen from -period -.Ql \&. , -colon -.Ql \&: -or pound-sign -.Ql \&# . -Each field is then examined for byte separators (colon or period). -If there are byte separators, each subfield separated is taken to be -a small hexadecimal number, and the entirety is taken as a network-byte-ordered -quantity to be zero extended in the high-network-order bytes. -Next, the field is inspected for hyphens, in which case -the field is assumed to be a number in decimal notation -with hyphens separating the millenia. -Next, the field is assumed to be a number: -It is interpreted -as hexadecimal if there is a leading -.Ql 0x -(as in C), -a trailing -.Ql H -(as in Mesa), or there are any super-decimal digits present. -It is interpreted as octal is there is a leading -.Ql 0 -and there are no super-octal digits. -Otherwise, it is converted as a decimal number. -.Sh RETURN VALUES -None. (See -.Sx BUGS . ) -.Sh SEE ALSO -.Xr hosts 5 , -.Xr networks 5 -.Sh HISTORY -The -.Fn ns_addr -and -.Fn ns_toa -functions appeared in -.Bx 4.3 . -.Sh BUGS -The string returned by -.Fn ns_ntoa -resides in a static memory area. -The function -.Fn ns_addr -should diagnose improperly formed input, and there should be an unambiguous -way to recognize this. diff --git a/c/src/exec/libnetworking/libc/ns_addr.c b/c/src/exec/libnetworking/libc/ns_addr.c deleted file mode 100644 index 18fabe91f1..0000000000 --- a/c/src/exec/libnetworking/libc/ns_addr.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * J.Q. Johnson. - * - * 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[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include - -static struct ns_addr addr, zero_addr; - -static void Field(), cvtbase(); - -struct ns_addr -ns_addr(name) - const char *name; -{ - char separator; - char *hostname, *socketname, *cp; - char buf[50]; - - (void)strncpy(buf, name, sizeof(buf) - 1); - buf[sizeof(buf) - 1] = '\0'; - - /* - * First, figure out what he intends as a field separtor. - * Despite the way this routine is written, the prefered - * form 2-272.AA001234H.01777, i.e. XDE standard. - * Great efforts are made to insure backward compatability. - */ - if ((hostname = strchr(buf, '#')) != NULL) - separator = '#'; - else { - hostname = strchr(buf, '.'); - if ((cp = strchr(buf, ':')) && - ((hostname && cp < hostname) || (hostname == 0))) { - hostname = cp; - separator = ':'; - } else - separator = '.'; - } - if (hostname) - *hostname++ = 0; - - addr = zero_addr; - Field(buf, addr.x_net.c_net, 4); - if (hostname == 0) - return (addr); /* No separator means net only */ - - socketname = strchr(hostname, separator); - if (socketname) { - *socketname++ = 0; - Field(socketname, (u_char *)&addr.x_port, 2); - } - - Field(hostname, addr.x_host.c_host, 6); - - return (addr); -} - -static void -Field(buf, out, len) - char *buf; - u_char *out; - int len; -{ - register char *bp = buf; - int i, ibase, base16 = 0, base10 = 0, clen = 0; - int hb[6], *hp; - char *fmt; - - /* - * first try 2-273#2-852-151-014#socket - */ - if ((*buf != '-') && - (1 < (i = sscanf(buf, "%d-%d-%d-%d-%d", - &hb[0], &hb[1], &hb[2], &hb[3], &hb[4])))) { - cvtbase(1000L, 256, hb, i, out, len); - return; - } - /* - * try form 8E1#0.0.AA.0.5E.E6#socket - */ - if (1 < (i = sscanf(buf,"%x.%x.%x.%x.%x.%x", - &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) { - cvtbase(256L, 256, hb, i, out, len); - return; - } - /* - * try form 8E1#0:0:AA:0:5E:E6#socket - */ - if (1 < (i = sscanf(buf,"%x:%x:%x:%x:%x:%x", - &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) { - cvtbase(256L, 256, hb, i, out, len); - return; - } - /* - * This is REALLY stretching it but there was a - * comma notation separting shorts -- definitely non standard - */ - if (1 < (i = sscanf(buf,"%x,%x,%x", - &hb[0], &hb[1], &hb[2]))) { - hb[0] = htons(hb[0]); hb[1] = htons(hb[1]); - hb[2] = htons(hb[2]); - cvtbase(65536L, 256, hb, i, out, len); - return; - } - - /* Need to decide if base 10, 16 or 8 */ - while (*bp) switch (*bp++) { - - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '-': - break; - - case '8': case '9': - base10 = 1; - break; - - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - base16 = 1; - break; - - case 'x': case 'X': - *--bp = '0'; - base16 = 1; - break; - - case 'h': case 'H': - base16 = 1; - /* fall into */ - - default: - *--bp = 0; /* Ends Loop */ - } - if (base16) { - fmt = "%3x"; - ibase = 4096; - } else if (base10 == 0 && *buf == '0') { - fmt = "%3o"; - ibase = 512; - } else { - fmt = "%3d"; - ibase = 1000; - } - - for (bp = buf; *bp++; ) clen++; - if (clen == 0) clen++; - if (clen > 18) clen = 18; - i = ((clen - 1) / 3) + 1; - bp = clen + buf - 3; - hp = hb + i - 1; - - while (hp > hb) { - (void)sscanf(bp, fmt, hp); - bp[0] = 0; - hp--; - bp -= 3; - } - (void)sscanf(buf, fmt, hp); - cvtbase((long)ibase, 256, hb, i, out, len); -} - -static void -cvtbase(oldbase,newbase,input,inlen,result,reslen) - long oldbase; - int newbase; - int input[]; - int inlen; - unsigned char result[]; - int reslen; -{ - int d, e; - long sum; - - e = 1; - while (e > 0 && reslen > 0) { - d = 0; e = 0; sum = 0; - /* long division: input=input/newbase */ - while (d < inlen) { - sum = sum*oldbase + (long) input[d]; - e += (sum > 0); - input[d++] = sum / newbase; - sum %= newbase; - } - result[--reslen] = sum; /* accumulate remainder */ - } - for (d=0; d < reslen; d++) - result[d] = 0; -} diff --git a/c/src/exec/libnetworking/libc/ns_name.c b/c/src/exec/libnetworking/libc/ns_name.c deleted file mode 100644 index af10d2f062..0000000000 --- a/c/src/exec/libnetworking/libc/ns_name.c +++ /dev/null @@ -1,595 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if !defined(__rtems__) -#if !defined(LINT) && !defined(CODECENTER) -static char rcsid[] = "$Id$"; -#endif /* not lint */ -#endif /* not rtems */ - -#include - -#include -#include - -#include -#include -#include - -/* Data. */ - -static char digits[] = "0123456789"; - -/* Forward. */ - -static int special(int); -static int printable(int); -static int dn_find(const u_char *, const u_char *, - const u_char * const *, - const u_char * const *); - -/* Public. */ - -/* - * ns_name_ntop(src, dst, dstsiz) - * Convert an encoded domain name to printable ascii as per RFC1035. - * return: - * Number of bytes written to buffer, or -1 (with errno set) - * notes: - * The root is returned as "." - * All other domains are returned in non absolute form - */ -int -ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) { - const u_char *cp; - char *dn, *eom; - u_char c; - u_int n; - - cp = src; - dn = dst; - eom = dst + dstsiz; - - while ((n = *cp++) != 0) { - if ((n & NS_CMPRSFLGS) != 0) { - /* Some kind of compression pointer. */ - errno = EMSGSIZE; - return (-1); - } - if (dn != dst) { - if (dn >= eom) { - errno = EMSGSIZE; - return (-1); - } - *dn++ = '.'; - } - if (dn + n >= eom) { - errno = EMSGSIZE; - return (-1); - } - for ((void)NULL; n > 0; n--) { - c = *cp++; - if (special(c)) { - if (dn + 1 >= eom) { - errno = EMSGSIZE; - return (-1); - } - *dn++ = '\\'; - *dn++ = (char)c; - } else if (!printable(c)) { - if (dn + 3 >= eom) { - errno = EMSGSIZE; - return (-1); - } - *dn++ = '\\'; - *dn++ = digits[c / 100]; - *dn++ = digits[(c % 100) / 10]; - *dn++ = digits[c % 10]; - } else { - if (dn >= eom) { - errno = EMSGSIZE; - return (-1); - } - *dn++ = (char)c; - } - } - } - if (dn == dst) { - if (dn >= eom) { - errno = EMSGSIZE; - return (-1); - } - *dn++ = '.'; - } - if (dn >= eom) { - errno = EMSGSIZE; - return (-1); - } - *dn++ = '\0'; - return (dn - dst); -} - -/* - * ns_name_pton(src, dst, dstsiz) - * Convert a ascii string into an encoded domain name as per RFC1035. - * return: - * -1 if it fails - * 1 if string was fully qualified - * 0 is string was not fully qualified - * notes: - * Enforces label and domain length limits. - */ - -int -ns_name_pton(const char *src, u_char *dst, size_t dstsiz) { - u_char *label, *bp, *eom; - int c, n, escaped; - char *cp; - - escaped = 0; - bp = dst; - eom = dst + dstsiz; - label = bp++; - - while ((c = *src++) != 0) { - if (escaped) { - if ((cp = strchr(digits, c)) != NULL) { - n = (cp - digits) * 100; - if ((c = *src++) == 0 || - (cp = strchr(digits, c)) == NULL) { - errno = EMSGSIZE; - return (-1); - } - n += (cp - digits) * 10; - if ((c = *src++) == 0 || - (cp = strchr(digits, c)) == NULL) { - errno = EMSGSIZE; - return (-1); - } - n += (cp - digits); - if (n > 255) { - errno = EMSGSIZE; - return (-1); - } - c = n; - } - escaped = 0; - } else if (c == '\\') { - escaped = 1; - continue; - } else if (c == '.') { - c = (bp - label - 1); - if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */ - errno = EMSGSIZE; - return (-1); - } - if (label >= eom) { - errno = EMSGSIZE; - return (-1); - } - *label = c; - /* Fully qualified ? */ - if (*src == '\0') { - if (c != 0) { - if (bp >= eom) { - errno = EMSGSIZE; - return (-1); - } - *bp++ = '\0'; - } - if ((bp - dst) > MAXCDNAME) { - errno = EMSGSIZE; - return (-1); - } - return (1); - } - if (c == 0) { - errno = EMSGSIZE; - return (-1); - } - label = bp++; - continue; - } - if (bp >= eom) { - errno = EMSGSIZE; - return (-1); - } - *bp++ = (u_char)c; - } - c = (bp - label - 1); - if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */ - errno = EMSGSIZE; - return (-1); - } - if (label >= eom) { - errno = EMSGSIZE; - return (-1); - } - *label = c; - if (c != 0) { - if (bp >= eom) { - errno = EMSGSIZE; - return (-1); - } - *bp++ = 0; - } - if ((bp - dst) > MAXCDNAME) { /* src too big */ - errno = EMSGSIZE; - return (-1); - } - return (0); -} - -/* - * ns_name_unpack(msg, eom, src, dst, dstsiz) - * Unpack a domain name from a message, source may be compressed. - * return: - * -1 if it fails, or consumed octets if it succeeds. - */ -int -ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src, - u_char *dst, size_t dstsiz) -{ - const u_char *srcp, *dstlim; - u_char *dstp; - int n, len, checked; - - len = -1; - checked = 0; - dstp = dst; - srcp = src; - dstlim = dst + dstsiz; - if (srcp < msg || srcp >= eom) { - errno = EMSGSIZE; - return (-1); - } - /* Fetch next label in domain name. */ - while ((n = *srcp++) != 0) { - /* Check for indirection. */ - switch (n & NS_CMPRSFLGS) { - case 0: - /* Limit checks. */ - if (dstp + n + 1 >= dstlim || srcp + n >= eom) { - errno = EMSGSIZE; - return (-1); - } - checked += n + 1; - *dstp++ = n; - memcpy(dstp, srcp, n); - dstp += n; - srcp += n; - break; - - case NS_CMPRSFLGS: - if (srcp >= eom) { - errno = EMSGSIZE; - return (-1); - } - if (len < 0) - len = srcp - src + 1; - srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff)); - if (srcp < msg || srcp >= eom) { /* Out of range. */ - errno = EMSGSIZE; - return (-1); - } - checked += 2; - /* - * Check for loops in the compressed name; - * if we've looked at the whole message, - * there must be a loop. - */ - if (checked >= eom - msg) { - errno = EMSGSIZE; - return (-1); - } - break; - - default: - errno = EMSGSIZE; - return (-1); /* flag error */ - } - } - *dstp = '\0'; - if (len < 0) - len = srcp - src; - return (len); -} - -/* - * ns_name_pack(src, dst, dstsiz, dnptrs, lastdnptr) - * Pack domain name 'domain' into 'comp_dn'. - * return: - * Size of the compressed name, or -1. - * notes: - * 'dnptrs' is an array of pointers to previous compressed names. - * dnptrs[0] is a pointer to the beginning of the message. The array - * ends with NULL. - * 'lastdnptr' is a pointer to the end of the array pointed to - * by 'dnptrs'. - * Side effects: - * The list of pointers in dnptrs is updated for labels inserted into - * the message as we compress the name. If 'dnptr' is NULL, we don't - * try to compress names. If 'lastdnptr' is NULL, we don't update the - * list. - */ -int -ns_name_pack(const u_char *src, u_char *dst, int dstsiz, - const u_char **dnptrs, const u_char **lastdnptr) -{ - u_char *dstp; - const u_char **cpp, **lpp, *eob, *msg; - const u_char *srcp; - int n, l; - - srcp = src; - dstp = dst; - eob = dstp + dstsiz; - lpp = cpp = NULL; - if (dnptrs != NULL) { - if ((msg = *dnptrs++) != NULL) { - for (cpp = dnptrs; *cpp != NULL; cpp++) - (void)NULL; - lpp = cpp; /* end of list to search */ - } - } else - msg = NULL; - - /* make sure the domain we are about to add is legal */ - l = 0; - do { - n = *srcp; - if ((n & NS_CMPRSFLGS) != 0) { - errno = EMSGSIZE; - return (-1); - } - l += n + 1; - if (l > MAXCDNAME) { - errno = EMSGSIZE; - return (-1); - } - srcp += n + 1; - } while (n != 0); - - srcp = src; - do { - /* Look to see if we can use pointers. */ - n = *srcp; - if (n != 0 && msg != NULL) { - l = dn_find(srcp, msg, (const u_char * const *)dnptrs, - (const u_char * const *)lpp); - if (l >= 0) { - if (dstp + 1 >= eob) { - errno = EMSGSIZE; - return (-1); - } - *dstp++ = (l >> 8) | NS_CMPRSFLGS; - *dstp++ = l % 256; - return (dstp - dst); - } - /* Not found, save it. */ - if (lastdnptr != NULL && cpp < lastdnptr - 1 && - (dstp - msg) < 0x4000) { - *cpp++ = dstp; - *cpp = NULL; - } - } - /* copy label to buffer */ - if (n & NS_CMPRSFLGS) { /* Should not happen. */ - errno = EMSGSIZE; - return (-1); - } - if (dstp + 1 + n >= eob) { - errno = EMSGSIZE; - return (-1); - } - memcpy(dstp, srcp, n + 1); - srcp += n + 1; - dstp += n + 1; - } while (n != 0); - - if (dstp > eob) { - if (msg != NULL) - *lpp = NULL; - errno = EMSGSIZE; - return (-1); - } - return (dstp - dst); -} - -/* - * ns_name_uncompress(msg, eom, src, dst, dstsiz) - * Expand compressed domain name to presentation format. - * return: - * Number of bytes read out of `src', or -1 (with errno set). - * note: - * Root domain returns as "." not "". - */ -int -ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src, - char *dst, size_t dstsiz) -{ - u_char tmp[NS_MAXCDNAME]; - int n; - - if ((n = ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1) - return (-1); - if (ns_name_ntop(tmp, dst, dstsiz) == -1) - return (-1); - return (n); -} - -/* - * ns_name_compress(src, dst, dstsiz, dnptrs, lastdnptr) - * Compress a domain name into wire format, using compression pointers. - * return: - * Number of bytes consumed in `dst' or -1 (with errno set). - * notes: - * 'dnptrs' is an array of pointers to previous compressed names. - * dnptrs[0] is a pointer to the beginning of the message. - * The list ends with NULL. 'lastdnptr' is a pointer to the end of the - * array pointed to by 'dnptrs'. Side effect is to update the list of - * pointers for labels inserted into the message as we compress the name. - * If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr' - * is NULL, we don't update the list. - */ -int -ns_name_compress(const char *src, u_char *dst, size_t dstsiz, - const u_char **dnptrs, const u_char **lastdnptr) -{ - u_char tmp[NS_MAXCDNAME]; - - if (ns_name_pton(src, tmp, sizeof tmp) == -1) - return (-1); - return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr)); -} - -/* - * ns_name_skip(ptrptr, eom) - * Advance *ptrptr to skip over the compressed name it points at. - * return: - * 0 on success, -1 (with errno set) on failure. - */ -int -ns_name_skip(const u_char **ptrptr, const u_char *eom) { - const u_char *cp; - u_int n; - - cp = *ptrptr; - while (cp < eom && (n = *cp++) != 0) { - /* Check for indirection. */ - switch (n & NS_CMPRSFLGS) { - case 0: /* normal case, n == len */ - cp += n; - continue; - case NS_CMPRSFLGS: /* indirection */ - cp++; - break; - default: /* illegal type */ - errno = EMSGSIZE; - return (-1); - } - break; - } - if (cp > eom) { - errno = EMSGSIZE; - return (-1); - } - *ptrptr = cp; - return (0); -} - -/* Private. */ - -/* - * special(ch) - * Thinking in noninternationalized USASCII (per the DNS spec), - * is this characted special ("in need of quoting") ? - * return: - * boolean. - */ -static int -special(int ch) { - switch (ch) { - case 0x22: /* '"' */ - case 0x2E: /* '.' */ - case 0x3B: /* ';' */ - case 0x5C: /* '\\' */ - /* Special modifiers in zone files. */ - case 0x40: /* '@' */ - case 0x24: /* '$' */ - return (1); - default: - return (0); - } -} - -/* - * printable(ch) - * Thinking in noninternationalized USASCII (per the DNS spec), - * is this character visible and not a space when printed ? - * return: - * boolean. - */ -static int -printable(int ch) { - return (ch > 0x20 && ch < 0x7f); -} - -/* - * Thinking in noninternationalized USASCII (per the DNS spec), - * convert this character to lower case if it's upper case. - */ -static int -mklower(int ch) { - if (ch >= 0x41 && ch <= 0x5A) - return (ch + 0x20); - return (ch); -} - -/* - * dn_find(domain, msg, dnptrs, lastdnptr) - * Search for the counted-label name in an array of compressed names. - * return: - * offset from msg if found, or -1. - * notes: - * dnptrs is the pointer to the first name on the list, - * not the pointer to the start of the message. - */ -static int -dn_find(const u_char *domain, const u_char *msg, - const u_char * const *dnptrs, - const u_char * const *lastdnptr) -{ - const u_char *dn, *cp, *sp; - const u_char * const *cpp; - u_int n; - - for (cpp = dnptrs; cpp < lastdnptr; cpp++) { - dn = domain; - sp = cp = *cpp; - while ((n = *cp++) != 0) { - /* - * check for indirection - */ - switch (n & NS_CMPRSFLGS) { - case 0: /* normal case, n == len */ - if (n != *dn++) - goto next; - for ((void)NULL; n > 0; n--) - if (mklower(*dn++) != mklower(*cp++)) - goto next; - /* Is next root for both ? */ - if (*dn == '\0' && *cp == '\0') - return (sp - msg); - if (*dn) - continue; - goto next; - - case NS_CMPRSFLGS: /* indirection */ - cp = msg + (((n & 0x3f) << 8) | *cp); - break; - - default: /* illegal type */ - errno = EMSGSIZE; - return (-1); - } - } - next: ; - } - errno = ENOENT; - return (-1); -} diff --git a/c/src/exec/libnetworking/libc/ns_netint.c b/c/src/exec/libnetworking/libc/ns_netint.c deleted file mode 100644 index 3c09da8f8c..0000000000 --- a/c/src/exec/libnetworking/libc/ns_netint.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if !defined(__rtems__) -#if !defined(LINT) && !defined(CODECENTER) -static char rcsid[] = "$Id$"; -#endif /* not lint */ -#endif /* not rtems */ - -/* Import. */ - -#include -#include - -#include -#include - -u_int -ns_get16(const u_char *src) { - u_int dst; - - NS_GET16(dst, src); - return (dst); -} - -u_long -ns_get32(const u_char *src) { - u_long dst; - - NS_GET32(dst, src); - return (dst); -} - -void -ns_put16(u_int src, u_char *dst) { - NS_PUT16(src, dst); -} - -void -ns_put32(u_long src, u_char *dst) { - NS_PUT32(src, dst); -} diff --git a/c/src/exec/libnetworking/libc/ns_ntoa.c b/c/src/exec/libnetworking/libc/ns_ntoa.c deleted file mode 100644 index 9d0be2e1dc..0000000000 --- a/c/src/exec/libnetworking/libc/ns_ntoa.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 1986, 1993 - * 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[] = "@(#)ns_ntoa.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -char * -ns_ntoa(addr) - struct ns_addr addr; -{ - static char obuf[40]; - union { union ns_net net_e; u_long long_e; } net; - u_short port = htons(addr.x_port); - register char *cp; - char *cp2; - register u_char *up = addr.x_host.c_host; - u_char *uplim = up + 6; - static char *spectHex(); - - net.net_e = addr.x_net; - sprintf(obuf, "%lx", (u_long)ntohl(net.long_e)); - cp = spectHex(obuf); - cp2 = cp + 1; - while (*up==0 && up < uplim) up++; - if (up == uplim) { - if (port) { - sprintf(cp, ".0"); - cp += 2; - } - } else { - sprintf(cp, ".%x", *up++); - while (up < uplim) { - while (*cp) cp++; - sprintf(cp, "%02x", *up++); - } - cp = spectHex(cp2); - } - if (port) { - sprintf(cp, ".%x", port); - spectHex(cp + 1); - } - return (obuf); -} - -static char * -spectHex(p0) - char *p0; -{ - int ok = 0; - int nonzero = 0; - register char *p = p0; - for (; *p; p++) switch (*p) { - - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - *p += ('A' - 'a'); - /* fall into . . . */ - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - ok = 1; - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - nonzero = 1; - } - if (nonzero && !ok) { *p++ = 'H'; *p = 0; } - return (p); -} diff --git a/c/src/exec/libnetworking/libc/ns_parse.c b/c/src/exec/libnetworking/libc/ns_parse.c deleted file mode 100644 index cc1f070156..0000000000 --- a/c/src/exec/libnetworking/libc/ns_parse.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if !defined(__rtems__) -#if !defined(LINT) && !defined(CODECENTER) -static char rcsid[] = "$Id$"; -#endif /* not lint */ -#endif /* not rtems */ - -#include - -#include -#include - -#include -#include -#include - -/* These need to be in the same order as the nres.h:ns_flag enum. */ -struct _ns_flagdata _ns_flagdata[16] = { - { 0x8000, 15 }, /* qr. */ - { 0x7800, 11 }, /* opcode. */ - { 0x0400, 10 }, /* aa. */ - { 0x0200, 9 }, /* tc. */ - { 0x0100, 8 }, /* rd. */ - { 0x0080, 7 }, /* ra. */ - { 0x0040, 6 }, /* z. */ - { 0x0020, 5 }, /* ad. */ - { 0x0010, 4 }, /* cd. */ - { 0x000f, 0 }, /* rcode. */ - { 0x0000, 0 }, /* expansion (1/6). */ - { 0x0000, 0 }, /* expansion (2/6). */ - { 0x0000, 0 }, /* expansion (3/6). */ - { 0x0000, 0 }, /* expansion (4/6). */ - { 0x0000, 0 }, /* expansion (5/6). */ - { 0x0000, 0 }, /* expansion (6/6). */ -}; - -static int -skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) { - const u_char *optr = ptr; - - for ((void)NULL; count > 0; count--) { - int b, rdlength; - - b = dn_skipname(ptr, eom); - if (b < 0) - goto emsgsize; - ptr += b/*Name*/ + NS_INT16SZ/*Type*/ + NS_INT16SZ/*Class*/; - if (section != ns_s_qd) { - if (ptr + NS_INT32SZ > eom) - goto emsgsize; - ptr += NS_INT32SZ/*TTL*/; - if (ptr + NS_INT16SZ > eom) - goto emsgsize; - NS_GET16(rdlength, ptr); - ptr += rdlength/*RData*/; - } - } - if (ptr > eom) - goto emsgsize; - return (ptr - optr); - emsgsize: - errno = EMSGSIZE; - return (-1); -} - -int -ns_initparse(const u_char *msg, int msglen, ns_msg *handle) { - const u_char *eom = msg + msglen; - int i; - - memset(handle, 0x5e, sizeof *handle); - handle->_msg = msg; - handle->_eom = eom; - if (msg + NS_INT16SZ > eom) - goto emsgsize; - NS_GET16(handle->_id, msg); - if (msg + NS_INT16SZ > eom) - goto emsgsize; - NS_GET16(handle->_flags, msg); - for (i = 0; i < ns_s_max; i++) { - if (msg + NS_INT16SZ > eom) - goto emsgsize; - NS_GET16(handle->_counts[i], msg); - } - for (i = 0; i < ns_s_max; i++) - if (handle->_counts[i] == 0) - handle->_sections[i] = NULL; - else { - int b = skiprr(msg, eom, (ns_sect)i, - handle->_counts[i]); - - if (b < 0) - return (-1); - handle->_sections[i] = msg; - msg += b; - } - if (msg != eom) - goto emsgsize; - handle->_sect = ns_s_max; - handle->_rrnum = -1; - handle->_ptr = NULL; - return (0); - emsgsize: - errno = EMSGSIZE; - return (-1); -} - -int -ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) { - int b; - - /* Make section right. */ - if (section < 0 || section >= ns_s_max) - goto enodev; - if ((int)section != (int)handle->_sect) { - handle->_sect = section; - handle->_rrnum = 0; - handle->_ptr = handle->_sections[(int)section]; - } - - /* Make rrnum right. */ - if (rrnum == -1) - rrnum = handle->_rrnum; - if (rrnum < 0 || rrnum >= handle->_counts[(int)section]) - goto enodev; - if (rrnum < handle->_rrnum) { - handle->_rrnum = 0; - handle->_ptr = handle->_sections[(int)section]; - } - - b = skiprr(handle->_msg, handle->_eom, section, - rrnum - handle->_rrnum); - if (b < 0) - return (-1); - handle->_ptr += b; - handle->_rrnum = rrnum; - - /* Do the parse. */ - b = dn_expand(handle->_msg, handle->_eom, - handle->_ptr, rr->name, NS_MAXDNAME); - if (b < 0) - return (-1); - handle->_ptr += b; - if (handle->_ptr + NS_INT16SZ > handle->_eom) - goto emsgsize; - NS_GET16(rr->type, handle->_ptr); - if (handle->_ptr + NS_INT16SZ > handle->_eom) - goto emsgsize; - NS_GET16(rr->class, handle->_ptr); - if (section == ns_s_qd) { - rr->ttl = 0; - rr->rdlength = 0; - rr->rdata = NULL; - } else { - if (handle->_ptr + NS_INT32SZ > handle->_eom) - goto emsgsize; - NS_GET32(rr->ttl, handle->_ptr); - if (handle->_ptr + NS_INT16SZ > handle->_eom) - goto emsgsize; - NS_GET16(rr->rdlength, handle->_ptr); - if (handle->_ptr + rr->rdlength > handle->_eom) - goto emsgsize; - rr->rdata = handle->_ptr; - handle->_ptr += rr->rdlength; - } - handle->_rrnum++; - - /* All done. */ - return (0); - enodev: - errno = ENODEV; - return (-1); - emsgsize: - errno = EMSGSIZE; - return (-1); -} diff --git a/c/src/exec/libnetworking/libc/ns_print.c b/c/src/exec/libnetworking/libc/ns_print.c deleted file mode 100644 index f7d7d16c64..0000000000 --- a/c/src/exec/libnetworking/libc/ns_print.c +++ /dev/null @@ -1,745 +0,0 @@ -/* - * Copyright (c) 1996, 1998 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if !defined(__rtems__) -#if !defined(LINT) && !defined(CODECENTER) -static char rcsid[] = "$Id$"; -#endif /* not lint */ -#endif /* not rtems */ - -/* Import. */ - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#define SPRINTF(x) ((size_t)sprintf x) - -/* Forward. */ - -static size_t prune_origin(const char *name, const char *origin); -static int charstr(const u_char *rdata, const u_char *edata, - char **buf, size_t *buflen); -static int addname(const u_char *msg, size_t msglen, - const u_char **p, const char *origin, - char **buf, size_t *buflen); -static void addlen(size_t len, char **buf, size_t *buflen); -static int addstr(const char *src, size_t len, - char **buf, size_t *buflen); -static int addtab(size_t len, size_t target, int spaced, - char **buf, size_t *buflen); - -/* Macros. */ - -#define T(x) \ - do { \ - if ((x) < 0) \ - return (-1); \ - } while (0) - -/* Public. */ - -/* - * int - * ns_sprintrr(handle, rr, name_ctx, origin, buf, buflen) - * Convert an RR to presentation format. - * return: - * Number of characters written to buf, or -1 (check errno). - */ -int -ns_sprintrr(const ns_msg *handle, const ns_rr *rr, - const char *name_ctx, const char *origin, - char *buf, size_t buflen) -{ - int n; - - n = ns_sprintrrf(ns_msg_base(*handle), ns_msg_size(*handle), - ns_rr_name(*rr), ns_rr_class(*rr), ns_rr_type(*rr), - ns_rr_ttl(*rr), ns_rr_rdata(*rr), ns_rr_rdlen(*rr), - name_ctx, origin, buf, buflen); - return (n); -} - -/* - * int - * ns_sprintrrf(msg, msglen, name, class, type, ttl, rdata, rdlen, - * name_ctx, origin, buf, buflen) - * Convert the fields of an RR into presentation format. - * return: - * Number of characters written to buf, or -1 (check errno). - */ -int -ns_sprintrrf(const u_char *msg, size_t msglen, - const char *name, ns_class class, ns_type type, - u_long ttl, const u_char *rdata, size_t rdlen, - const char *name_ctx, const char *origin, - char *buf, size_t buflen) -{ - const char *obuf = buf; - const u_char *edata = rdata + rdlen; - int spaced = 0; - - const char *comment; - char tmp[100]; - int len, x; - - /* - * Owner. - */ - if (name_ctx != NULL && strcasecmp(name_ctx, name) == 0) { - T(addstr("\t\t\t", 3, &buf, &buflen)); - } else { - len = prune_origin(name, origin); - if (len == 0) { - T(addstr("@\t\t\t", 4, &buf, &buflen)); - } else { - T(addstr(name, len, &buf, &buflen)); - /* Origin not used and no trailing dot? */ - if ((!origin || !origin[0] || name[len] == '\0') && - name[len - 1] != '.') { - T(addstr(".", 1, &buf, &buflen)); - len++; - } - T(spaced = addtab(len, 24, spaced, &buf, &buflen)); - } - } - - /* - * TTL, Class, Type. - */ - T(x = ns_format_ttl(ttl, buf, buflen)); - addlen(x, &buf, &buflen); - len = SPRINTF((tmp, " %s %s", p_class(class), p_type(type))); - T(addstr(tmp, len, &buf, &buflen)); - T(spaced = addtab(x + len, 16, spaced, &buf, &buflen)); - - /* - * RData. - */ - switch (type) { - case ns_t_a: - if (rdlen != NS_INADDRSZ) - goto formerr; - (void) inet_ntop(AF_INET, rdata, buf, buflen); - addlen(strlen(buf), &buf, &buflen); - break; - - case ns_t_cname: - case ns_t_mb: - case ns_t_mg: - case ns_t_mr: - case ns_t_ns: - case ns_t_ptr: - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - break; - - case ns_t_hinfo: - case ns_t_isdn: - /* First word. */ - T(len = charstr(rdata, edata, &buf, &buflen)); - if (len == 0) - goto formerr; - rdata += len; - T(addstr(" ", 1, &buf, &buflen)); - - /* Second word. */ - T(len = charstr(rdata, edata, &buf, &buflen)); - if (len == 0) - goto formerr; - rdata += len; - break; - - case ns_t_soa: { - u_long t; - - /* Server name. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - T(addstr(" ", 1, &buf, &buflen)); - - /* Administrator name. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - T(addstr(" (\n", 3, &buf, &buflen)); - spaced = 0; - - if ((edata - rdata) != 5*NS_INT32SZ) - goto formerr; - - /* Serial number. */ - t = ns_get32(rdata); rdata += NS_INT32SZ; - T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); - len = SPRINTF((tmp, "%lu", t)); - T(addstr(tmp, len, &buf, &buflen)); - T(spaced = addtab(len, 16, spaced, &buf, &buflen)); - T(addstr("; serial\n", 9, &buf, &buflen)); - spaced = 0; - - /* Refresh interval. */ - t = ns_get32(rdata); rdata += NS_INT32SZ; - T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); - T(len = ns_format_ttl(t, buf, buflen)); - addlen(len, &buf, &buflen); - T(spaced = addtab(len, 16, spaced, &buf, &buflen)); - T(addstr("; refresh\n", 10, &buf, &buflen)); - spaced = 0; - - /* Retry interval. */ - t = ns_get32(rdata); rdata += NS_INT32SZ; - T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); - T(len = ns_format_ttl(t, buf, buflen)); - addlen(len, &buf, &buflen); - T(spaced = addtab(len, 16, spaced, &buf, &buflen)); - T(addstr("; retry\n", 8, &buf, &buflen)); - spaced = 0; - - /* Expiry. */ - t = ns_get32(rdata); rdata += NS_INT32SZ; - T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); - T(len = ns_format_ttl(t, buf, buflen)); - addlen(len, &buf, &buflen); - T(spaced = addtab(len, 16, spaced, &buf, &buflen)); - T(addstr("; expiry\n", 9, &buf, &buflen)); - spaced = 0; - - /* Minimum TTL. */ - t = ns_get32(rdata); rdata += NS_INT32SZ; - T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); - T(len = ns_format_ttl(t, buf, buflen)); - addlen(len, &buf, &buflen); - T(addstr(" )", 2, &buf, &buflen)); - T(spaced = addtab(len, 16, spaced, &buf, &buflen)); - T(addstr("; minimum\n", 10, &buf, &buflen)); - - break; - } - - case ns_t_mx: - case ns_t_afsdb: - case ns_t_rt: { - u_int t; - - if (rdlen < NS_INT16SZ) - goto formerr; - - /* Priority. */ - t = ns_get16(rdata); - rdata += NS_INT16SZ; - len = SPRINTF((tmp, "%u ", t)); - T(addstr(tmp, len, &buf, &buflen)); - - /* Target. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - - break; - } - - case ns_t_px: { - u_int t; - - if (rdlen < NS_INT16SZ) - goto formerr; - - /* Priority. */ - t = ns_get16(rdata); - rdata += NS_INT16SZ; - len = SPRINTF((tmp, "%u ", t)); - T(addstr(tmp, len, &buf, &buflen)); - - /* Name1. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - T(addstr(" ", 1, &buf, &buflen)); - - /* Name2. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - - break; - } - - case ns_t_x25: - T(len = charstr(rdata, edata, &buf, &buflen)); - if (len == 0) - goto formerr; - rdata += len; - break; - - case ns_t_txt: - while (rdata < edata) { - T(len = charstr(rdata, edata, &buf, &buflen)); - if (len == 0) - goto formerr; - rdata += len; - if (rdata < edata) - T(addstr(" ", 1, &buf, &buflen)); - } - break; - - case ns_t_nsap: { - char t[255*3]; - - (void) inet_nsap_ntoa(rdlen, rdata, t); - T(addstr(t, strlen(t), &buf, &buflen)); - break; - } - - case ns_t_aaaa: - if (rdlen != NS_IN6ADDRSZ) - goto formerr; - (void) inet_ntop(AF_INET6, rdata, buf, buflen); - addlen(strlen(buf), &buf, &buflen); - break; - - case ns_t_loc: { - char t[255]; - - /* XXX protocol format checking? */ - (void) loc_ntoa(rdata, t); - T(addstr(t, strlen(t), &buf, &buflen)); - break; - } - - case ns_t_naptr: { - u_int order, preference; - char t[50]; - - if (rdlen < 2*NS_INT16SZ) - goto formerr; - - /* Order, Precedence. */ - order = ns_get16(rdata); rdata += NS_INT16SZ; - preference = ns_get16(rdata); rdata += NS_INT16SZ; - len = SPRINTF((t, "%u %u ", order, preference)); - T(addstr(t, len, &buf, &buflen)); - - /* Flags. */ - T(len = charstr(rdata, edata, &buf, &buflen)); - if (len == 0) - goto formerr; - rdata += len; - T(addstr(" ", 1, &buf, &buflen)); - - /* Service. */ - T(len = charstr(rdata, edata, &buf, &buflen)); - if (len == 0) - goto formerr; - rdata += len; - T(addstr(" ", 1, &buf, &buflen)); - - /* Regexp. */ - T(len = charstr(rdata, edata, &buf, &buflen)); - if (len < 0) - return (-1); - if (len == 0) - goto formerr; - rdata += len; - T(addstr(" ", 1, &buf, &buflen)); - - /* Server. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - break; - } - - case ns_t_srv: { - u_int priority, weight, port; - char t[50]; - - if (rdlen < NS_INT16SZ*3) - goto formerr; - - /* Priority, Weight, Port. */ - priority = ns_get16(rdata); rdata += NS_INT16SZ; - weight = ns_get16(rdata); rdata += NS_INT16SZ; - port = ns_get16(rdata); rdata += NS_INT16SZ; - len = SPRINTF((t, "%u %u %u ", priority, weight, port)); - T(addstr(t, len, &buf, &buflen)); - - /* Server. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - break; - } - - case ns_t_minfo: - case ns_t_rp: - /* Name1. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - T(addstr(" ", 1, &buf, &buflen)); - - /* Name2. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - - break; - - case ns_t_wks: { - int n, lcnt; - - if (rdlen < NS_INT32SZ + 1) - goto formerr; - - /* Address. */ - (void) inet_ntop(AF_INET, rdata, buf, buflen); - addlen(strlen(buf), &buf, &buflen); - rdata += NS_INADDRSZ; - - /* Protocol. */ - len = SPRINTF((tmp, " %u ( ", *rdata)); - T(addstr(tmp, len, &buf, &buflen)); - rdata += NS_INT8SZ; - - /* Bit map. */ - n = 0; - lcnt = 0; - while (rdata < edata) { - u_int c = *rdata++; - do { - if (c & 0200) { - if (lcnt == 0) { - T(addstr("\n\t\t\t\t", 5, - &buf, &buflen)); - lcnt = 10; - spaced = 0; - } - len = SPRINTF((tmp, "%d ", n)); - T(addstr(tmp, len, &buf, &buflen)); - lcnt--; - } - c <<= 1; - } while (++n & 07); - } - T(addstr(")", 1, &buf, &buflen)); - - break; - } - - case ns_t_key: { - char base64_key[NS_MD5RSA_MAX_BASE64]; - u_int keyflags, protocol, algorithm; - const char *leader; - int n; - - if (rdlen < NS_INT16SZ + NS_INT8SZ + NS_INT8SZ) - goto formerr; - - /* Key flags, Protocol, Algorithm. */ - keyflags = ns_get16(rdata); rdata += NS_INT16SZ; - protocol = *rdata++; - algorithm = *rdata++; - len = SPRINTF((tmp, "0x%04x %u %u", - keyflags, protocol, algorithm)); - T(addstr(tmp, len, &buf, &buflen)); - - /* Public key data. */ - len = b64_ntop(rdata, edata - rdata, - base64_key, sizeof base64_key); - if (len < 0) - goto formerr; - if (len > 15) { - T(addstr(" (", 2, &buf, &buflen)); - leader = "\n\t\t"; - spaced = 0; - } else - leader = " "; - for (n = 0; n < len; n += 48) { - T(addstr(leader, strlen(leader), &buf, &buflen)); - T(addstr(base64_key + n, MIN(len - n, 48), - &buf, &buflen)); - } - if (len > 15) - T(addstr(" )", 2, &buf, &buflen)); - - break; - } - - case ns_t_sig: { - char base64_key[NS_MD5RSA_MAX_BASE64]; - u_int type, algorithm, labels, footprint; - const char *leader; - u_long t; - int n; - - if (rdlen < 22) - goto formerr; - - /* Type covered, Algorithm, Label count, Original TTL. */ - type = ns_get16(rdata); rdata += NS_INT16SZ; - algorithm = *rdata++; - labels = *rdata++; - t = ns_get32(rdata); rdata += NS_INT32SZ; - len = SPRINTF((tmp, " %s %d %lu ", - p_type(type), algorithm, t)); - T(addstr(tmp, len, &buf, &buflen)); - if (labels != (u_int)dn_count_labels(name)) - goto formerr; - - /* Signature expiry. */ - t = ns_get32(rdata); rdata += NS_INT32SZ; - len = SPRINTF((tmp, "%s ", p_secstodate(t))); - T(addstr(tmp, len, &buf, &buflen)); - - /* Time signed. */ - t = ns_get32(rdata); rdata += NS_INT32SZ; - len = SPRINTF((tmp, "%s ", p_secstodate(t))); - T(addstr(tmp, len, &buf, &buflen)); - - /* Signature Footprint. */ - footprint = ns_get16(rdata); rdata += NS_INT16SZ; - len = SPRINTF((tmp, "%u ", footprint)); - T(addstr(tmp, len, &buf, &buflen)); - - /* Signer's name. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - - /* Signature. */ - len = b64_ntop(rdata, edata - rdata, - base64_key, sizeof base64_key); - if (len > 15) { - T(addstr(" (", 2, &buf, &buflen)); - leader = "\n\t\t"; - spaced = 0; - } else - leader = " "; - if (len < 0) - goto formerr; - for (n = 0; n < len; n += 48) { - T(addstr(leader, strlen(leader), &buf, &buflen)); - T(addstr(base64_key + n, MIN(len - n, 48), - &buf, &buflen)); - } - if (len > 15) - T(addstr(" )", 2, &buf, &buflen)); - - break; - } - - case ns_t_nxt: { - int n, c; - - /* Next domain name. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - - /* Type bit map. */ - n = edata - rdata; - for (c = 0; c < n*8; c++) - if (NS_NXT_BIT_ISSET(c, rdata)) { - len = SPRINTF((tmp, " %s", p_type(c))); - T(addstr(tmp, len, &buf, &buflen)); - } - break; - } - - default: - comment = "unknown RR type"; - goto hexify; - } - return (buf - obuf); - formerr: - comment = "RR format error"; - hexify: { - int n, m; - char *p; - - len = SPRINTF((tmp, "\\#(\t\t; %s", comment)); - T(addstr(tmp, len, &buf, &buflen)); - while (rdata < edata) { - p = tmp; - p += SPRINTF((p, "\n\t")); - spaced = 0; - n = MIN(16, edata - rdata); - for (m = 0; m < n; m++) - p += SPRINTF((p, "%02x ", rdata[m])); - T(addstr(tmp, p - tmp, &buf, &buflen)); - if (n < 16) { - T(addstr(")", 1, &buf, &buflen)); - T(addtab(p - tmp + 1, 48, spaced, &buf, &buflen)); - } - p = tmp; - p += SPRINTF((p, "; ")); - for (m = 0; m < n; m++) - *p++ = (isascii(rdata[m]) && isprint(rdata[m])) - ? rdata[m] - : '.'; - T(addstr(tmp, p - tmp, &buf, &buflen)); - rdata += n; - } - return (buf - obuf); - } -} - -/* Private. */ - -/* - * size_t - * prune_origin(name, origin) - * Find out if the name is at or under the current origin. - * return: - * Number of characters in name before start of origin, - * or length of name if origin does not match. - * notes: - * This function should share code with samedomain(). - */ -static size_t -prune_origin(const char *name, const char *origin) { - const char *oname = name; - - while (*name != '\0') { - if (origin != NULL && strcasecmp(name, origin) == 0) - return (name - oname - (name > oname)); - while (*name != '\0') { - if (*name == '\\') { - name++; - /* XXX need to handle \nnn form. */ - if (*name == '\0') - break; - } else if (*name == '.') { - name++; - break; - } - name++; - } - } - return (name - oname); -} - -/* - * int - * charstr(rdata, edata, buf, buflen) - * Format a into the presentation buffer. - * return: - * Number of rdata octets consumed - * 0 for protocol format error - * -1 for output buffer error - * side effects: - * buffer is advanced on success. - */ -static int -charstr(const u_char *rdata, const u_char *edata, char **buf, size_t *buflen) { - const u_char *odata = rdata; - size_t save_buflen = *buflen; - char *save_buf = *buf; - - if (addstr("\"", 1, buf, buflen) < 0) - goto enospc; - if (rdata < edata) { - int n = *rdata; - - if (rdata + 1 + n <= edata) { - rdata++; - while (n-- > 0) { - if (strchr("\n\"\\", *rdata) != NULL) - if (addstr("\\", 1, buf, buflen) < 0) - goto enospc; - if (addstr((const char *)rdata, 1, - buf, buflen) < 0) - goto enospc; - rdata++; - } - } - } - if (addstr("\"", 1, buf, buflen) < 0) - goto enospc; - return (rdata - odata); - enospc: - errno = ENOSPC; - *buf = save_buf; - *buflen = save_buflen; - return (-1); -} - -static int -addname(const u_char *msg, size_t msglen, - const u_char **pp, const char *origin, - char **buf, size_t *buflen) -{ - size_t newlen, save_buflen = *buflen; - char *save_buf = *buf; - int n; - - n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen); - if (n < 0) - goto enospc; /* Guess. */ - newlen = prune_origin(*buf, origin); - if ((origin == NULL || origin[0] == '\0' || (*buf)[newlen] == '\0') && - (newlen == 0 || (*buf)[newlen - 1] != '.')) { - /* No trailing dot. */ - if (newlen + 2 > *buflen) - goto enospc; /* No room for ".\0". */ - (*buf)[newlen++] = '.'; - (*buf)[newlen] = '\0'; - } - if (newlen == 0) { - /* Use "@" instead of name. */ - if (newlen + 2 > *buflen) - goto enospc; /* No room for "@\0". */ - (*buf)[newlen++] = '@'; - (*buf)[newlen] = '\0'; - } - *pp += n; - addlen(newlen, buf, buflen); - **buf = '\0'; - return (newlen); - enospc: - errno = ENOSPC; - *buf = save_buf; - *buflen = save_buflen; - return (-1); -} - -static void -addlen(size_t len, char **buf, size_t *buflen) { - assert(len <= *buflen); - *buf += len; - *buflen -= len; -} - -static int -addstr(const char *src, size_t len, char **buf, size_t *buflen) { - if (len > *buflen) { - errno = ENOSPC; - return (-1); - } - memcpy(*buf, src, len); - addlen(len, buf, buflen); - **buf = '\0'; - return (0); -} - -static int -addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen) { - size_t save_buflen = *buflen; - char *save_buf = *buf; - int t; - - if (spaced || len >= target - 1) { - T(addstr(" ", 2, buf, buflen)); - spaced = 1; - } else { - for (t = (target - len - 1) / 8; t >= 0; t--) - if (addstr("\t", 1, buf, buflen) < 0) { - *buflen = save_buflen; - *buf = save_buf; - return (-1); - } - spaced = 0; - } - return (spaced); -} diff --git a/c/src/exec/libnetworking/libc/ns_ttl.c b/c/src/exec/libnetworking/libc/ns_ttl.c deleted file mode 100644 index 75093c1dbc..0000000000 --- a/c/src/exec/libnetworking/libc/ns_ttl.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if !defined(__rtems__) -#if !defined(LINT) && !defined(CODECENTER) -static char rcsid[] = "$Id$"; -#endif /* not lint */ -#endif /* not rtems */ - -/* Import. */ - -#include - -#include -#include -#include -#include - -#define SPRINTF(x) ((size_t)sprintf x) - -/* Forward. */ - -static int fmt1(int t, char s, char **buf, size_t *buflen); - -/* Macros. */ - -#define T(x) if ((x) < 0) return (-1); else (void)NULL - -/* Public. */ - -int -ns_format_ttl(u_long src, char *dst, size_t dstlen) { - char *odst = dst; - int secs, mins, hours, days, weeks, x; - char *p; - - secs = src % 60; src /= 60; - mins = src % 60; src /= 60; - hours = src % 24; src /= 24; - days = src % 7; src /= 7; - weeks = src; src = 0; - - x = 0; - if (weeks) { - T(fmt1(weeks, 'W', &dst, &dstlen)); - x++; - } - if (days) { - T(fmt1(days, 'D', &dst, &dstlen)); - x++; - } - if (hours) { - T(fmt1(hours, 'H', &dst, &dstlen)); - x++; - } - if (mins) { - T(fmt1(mins, 'M', &dst, &dstlen)); - x++; - } - if (secs || !(weeks || days || hours || mins)) { - T(fmt1(secs, 'S', &dst, &dstlen)); - x++; - } - - if (x > 1) { - int ch; - - for (p = odst; (ch = *p) != '\0'; p++) - if (isascii(ch) && isupper(ch)) - *p = tolower(ch); - } - - return (dst - odst); -} - -int -ns_parse_ttl(const char *src, u_long *dst) { - u_long ttl, tmp; - int ch, digits, dirty; - - ttl = 0; - tmp = 0; - digits = 0; - dirty = 0; - while ((ch = *src++) != '\0') { - if (!isascii(ch) || !isprint(ch)) - goto einval; - if (isdigit(ch)) { - tmp *= 10; - tmp += (ch - '0'); - digits++; - continue; - } - if (digits == 0) - goto einval; - if (islower(ch)) - ch = toupper(ch); - switch (ch) { - case 'W': tmp *= 7; - case 'D': tmp *= 24; - case 'H': tmp *= 60; - case 'M': tmp *= 60; - case 'S': break; - default: goto einval; - } - ttl += tmp; - tmp = 0; - digits = 0; - dirty = 1; - } - if (digits > 0) { - if (dirty) - goto einval; - else - ttl += tmp; - } - *dst = ttl; - return (0); - - einval: - errno = EINVAL; - return (-1); -} - -/* Private. */ - -static int -fmt1(int t, char s, char **buf, size_t *buflen) { - char tmp[50]; - size_t len; - - len = SPRINTF((tmp, "%d%c", t, s)); - if (len + 1 > *buflen) - return (-1); - strcpy(*buf, tmp); - *buf += len; - *buflen -= len; - return (0); -} diff --git a/c/src/exec/libnetworking/libc/nsap_addr.c b/c/src/exec/libnetworking/libc/nsap_addr.c deleted file mode 100644 index a7af57a266..0000000000 --- a/c/src/exec/libnetworking/libc/nsap_addr.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1996, 1998 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include - -static char -xtob(c) - register int c; -{ - return (c - (((c >= '0') && (c <= '9')) ? '0' : '7')); -} - -u_int -inet_nsap_addr(ascii, binary, maxlen) - const char *ascii; - u_char *binary; - int maxlen; -{ - u_char c, nib; - u_int len = 0; - - while ((c = *ascii++) != '\0' && len < (u_int)maxlen) { - if (c == '.' || c == '+' || c == '/') - continue; - if (!isascii(c)) - return (0); - if (islower(c)) - c = toupper(c); - if (isxdigit(c)) { - nib = xtob(c); - c = *ascii++; - if (c != '\0') { - c = toupper(c); - if (isxdigit(c)) { - *binary++ = (nib << 4) | xtob(c); - len++; - } else - return (0); - } - else - return (0); - } - else - return (0); - } - return (len); -} - -char * -inet_nsap_ntoa(binlen, binary, ascii) - int binlen; - register const u_char *binary; - register char *ascii; -{ - register int nib; - int i; - static char tmpbuf[255*3]; - char *start; - - if (ascii) - start = ascii; - else { - ascii = tmpbuf; - start = tmpbuf; - } - - if (binlen > 255) - binlen = 255; - - for (i = 0; i < binlen; i++) { - nib = *binary >> 4; - *ascii++ = nib + (nib < 10 ? '0' : '7'); - nib = *binary++ & 0x0f; - *ascii++ = nib + (nib < 10 ? '0' : '7'); - if (((i % 2) == 0 && (i + 1) < binlen)) - *ascii++ = '.'; - } - *ascii = '\0'; - return (start); -} diff --git a/c/src/exec/libnetworking/libc/rcmd.3 b/c/src/exec/libnetworking/libc/rcmd.3 deleted file mode 100644 index e25057fa4e..0000000000 --- a/c/src/exec/libnetworking/libc/rcmd.3 +++ /dev/null @@ -1,204 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" 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. -.\" -.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93 -.\" $Id$ -.\" -.Dd February 15, 1996 -.Dt RCMD 3 -.Os BSD 4.2 -.Sh NAME -.Nm rcmd , -.Nm rresvport , -.Nm iruserok , -.Nm ruserok -.Nd routines for returning a stream to a remote command -.Sh SYNOPSIS -.Fd #include -.Ft int -.Fn rcmd "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p" -.Ft int -.Fn rresvport "int *port" -.Ft int -.Fn iruserok "u_long raddr" "int superuser" "const char *ruser" "const char *luser" -.Ft int -.Fn ruserok "const char *rhost" "int superuser" "const char *ruser" "const char *luser" -.Sh DESCRIPTION -The -.Fn rcmd -function -is used by the super-user to execute a command on -a remote machine using an authentication scheme based -on reserved port numbers. -The -.Fn rresvport -function -returns a descriptor to a socket -with an address in the privileged port space. -The -.Fn ruserok -function -is used by servers -to authenticate clients requesting service with -.Fn rcmd . -All three functions are present in the same file and are used -by the -.Xr rshd 8 -server (among others). -.Pp -The -.Fn rcmd -function -looks up the host -.Fa *ahost -using -.Xr gethostbyname 3 , -returning \-1 if the host does not exist. -Otherwise -.Fa *ahost -is set to the standard name of the host -and a connection is established to a server -residing at the well-known Internet port -.Fa inport . -.Pp -If the connection succeeds, -a socket in the Internet domain of type -.Dv SOCK_STREAM -is returned to the caller, and given to the remote -command as -.Em stdin -and -.Em stdout . -If -.Fa fd2p -is non-zero, then an auxiliary channel to a control -process will be set up, and a descriptor for it will be placed -in -.Fa *fd2p . -The control process will return diagnostic -output from the command (unit 2) on this channel, and will also -accept bytes on this channel as being -.Tn UNIX -signal numbers, to be -forwarded to the process group of the command. -If -.Fa fd2p -is 0, then the -.Em stderr -(unit 2 of the remote -command) will be made the same as the -.Em stdout -and no -provision is made for sending arbitrary signals to the remote process, -although you may be able to get its attention by using out-of-band data. -.Pp -The protocol is described in detail in -.Xr rshd 8 . -.Pp -The -.Fn rresvport -function is used to obtain a socket with a privileged -address bound to it. This socket is suitable for use -by -.Fn rcmd -and several other functions. Privileged Internet ports are those -in the range 0 to 1023. Only the super-user -is allowed to bind an address of this sort to a socket. -.Pp -The -.Fn iruserok -and -.Fn ruserok -functions take a remote host's IP address or name, as returned by the -.Xr gethostbyname 3 -routines, two user names and a flag indicating whether the local user's -name is that of the super-user. -Then, if the user is -.Em NOT -the super-user, it checks the -.Pa /etc/hosts.equiv -file. -If that lookup is not done, or is unsuccessful, the -.Pa .rhosts -in the local user's home directory is checked to see if the request for -service is allowed. -.Pp -If this file does not exist, is not a regular file, is owned by anyone -other than the user or the super-user, or is writable by anyone other -than the owner, the check automatically fails. -Zero is returned if the machine name is listed in the -.Dq Pa hosts.equiv -file, or the host and remote user name are found in the -.Dq Pa .rhosts -file; otherwise -.Fn iruserok -and -.Fn ruserok -return \-1. -If the local domain (as obtained from -.Xr gethostname 3 ) -is the same as the remote domain, only the machine name need be specified. -.Pp -The -.Fn iruserok -function is strongly preferred for security reasons. -It requires trusting the local DNS at most, while the -.Fn ruserok -function requires trusting the entire DNS, which can be spoofed. -.Sh DIAGNOSTICS -The -.Fn rcmd -function -returns a valid socket descriptor on success. -It returns \-1 on error and prints a diagnostic message on the standard error. -.Pp -The -.Fn rresvport -function -returns a valid, bound socket descriptor on success. -It returns \-1 on error with the global value -.Va errno -set according to the reason for failure. -The error code -.Dv EAGAIN -is overloaded to mean ``All network ports in use.'' -.Sh SEE ALSO -.Xr rlogin 1 , -.Xr rsh 1 , -.Xr intro 2 , -.Xr rexec 3 , -.Xr rexecd 8 , -.Xr rlogind 8 , -.Xr rshd 8 -.Sh HISTORY -These -functions appeared in -.Bx 4.2 . diff --git a/c/src/exec/libnetworking/libc/rcmd.c b/c/src/exec/libnetworking/libc/rcmd.c deleted file mode 100644 index 8dd4d0cbe2..0000000000 --- a/c/src/exec/libnetworking/libc/rcmd.c +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Copyright (c) 1983, 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. - * - * $Id$ - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef YP -#include -#include -#include -#endif - - -#define max(a, b) ((a > b) ? a : b) - -#ifdef __rtems__ -int rresvport(); -#define bzero(a,s) memset((a),0,(s)) -#define bcmp memcmp -#define bcopy(s,d,i) memcpy(d,s,i) -#else /* __rtems__ */ - -extern int innetgr __P(( const char *, const char *, const char *, const char * )); - -int __ivaliduser __P((FILE *, u_long, const char *, const char *)); -static int __icheckhost __P((u_long, char *)); - -#endif - -int -rcmd(ahost, rport, locuser, remuser, cmd, fd2p) - char **ahost; - u_short rport; - const char *locuser, *remuser, *cmd; - int *fd2p; -{ - struct hostent *hp; - struct sockaddr_in sin, from; - fd_set reads; -#ifndef __rtems__ - long oldmask; -#endif - pid_t pid; - int s, lport, timo; - char c; - - pid = getpid(); - hp = gethostbyname(*ahost); - if (hp == NULL) { - herror(*ahost); - return (-1); - } - *ahost = hp->h_name; -#ifndef __rtems__ - oldmask = sigblock(sigmask(SIGURG)); -#endif - for (timo = 1, lport = IPPORT_RESERVED - 1;;) { - s = rresvport(&lport); - if (s < 0) { - if (errno == EAGAIN) - (void)fprintf(stderr, - "rcmd: socket: All ports in use\n"); - else - (void)fprintf(stderr, "rcmd: socket: %s\n", - strerror(errno)); -#ifndef __rtems__ - sigsetmask(oldmask); -#endif - return (-1); - } - fcntl(s, F_SETOWN, pid); - bzero(&sin, sizeof sin); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = hp->h_addrtype; - sin.sin_port = rport; - bcopy(hp->h_addr_list[0], &sin.sin_addr, MIN(hp->h_length, sizeof sin.sin_addr)); - if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0) - break; - (void)close(s); - if (errno == EADDRINUSE) { - lport--; - continue; - } - if (errno == ECONNREFUSED && timo <= 16) { - (void)sleep(timo); - timo *= 2; - continue; - } - if (hp->h_addr_list[1] != NULL) { - int oerrno = errno; - - (void)fprintf(stderr, "connect to address %s: ", - inet_ntoa(sin.sin_addr)); - errno = oerrno; - perror(0); - hp->h_addr_list++; - bcopy(hp->h_addr_list[0], &sin.sin_addr, MIN(hp->h_length, sizeof sin.sin_addr)); - (void)fprintf(stderr, "Trying %s...\n", - inet_ntoa(sin.sin_addr)); - continue; - } - (void)fprintf(stderr, "%s: %s\n", hp->h_name, strerror(errno)); -#ifndef __rtems__ - sigsetmask(oldmask); -#endif - return (-1); - } - lport--; - if (fd2p == 0) { - write(s, "", 1); - lport = 0; - } else { - char num[8]; - int s2 = rresvport(&lport), s3; - int len = sizeof(from); - int nfds; - - if (s2 < 0) - goto bad; - listen(s2, 1); - (void)snprintf(num, sizeof(num), "%d", lport); - if (write(s, num, strlen(num)+1) != strlen(num)+1) { - (void)fprintf(stderr, - "rcmd: write (setting up stderr): %s\n", - strerror(errno)); - (void)close(s2); - goto bad; - } - nfds = max(s, s2)+1; - if(nfds > FD_SETSIZE) { - fprintf(stderr, "rcmd: too many files\n"); - (void)close(s2); - goto bad; - } -again: - FD_ZERO(&reads); - FD_SET(s, &reads); - FD_SET(s2, &reads); - errno = 0; - if (select(nfds, &reads, 0, 0, 0) < 1 || !FD_ISSET(s2, &reads)){ - if (errno != 0) - (void)fprintf(stderr, - "rcmd: select (setting up stderr): %s\n", - strerror(errno)); - else - (void)fprintf(stderr, - "select: protocol failure in circuit setup\n"); - (void)close(s2); - goto bad; - } - s3 = accept(s2, (struct sockaddr *)&from, &len); - /* - * XXX careful for ftp bounce attacks. If discovered, shut them - * down and check for the real auxiliary channel to connect. - */ - if (from.sin_family == AF_INET && from.sin_port == htons(20)) { - close(s3); - goto again; - } - (void)close(s2); - if (s3 < 0) { - (void)fprintf(stderr, - "rcmd: accept: %s\n", strerror(errno)); - lport = 0; - goto bad; - } - *fd2p = s3; - from.sin_port = ntohs((u_short)from.sin_port); - if (from.sin_family != AF_INET || - from.sin_port >= IPPORT_RESERVED || - from.sin_port < IPPORT_RESERVED / 2) { - (void)fprintf(stderr, - "socket: protocol failure in circuit setup.\n"); - goto bad2; - } - } - (void)write(s, locuser, strlen(locuser)+1); - (void)write(s, remuser, strlen(remuser)+1); - (void)write(s, cmd, strlen(cmd)+1); - if (read(s, &c, 1) != 1) { - (void)fprintf(stderr, - "rcmd: %s: %s\n", *ahost, strerror(errno)); - goto bad2; - } - if (c != 0) { - while (read(s, &c, 1) == 1) { - (void)write(STDERR_FILENO, &c, 1); - if (c == '\n') - break; - } - goto bad2; - } -#ifndef __rtems__ - sigsetmask(oldmask); -#endif - return (s); -bad2: - if (lport) - (void)close(*fd2p); -bad: - (void)close(s); -#ifndef __rtems__ - sigsetmask(oldmask); -#endif - return (-1); -} - -int -rresvport(alport) - int *alport; -{ - struct sockaddr_in sin; - int s; - - bzero(&sin, sizeof sin); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = INADDR_ANY; - s = socket(AF_INET, SOCK_STREAM, 0); - if (s < 0) - return (-1); -#if 0 /* compat_exact_traditional_rresvport_semantics */ - sin.sin_port = htons((u_short)*alport); - if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0) - return (s); - if (errno != EADDRINUSE) { - (void)close(s); - return (-1); - } -#endif - sin.sin_port = 0; - if (bindresvport(s, &sin) == -1) { - (void)close(s); - return (-1); - } - *alport = (int)ntohs(sin.sin_port); - return (s); -} - -#ifndef __rtems__ -int __check_rhosts_file = 1; -char *__rcmd_errstr; - -int -ruserok(rhost, superuser, ruser, luser) - const char *rhost, *ruser, *luser; - int superuser; -{ - struct hostent *hp; - u_long addr; - char **ap; - - if ((hp = gethostbyname(rhost)) == NULL) - return (-1); - for (ap = hp->h_addr_list; *ap; ++ap) { - bcopy(*ap, &addr, sizeof(addr)); - if (iruserok(addr, superuser, ruser, luser) == 0) - return (0); - } - return (-1); -} - -/* - * New .rhosts strategy: We are passed an ip address. We spin through - * hosts.equiv and .rhosts looking for a match. When the .rhosts only - * has ip addresses, we don't have to trust a nameserver. When it - * contains hostnames, we spin through the list of addresses the nameserver - * gives us and look for a match. - * - * Returns 0 if ok, -1 if not ok. - */ -int -iruserok(raddr, superuser, ruser, luser) - u_long raddr; - int superuser; - const char *ruser, *luser; -{ - register char *cp; - struct stat sbuf; - struct passwd *pwd; - FILE *hostf; - uid_t uid; - int first; - char pbuf[MAXPATHLEN]; - - first = 1; - hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "r"); -again: - if (hostf) { - if (__ivaliduser(hostf, raddr, luser, ruser) == 0) { - (void)fclose(hostf); - return (0); - } - (void)fclose(hostf); - } - if (first == 1 && (__check_rhosts_file || superuser)) { - first = 0; - if ((pwd = getpwnam(luser)) == NULL) - return (-1); - (void)strcpy(pbuf, pwd->pw_dir); - (void)strcat(pbuf, "/.rhosts"); - - /* - * Change effective uid while opening .rhosts. If root and - * reading an NFS mounted file system, can't read files that - * are protected read/write owner only. - */ - uid = geteuid(); - (void)seteuid(pwd->pw_uid); - hostf = fopen(pbuf, "r"); - (void)seteuid(uid); - - if (hostf == NULL) - return (-1); - /* - * If not a regular file, or is owned by someone other than - * user or root or if writeable by anyone but the owner, quit. - */ - cp = NULL; - if (lstat(pbuf, &sbuf) < 0) - cp = ".rhosts lstat failed"; - else if (!S_ISREG(sbuf.st_mode)) - cp = ".rhosts not regular file"; - else if (fstat(fileno(hostf), &sbuf) < 0) - cp = ".rhosts fstat failed"; - else if (sbuf.st_uid && sbuf.st_uid != pwd->pw_uid) - cp = "bad .rhosts owner"; - else if (sbuf.st_mode & (S_IWGRP|S_IWOTH)) - cp = ".rhosts writeable by other than owner"; - /* If there were any problems, quit. */ - if (cp) { - __rcmd_errstr = cp; - (void)fclose(hostf); - return (-1); - } - goto again; - } - return (-1); -} - -/* - * XXX - * Don't make static, used by lpd(8). - * - * Returns 0 if ok, -1 if not ok. - */ -int -__ivaliduser(hostf, raddr, luser, ruser) - FILE *hostf; - u_long raddr; - const char *luser, *ruser; -{ - register char *user, *p; - int ch; - char buf[MAXHOSTNAMELEN + 128]; /* host + login */ - char hname[MAXHOSTNAMELEN]; - struct hostent *hp; - /* Presumed guilty until proven innocent. */ - int userok = 0, hostok = 0; -#ifdef YP - char *ypdomain; - - if (yp_get_default_domain(&ypdomain)) - ypdomain = NULL; -#else -#define ypdomain NULL -#endif - /* We need to get the damn hostname back for netgroup matching. */ - if ((hp = gethostbyaddr((char *)&raddr, sizeof(u_long), - AF_INET)) == NULL) - return (-1); - strncpy(hname, hp->h_name, sizeof(hname)); - hname[sizeof(hname) - 1] = '\0'; - - while (fgets(buf, sizeof(buf), hostf)) { - p = buf; - /* Skip lines that are too long. */ - if (strchr(p, '\n') == NULL) { - while ((ch = getc(hostf)) != '\n' && ch != EOF); - continue; - } - if (*p == '\n' || *p == '#') { - /* comment... */ - continue; - } - while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') { - *p = isupper(*p) ? tolower(*p) : *p; - p++; - } - if (*p == ' ' || *p == '\t') { - *p++ = '\0'; - while (*p == ' ' || *p == '\t') - p++; - user = p; - while (*p != '\n' && *p != ' ' && - *p != '\t' && *p != '\0') - p++; - } else - user = p; - *p = '\0'; - /* - * Do +/- and +@/-@ checking. This looks really nasty, - * but it matches SunOS's behavior so far as I can tell. - */ - switch(buf[0]) { - case '+': - if (!buf[1]) { /* '+' matches all hosts */ - hostok = 1; - break; - } - if (buf[1] == '@') /* match a host by netgroup */ - hostok = innetgr((char *)&buf[2], - (char *)&hname, NULL, ypdomain); - else /* match a host by addr */ - hostok = __icheckhost(raddr,(char *)&buf[1]); - break; - case '-': /* reject '-' hosts and all their users */ - if (buf[1] == '@') { - if (innetgr((char *)&buf[2], - (char *)&hname, NULL, ypdomain)) - return(-1); - } else { - if (__icheckhost(raddr,(char *)&buf[1])) - return(-1); - } - break; - default: /* if no '+' or '-', do a simple match */ - hostok = __icheckhost(raddr, buf); - break; - } - switch(*user) { - case '+': - if (!*(user+1)) { /* '+' matches all users */ - userok = 1; - break; - } - if (*(user+1) == '@') /* match a user by netgroup */ - userok = innetgr(user+2, NULL, ruser, ypdomain); - else /* match a user by direct specification */ - userok = !(strcmp(ruser, user+1)); - break; - case '-': /* if we matched a hostname, */ - if (hostok) { /* check for user field rejections */ - if (!*(user+1)) - return(-1); - if (*(user+1) == '@') { - if (innetgr(user+2, NULL, - ruser, ypdomain)) - return(-1); - } else { - if (!strcmp(ruser, user+1)) - return(-1); - } - } - break; - default: /* no rejections: try to match the user */ - if (hostok) - userok = !(strcmp(ruser,*user ? user : luser)); - break; - } - if (hostok && userok) - return(0); - } - return (-1); -} - -/* - * Returns "true" if match, 0 if no match. - */ -static int -__icheckhost(raddr, lhost) - u_long raddr; - register char *lhost; -{ - register struct hostent *hp; - register u_long laddr; - register char **pp; - - /* Try for raw ip address first. */ - if (isdigit(*lhost) && (long)(laddr = inet_addr(lhost)) != -1) - return (raddr == laddr); - - /* Better be a hostname. */ - if ((hp = gethostbyname(lhost)) == NULL) - return (0); - - /* Spin through ip addresses. */ - for (pp = hp->h_addr_list; *pp; ++pp) - if (!bcmp(&raddr, *pp, sizeof(u_long))) - return (1); - - /* No match. */ - return (0); -} -#endif diff --git a/c/src/exec/libnetworking/libc/recv.c b/c/src/exec/libnetworking/libc/recv.c deleted file mode 100644 index a842244caf..0000000000 --- a/c/src/exec/libnetworking/libc/recv.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * 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[] = "@(#)recv.c 8.2 (Berkeley) 2/21/94"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -#include - -ssize_t -recv(s, buf, len, flags) - int s, flags; - size_t len; - void *buf; -{ - return (recvfrom(s, buf, len, flags, NULL, 0)); -} diff --git a/c/src/exec/libnetworking/libc/res_comp.c b/c/src/exec/libnetworking/libc/res_comp.c deleted file mode 100644 index 93043276f2..0000000000 --- a/c/src/exec/libnetworking/libc/res_comp.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) 1985, 1993 - * 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. - */ - -/* - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* - * Portions Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; -static char orig_rcsid[] = "From: Id: res_comp.c,v 8.11 1997/05/21 19:31:04 halley Exp $"; -static char rcsid[] = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BIND_4_COMPAT - -/* - * Expand compressed domain name 'comp_dn' to full domain name. - * 'msg' is a pointer to the begining of the message, - * 'eomorig' points to the first location after the message, - * 'exp_dn' is a pointer to a buffer of size 'length' for the result. - * Return size of compressed name or -1 if there was an error. - */ -int -dn_expand(const u_char *msg, const u_char *eom, const u_char *src, - char *dst, int dstsiz) -{ - int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz); - - if (n > 0 && dst[0] == '.') - dst[0] = '\0'; - return (n); -} - -/* - * Pack domain name 'exp_dn' in presentation form into 'comp_dn'. - * Return the size of the compressed name or -1. - * 'length' is the size of the array pointed to by 'comp_dn'. - */ -int -dn_comp(const char *src, u_char *dst, int dstsiz, - u_char **dnptrs, u_char **lastdnptr) -{ - return (ns_name_compress(src, dst, (size_t)dstsiz, - (const u_char **)dnptrs, - (const u_char **)lastdnptr)); -} - -/* - * Skip over a compressed domain name. Return the size or -1. - */ -int -dn_skipname(const u_char *ptr, const u_char *eom) { - const u_char *saveptr = ptr; - - if (ns_name_skip(&ptr, eom) == -1) - return (-1); - return (ptr - saveptr); -} - -/* - * Verify that a domain name uses an acceptable character set. - */ - -/* - * Note the conspicuous absence of ctype macros in these definitions. On - * non-ASCII hosts, we can't depend on string literals or ctype macros to - * tell us anything about network-format data. The rest of the BIND system - * is not careful about this, but for some reason, we're doing it right here. - */ -#define PERIOD 0x2e -#define hyphenchar(c) ((c) == 0x2d) -#define bslashchar(c) ((c) == 0x5c) -#define periodchar(c) ((c) == PERIOD) -#define asterchar(c) ((c) == 0x2a) -#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \ - || ((c) >= 0x61 && (c) <= 0x7a)) -#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39) - -#define borderchar(c) (alphachar(c) || digitchar(c)) -#define middlechar(c) (borderchar(c) || hyphenchar(c)) -#define domainchar(c) ((c) > 0x20 && (c) < 0x7f) - -int -res_hnok(dn) - const char *dn; -{ - int ppch = '\0', pch = PERIOD, ch = *dn++; - - while (ch != '\0') { - int nch = *dn++; - - if (periodchar(ch)) { - (void)NULL; - } else if (periodchar(pch)) { - if (!borderchar(ch)) - return (0); - } else if (periodchar(nch) || nch == '\0') { - if (!borderchar(ch)) - return (0); - } else { - if (!middlechar(ch)) - return (0); - } - ppch = pch, pch = ch, ch = nch; - } - return (1); -} - -/* - * hostname-like (A, MX, WKS) owners can have "*" as their first label - * but must otherwise be as a host name. - */ -int -res_ownok(dn) - const char *dn; -{ - if (asterchar(dn[0])) { - if (periodchar(dn[1])) - return (res_hnok(dn+2)); - if (dn[1] == '\0') - return (1); - } - return (res_hnok(dn)); -} - -/* - * SOA RNAMEs and RP RNAMEs can have any printable character in their first - * label, but the rest of the name has to look like a host name. - */ -int -res_mailok(dn) - const char *dn; -{ - int ch, escaped = 0; - - /* "." is a valid missing representation */ - if (*dn == '\0') - return (1); - - /* otherwise