Browse Source

Rebooting 93u+m

This commit reboots ksh 93u+m development with a new fork based off
the archived official AT&T ast repo, master branch.

README:
- Removed. Having two READMEs is a botch.

README.md:
- Imported and edited from the archived fork,
  https://github.com/modernish/ksh -- the newer instructions will
  become applicable as I cherry-pick all the changes from there :)
    - Copy-edits.
    - Added policy and rationale for this 93u+m fork.
    - Incorporated info from old README that is still relevant.

.gitignore:
- Added.

bin/execrate:
- Removed. This one keeps changing its license header, causing git
  to show an uncommitted file. It's always re-copied anyway, and
  not for direct invocation, so, exclude and add to .gitignore.
  The source file is: src/cmd/INIT/execrate.sh

src/cmd/*,
src/lib/*:
- Remove historical baggage: everything except ksh93 and
  dependencies. This is the same stuff the ksh-community fork
  removed. I wouldn't mind keeping it, but some of this stuff
  causes build failures on macOS (and probably other systems), and
  I need to get on with fixing ksh93.
     Hopefully, we can figure out how to re-add stuff we can use
  later -- particularly the pty command (pseudo-terminal utility
  for scripting interactive sessions) which is needed for
  regression-testing the interactive shell.
Martijn Dekker 4 years ago
parent
commit
2940b3f536
100 changed files with 93 additions and 18745 deletions
  1. 25 0
      .gitignore
  2. 0 29
      README
  3. 67 25
      README.md
  4. 0 180
      bin/execrate
  5. 1 1
      bin/package
  6. 0 609
      src/cmd/3d/3d.h
  7. 0 376
      src/cmd/3d/3d.sh
  8. 0 350
      src/cmd/3d/3d.tst
  9. 0 110
      src/cmd/3d/Makefile
  10. 0 1326
      src/cmd/3d/Mamfile
  11. 0 106
      src/cmd/3d/PROMO.mm
  12. 0 25
      src/cmd/3d/README
  13. 0 152
      src/cmd/3d/RELEASE
  14. 0 40
      src/cmd/3d/_2d
  15. 0 104
      src/cmd/3d/access3d.c
  16. 0 62
      src/cmd/3d/acl3d.c
  17. 0 121
      src/cmd/3d/ast.c
  18. 0 61
      src/cmd/3d/ast_3d.h
  19. 0 391
      src/cmd/3d/bio.c
  20. 0 50
      src/cmd/3d/brk3d.c
  21. 0 82
      src/cmd/3d/chdir3d.c
  22. 0 70
      src/cmd/3d/chmod3d.c
  23. 0 61
      src/cmd/3d/chown3d.c
  24. 0 82
      src/cmd/3d/close3d.c
  25. 0 110
      src/cmd/3d/copy.c
  26. 0 30
      src/cmd/3d/creat3d.c
  27. 0 75
      src/cmd/3d/cs.c
  28. 0 97
      src/cmd/3d/cs_3d.h
  29. 0 528
      src/cmd/3d/dir3d.c
  30. 0 224
      src/cmd/3d/dir_3d.h
  31. 0 46
      src/cmd/3d/dll3d.c
  32. 0 36
      src/cmd/3d/dll_3d.h
  33. 0 45
      src/cmd/3d/dup23d.c
  34. 0 91
      src/cmd/3d/dup3d.c
  35. 0 248
      src/cmd/3d/error.c
  36. 0 30
      src/cmd/3d/execv.c
  37. 0 150
      src/cmd/3d/execve3d.c
  38. 0 42
      src/cmd/3d/exit3d.c
  39. 0 58
      src/cmd/3d/facl3d.c
  40. 0 45
      src/cmd/3d/fchdir3d.c
  41. 0 54
      src/cmd/3d/fchmod3d.c
  42. 0 54
      src/cmd/3d/fchown3d.c
  43. 0 73
      src/cmd/3d/fcntl3d.c
  44. 0 68
      src/cmd/3d/features/peek.c
  45. 0 1207
      src/cmd/3d/features/syscall.sh
  46. 0 51
      src/cmd/3d/features/syslib
  47. 0 135
      src/cmd/3d/fork3d.c
  48. 0 61
      src/cmd/3d/fpathconf3d.c
  49. 0 670
      src/cmd/3d/fs.c
  50. 0 134
      src/cmd/3d/fstat3d.c
  51. 0 176
      src/cmd/3d/fstatfs3d.c
  52. 0 56
      src/cmd/3d/fstatvfs3d.c
  53. 0 54
      src/cmd/3d/fsync3d.c
  54. 0 104
      src/cmd/3d/ftruncate3d.c
  55. 0 90
      src/cmd/3d/getdents3d.c
  56. 0 1714
      src/cmd/3d/init.c
  57. 0 49
      src/cmd/3d/kill3d.c
  58. 0 515
      src/cmd/3d/lib.c
  59. 0 90
      src/cmd/3d/lib_3d.h
  60. 0 95
      src/cmd/3d/license.c
  61. 0 99
      src/cmd/3d/link3d.c
  62. 0 134
      src/cmd/3d/lseek3d.c
  63. 0 128
      src/cmd/3d/lstat3d.c
  64. 0 670
      src/cmd/3d/map.c
  65. 0 179
      src/cmd/3d/mkdir3d.c
  66. 0 72
      src/cmd/3d/mknod3d.c
  67. 0 147
      src/cmd/3d/mount3d.c
  68. 0 96
      src/cmd/3d/opaque.sh
  69. 0 358
      src/cmd/3d/open3d.c
  70. 0 156
      src/cmd/3d/pathcanon.c
  71. 0 64
      src/cmd/3d/pathconf3d.c
  72. 0 203
      src/cmd/3d/pathnext.c
  73. 0 654
      src/cmd/3d/pathreal.c
  74. 0 49
      src/cmd/3d/peek.c
  75. 0 67
      src/cmd/3d/pipe3d.c
  76. 0 73
      src/cmd/3d/read3d.c
  77. 0 68
      src/cmd/3d/readlink3d.c
  78. 0 85
      src/cmd/3d/rename3d.c
  79. 0 133
      src/cmd/3d/rmdir3d.c
  80. 0 50
      src/cmd/3d/sbrk3d.c
  81. 0 138
      src/cmd/3d/stat3d.c
  82. 0 182
      src/cmd/3d/statfs3d.c
  83. 0 57
      src/cmd/3d/statvfs3d.c
  84. 0 34
      src/cmd/3d/std_3d.h
  85. 0 810
      src/cmd/3d/strmatch.c
  86. 0 89
      src/cmd/3d/symlink3d.c
  87. 0 88
      src/cmd/3d/sys.tab
  88. 0 716
      src/cmd/3d/syscall3d.c
  89. 0 47
      src/cmd/3d/sysent3d.c
  90. 0 194
      src/cmd/3d/touch.c
  91. 0 113
      src/cmd/3d/truncate3d.c
  92. 0 77
      src/cmd/3d/unlink3d.c
  93. 0 93
      src/cmd/3d/utime3d.c
  94. 0 77
      src/cmd/3d/utimensat3d.c
  95. 0 67
      src/cmd/3d/utimes3d.c
  96. 0 75
      src/cmd/3d/utimets3d.c
  97. 0 501
      src/cmd/3d/vcs.c
  98. 0 78
      src/cmd/3d/vcs_3d.h
  99. 0 54
      src/cmd/3d/vex.sh
  100. 0 52
      src/cmd/3d/vfork3d.c

+ 25 - 0
.gitignore

@@ -0,0 +1,25 @@
+# Project-specific files
+=
+arch
+tgz
+lcl
+
+# This one keeps changing its license header, causing git to show an
+# uncommitted file. It's always re-copied anyway, and not for direct
+# invocation, so exclude. The source file is: src/cmd/INIT/execrate.sh
+bin/execrate
+
+# Miscellaneous artefacts
+*.bak
+*.sav
+*.old
+*.orig
+.*.swp
+*.DS_Store
+*~
+.nfs*
+*.tmp
+*.rej
+*.project
+*.core
+core

+ 0 - 29
README

@@ -1,29 +0,0 @@
-This is a package root directory $PACKAGEROOT. Source and binary
-packages in this directory tree are controlled by the command
-
-	bin/package
-
-Binary files may be in this directory or in the install root directory
-
-	INSTALLROOT=$PACKAGEROOT/arch/`bin/package`
-
-For more information run
-
-	bin/package help
-
-Many of the packaged commands self-document via the --man and --html
-options; those that do have no separate man page.
-
-Each package is covered by one of the license files
-
-	lib/package/LICENSES/<license>
-
-where <license> is the license type for the package.  At the top
-of each license file is a URL; the license covers all software that
-refers to this URL. For details run
-
-	bin/package license [<package>]
-
-Any archives, distributions or packages made from source or
-binaries covered by license(s) must contain the corresponding
-license file(s).

+ 67 - 25
README.md

@@ -1,36 +1,78 @@
-# AST
+# KornShell 93u+m
 
-This is the AT&amp;T Software Technology (AST) toolkit from AT&amp;T Research.
-It includes many tools and libraries, like KSH, NMAKE, SFIO, VMALLOC, VCODEX,
-etc. It also includes more efficient replacements for a lot of the POSIX tools.
-It was designed to be portable across many UNIX systems and also works
-under UWIN on Microsoft Windows (see UWIN repo on GitHub under att/uwin).
+This repository is used to develop bugfixes
+to the last stable release (93u+ 2012-08-01) of
+[ksh93](http://www.kornshell.com/),
+formerly developed by AT&T Software Technology (AST).
+The sources in this repository were forked from the
+Github [AST repository](https://github.com/att/ast)
+which is no longer under active development.
 
-## ksh93u+ and v-
+To see what's fixed, see [NEWS](https://github.com/modernish/ast/blame/master/NEWS)
+and click on commit messages for full details.
 
-This repo contains the **ksh93u+** and **ksh93v-** versions of KSH.
+To see what's left to fix, see [TODO](./TODO).
 
-* **ksh93u+**, the master branch, was the last version released by the main AST
-  authors in 2012, while they were at AT&amp;T. It also has some later build
-  fixes but it is not actively maintained.
-* ksh93v-, [ksh93v tag](https://github.com/att/ast/tree/ksh93v), contains
-  contributions from the main authors through 2014 (after they left) and is
-  considered less stable
+## Policy
 
-Please search the web for forks of this repo (or check the
-[Network graph](https://github.com/att/ast/network) on GitHub) if you are
-looking for an actively maintained version of ksh.
+1. No new features. Bug fixes only.
+2. No major rewrites. No refactoring code that is not fully understood.
+3. No changes in documented behaviour, except if required for compliance with the
+   [POSIX shell language standard](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html)
+   which David Korn [intended](http://www.kornshell.com/info/) for ksh to follow.
+4. No 100% bug compatibility. Broken and undocumented behaviour gets fixed.
+5. No bureaucracy, no formalities. Just fix it, or report it: create issues,
+   send pull requests. Every interested party is invited to contribute.
+6. To help increase everyone's understanding of this code base, fixes and
+   significant changes should be fully documented in commit messages.
 
-## Build
+## Why?
+
+Between 2017 and 2020 there was an ultimately unsuccessful
+[attempt](https://github.com/att/ast/tree/2020.0.1)
+to breathe new life into the KornShell by extensively refactoring the last
+unstable AST beta version (93v-).
+While that ksh2020 branch is now abandoned and still has many critical bugs,
+it also had a lot of bugs fixed. More importantly, the AST issue tracker
+now contains a lot of documentation on how to fix those bugs, which makes
+it possible to backport many of them to the last stable release instead.
+
+In February 2020, having concluded the AST 93v- beta was too broken to
+base new work on, others decided to start a new fork based on the last stable
+93u+ 2012-08-01 release. Unfortunately, as of June 2020, the new
+[ksh-community](https://github.com/ksh-community/ksh/)
+organisation is yet to see any significant activity four months after its
+bootstrapping. I hope that will change; I am ready to join efforts with them
+at any time, as well as anyone else who wants to contribute.
 
-This software is used to build itself, using NMAKE.  After cloning this repo, cd
-to the top directory of it and run:
+The last stable ksh93 release from 2012 is the least buggy release currently
+available, but it still has many serious bugs. So it is well past time to
+start fixing those bugs, leave the rest of the code alone, and get an
+improved release out there.
+
+## Build
 
+After cloning this repo, cd to the top directory of it and run:
+```sh
 ./bin/package make
+```
+If you have trouble or want to tune the binaries, you may pass additional
+compiler and linker flags by appending it to the command shown above. E.g.:
+```sh
+./bin/package make \
+    SHELL=/bin/bash CCFLAGS="-xc99 -D_XPG6 -m64 -xO4" LDFLAGS="-m64"
+```
+For more information run
+```sh
+        bin/package help
+```
+Many other commands in this repo self-document via the `--help`, `--man` and
+`--html` options; those that do have no separate manual page.
 
-Almost all the tools in this package (including the bin/package script are
-self-documenting; run <tool> --man (or --html) for the man page for the tool.
+## Test
 
-(If you were used to the old AST packaging mechanism, on www.research.att.com,
-this repo is equivalent to downloading the INIT and ast-open packages and
-running: ./bin/package read on them).
+After compiling, you can run the regression tests.
+Start by reading the information printed by:
+```sh
+./bin/shtests --man
+```

+ 0 - 180
bin/execrate

@@ -1,180 +0,0 @@
-USAGE_LICENSE="[-author?Glenn Fowler <gsf@research.att.com>][-copyright?Copyright (c) 2002-2020 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html]"
-########################################################################
-#                                                                      #
-#               This software is part of the ast package               #
-#          Copyright (c) 1994-2011 AT&T Intellectual Property          #
-#                      and is licensed under the                       #
-#                 Eclipse Public License, Version 1.0                  #
-#                    by AT&T Intellectual Property                     #
-#                                                                      #
-#                A copy of the License is available at                 #
-#          http://www.eclipse.org/org/documents/epl-v10.html           #
-#         (with md5 checksum b35adb5213ca9657e911e9befb180842)         #
-#                                                                      #
-#              Information and Software Systems Research               #
-#                            AT&T Research                             #
-#                           Florham Park NJ                            #
-#                                                                      #
-#                 Glenn Fowler <gsf@research.att.com>                  #
-#                                                                      #
-########################################################################
-: wrapper for .exe challenged win32 systems/commands
-
-command=execrate
-
-bins='/bin /usr/bin /usr/sbin'
-
-case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
-0123)	ARGV0="-a $command"
-	USAGE=$'
-[-?
-@(#)$Id: execrate (AT&T Labs Research) 2002-02-02 $
-]
-'$USAGE_LICENSE$'
-[+NAME?execrate - wrapper for .exe challenged commands]
-[+DESCRIPTION?\bexecrate\b runs \acommand\a after checking the \afile\a
-	operands for standard semantics with respect to \bwin32\b \b.exe\b
-	suffix conventions. This command is only needed on \bwin32\b
-	systems that inconsistently handle \b.exe\b across library and
-	command interfaces. \acommand\a may be one of \bcat\b(1), \bchmod\b(1),
-	\bcmp\b(1), \bcp\b(1), \bln\b(1), \bmv\b(1), or \brm\b(1).
-	Only the 2 argument forms of \bcp\b, \bln\b and \bmv\b are handled.
-	Unsupported commands and commands requiring no change are
-	silently executed.]
-[+?With no arguments \bexecrate\b exits with status 0 if the current system
-	is \b.exe\b challenged, 1 if the current system is normal.]
-[n:show?Show the underlying commands but do not execute.]
-
-command [ option ... ] file ...
-
-[+SEE ALSO?\bwebster\b(1)]
-'
-	usage()
-	{
-		OPTIND=0
-		getopts $ARGV0 "$USAGE" OPT '-?'
-		exit 2
-	}
-	exec=1
-	while	getopts $ARGV0 "$USAGE" OPT
-	do	case $OPT in
-		n)	exec=0 ;;
-		*)	usage ;;
-		esac
-	done
-	shift `expr $OPTIND - 1`
-	;;
-*)	usage()
-	{
-		echo "Usage: execrate [ -n ] [ command [ option ... ] file ... ]" >&2
-		exit 2
-	}
-	exec=1
-	while	:
-	do	case $1 in
-		-n)	exec=0 ;;
-		-*)	usage ;;
-		*)	break ;;
-		esac
-		shift
-	done
-	;;
-esac
-case $# in
-0)	if	test ! -x /bin/cat.exe
-	then	exit 1 # normal
-	fi
-	if	/bin/cat /bin/cat >/dev/null 2>&1
-	then	exit 1 # normal
-	fi
-	exit 0 # challenged
-	;;
-1)	usage
-	;;
-esac
-case $1 in
-*cat|*rm)
-	NUM=0
-	;;
-*chgrp|*chmod)
-	NUM=1
-	;;
-*cmp|*cp|*ln|*mv)
-	NUM=2
-	;;
-*)	case $exec in
-	0)	echo "$@" ;;
-	*)	"$@" ;;
-	esac
-	exit
-	;;
-esac
-CMD=$1
-shift
-case $CMD in
-*/*)	;;
-*)	for d in $bins
-	do	if	test -x $d/$1 -o -x $d/$1.exe
-		then	CMD=$d/$1
-			break
-		fi
-	done
-	;;
-esac
-while	:
-do	case $1 in
-	-*)	CMD="$CMD $1" ;;
-	*)	break ;;
-	esac
-	shift
-done
-case $exec in
-0)	CMD="echo $CMD" ;;
-esac
-case $NUM:$# in
-*:0)	;;
-1:*)	CMD="$CMD $1"
-	NUM=0
-	shift
-	;;
-esac
-case $NUM:$# in
-0:*)	status=0
-	for f
-	do	if	test "$f" -ef "$f".exe
-		then	f=$f.exe
-		fi
-		$CMD "$f"
-		case $? in
-		0)	;;
-		*)	status=$? ;;
-		esac
-	done
-	exit $status
-	;;
-2:2)	f=$1
-	case $f in
-	*.exe)	;;
-	*)	if	test "$f" -ef "$f".exe
-		then	f=$f.exe
-		fi
-		;;
-	esac
-	case $f in
-	*.exe)	if	test -d "$2"
-		then	t=$2/$f
-		else	t=$2
-		fi
-		case $t in
-		*/*)	b=`basename "$t"` ;;
-		*)	b=$t ;;
-		esac
-		case $b in
-		*.*)	$CMD "$f" "$t"; exit ;;
-		*)	$CMD "$f" "$t".exe; exit ;;
-		esac
-		;;
-	esac
-	;;
-esac
-$CMD "$@"

+ 1 - 1
bin/package

@@ -1,4 +1,4 @@
-USAGE_LICENSE="[-author?Glenn Fowler <gsf@research.att.com>][-copyright?Copyright (c) 1994-2020 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html]"
+USAGE_LICENSE="[-author?Glenn Fowler <gsf@research.att.com>][-copyright?Copyright (c) 1994-2012 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html]"
 ########################################################################
 #                                                                      #
 #               This software is part of the ast package               #

+ 0 - 609
src/cmd/3d/3d.h

@@ -1,609 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * Glenn Fowler
- * David Korn
- * Eduardo Krell
- *
- * AT&T Research
- *
- * 3d file system implementation interface
- */
-
-#ifndef _3D_H
-#define _3D_H
-
-#undef	_BLD_DEBUG
-
-#define _def_map_ast	1
-#define _std_strtol	1
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide fchown ftruncate mount readlink sbrk strmode truncate utimes __utimes
-#else
-#undef	fchown
-#define fchown		______fchown
-#undef	ftruncate
-#define ftruncate	______ftruncate
-#undef	mount
-#define mount		______mount
-#undef	readlink
-#define readlink	______readlink
-#undef	sbrk
-#define sbrk		______sbrk
-#undef	strmode
-#define strmode		______strmode
-#undef	truncate
-#define truncate	______truncate
-#undef	utimes
-#define utimes		______utimes
-#undef	__utimes
-#define __utimes	________utimes
-#endif
-
-#if defined(__STDPP__directive) && defined(__STDPP__note)
-__STDPP__directive pragma pp:note off64_t
-#endif
-
-#include <ast_std.h>
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide strmode
-#else
-#undef	strmode
-#endif
-
-#include "lib_3d.h"
-
-#include <ls.h>
-#include <sig.h>
-#include <times.h>
-#include <error.h>
-#include <debug.h>
-#include <hashkey.h>
-#include <dlldefs.h>
-
-#if _lib_strerror && defined(strerror)
-#undef	strerror
-extern char*		strerror();
-#endif
-
-#undef	mount
-#define mount		______mount
-#include <fs3d.h>
-#undef	mount
-
-#include "msg.h"
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide fchown ftruncate mount readlink sbrk strmode truncate utimes __utimes
-#else
-#undef	fchown
-#undef	ftruncate
-#undef	mount
-#undef	readlink
-#undef	sbrk
-#undef	strmode
-#undef	truncate
-#undef	utimes
-#undef	__utimes
-#endif
-
-#if FS && defined(MIX)
-#define LICENSED	1
-#endif
-
-#if defined(__STDPP__directive) && defined(__STDPP__note)
-#if !_typ_off64_t && !noticed(off64_t)
-#undef	off64_t
-#if _typ_int64_t
-#define off64_t		int64_t
-#else
-#define off64_t		long
-#endif
-#endif
-#endif
-
-struct stat64;
-
-#undef	fcntl
-#undef	open
-#undef	stat
-#undef	strtol
-#undef	strtoul
-#undef	strtoll
-#undef	strtoull
-
-#define MSG_read3d	(MSG_read|MSG_EXT(MSG_ARG_number,4))
-#define MSG_write3d	(MSG_write|MSG_EXT(MSG_ARG_number,4))
-
-struct Fs;
-
-typedef long (*Sysfunc_t)();
-
-typedef int (*Fs_get_t)(struct Fs*, char*, const char*, int);
-
-typedef int (*Fs_set_t)(struct Fs*, const char*, int, const char*, int);
-
-#define _3D_LINK_MAX	999		/* for nice ls -l */
-
-#ifndef _3D_LINK_MAX
-#ifdef LINK_MAX
-#define _3D_LINK_MAX	LINK_MAX
-#else
-#define _3D_LINK_MAX	30000
-#endif
-#endif
-
-#define ATTR_MAX	121
-
-#include "FEATURE/peek"
-#include "FEATURE/syscall"
-#include "FEATURE/syslib"
-
-typedef struct Fs
-{
-	long		flags;
-	short		fd;
-	short		retry;
-	short		specialsize;
-	Fs_get_t	get;
-	Fs_set_t	set;
-	unsigned long	key;
-	unsigned long	ack;
-	unsigned long	call;
-	unsigned long	terse;
-	char		special[10];
-	char		attr[ATTR_MAX];
-	struct stat	st;
-	char*		match;
-	char*		service;
-	short		matchsize;
-	short		servicesize;
-} Fs_t;
-
-#if FS
-
-typedef struct Mount
-{
-	long		channel;
-	Fs_t*		fs;
-	struct Mount*	global;
-	char*		logical;
-	char*		physical;
-	char		attr[ATTR_MAX];
-	short		logicalsize;
-	short		physicalsize;
-	short		flags;
-} Mount_t;
-
-typedef struct
-{
-	dev_t		dev;
-	ino_t		ino;
-	char		path[1];
-} Dir_t;
-
-#endif
-
-typedef struct
-{
-#if FS
-	Mount_t*	mount;
-	Dir_t*		dir;
-#endif
-	short*		reserved;
-	Msg_file_t	id;
-	unsigned long	open;
-	unsigned char	flags;
-	unsigned char	oflag;
-} File_t;
-
-#if VCS
-#include "vcs_3d.h"
-#endif
-
-#define NOSYS		nosys
-
-#define TABLE_FD	(OPEN_MAX>22?22:(OPEN_MAX-1))	/* 0 for env	*/
-#define TABLE_MAX	(1<<(TABBITS+7))/* max 3d table image size	*/
-#define TABLE_PREFIX	"vpath "	/* for external consistency	*/
-#define TABLE_VERSION	1		/* to verify TABLE_FD		*/
-
-#define TABBITS		5	/* max vpath,vmap table index bits (<6)	*/
-#define TABSIZE		(1<<TABBITS)			/* v* tab size	*/
-#define	VERMODE		(S_IRWXU|S_IRWXG|S_IRWXO)	/* ver dir mode	*/
-#define INSTANCE	TABSIZE				/* under ver	*/
-
-#define INTERCEPT_MAX	8		/* max # call intercept layers	*/
-
-#define LICENSE_ALL	'+'		/* everything licensed		*/
-#define LICENSE_NONE	'-'		/* nothing licensed		*/
-#define LICENSE_SEP	','		/* feature separator		*/
-
-/*
- * File_t flags
- */
-
-#define RESERVED_FD	10		/* reserved fds >= this		*/
-
-#define FILE_CLOEXEC	(1<<0)
-#define FILE_ERROR	(1<<1)
-#define FILE_LOCK	(1<<2)
-#define FILE_OPEN	(1<<3)
-#define FILE_REGULAR	(1<<4)
-#define FILE_WRITE	(1<<5)
-#define FILE_VIRTUAL	(1<<6)
-
-#define FILE_LOCAL	(1<<8)
-
-/*
- * map flags
- */
-
-#define MAP_EXEC	(1<<0)		/* get info for exec		*/
-#define MAP_INIT	(1<<1)		/* get info for init		*/
-
-/*
- * Mount_t flags
- */
-
-#define MOUNT_PRIMARY	(1<<0)
-
-/*
- * pathreal() flags
- */
-
-#define P_ABSOLUTE	(1<<0)		/* no relative conversion	*/
-#define P_DOTDOT	(1<<1)		/* add /.. to end of path	*/
-#define P_LSTAT		(1<<2)		/* lstat() calling		*/
-#define P_NOOPAQUE	(1<<3)		/* remove if opaque object	*/
-#define P_NOSLASH	(1<<4)		/* remove trailing /'s		*/
-#define P_PATHONLY	(1<<5)		/* just canonicalize path	*/
-#define P_READLINK	(1<<6)		/* readlink() calling		*/
-#define P_SAFE		(1<<7)		/* must be in safe tree		*/
-#define P_SLASH		(1<<8)		/* add trailing /		*/
-#define P_TOP		(1<<9)		/* copy to top level		*/
-
-#ifndef ENOTEMPTY
-#define ENOTEMPTY	EEXIST
-#endif
-
-#define T_ALLOCATE	(1<<15)
-#define T_PREFIX	(1<<14)
-#define T_DELETE	(T_ALLOCATE|T_PREFIX)
-#define T_SIZE		(T_PREFIX-1)
-
-#define T_VALSIZE(p)	(((p)->valsize&T_SIZE)?((p)->valsize&T_SIZE):strlen((p)->val))
-
-#define T_MOUNT		(T_SIZE-0)
-
-#define FS_null		0
-#define FS_option	1
-#define FS_view		2
-#define FS_pwd		3
-#define FS_fs		4
-#define FS_map		5
-#define FS_safe		6
-#define FS_fd		7
-#define FS_intercept	8
-
-#define FS_ACTIVE	(1<<0)
-#define FS_BOUND	(1<<1)
-#define FS_CLOSE	(1<<2)
-#define FS_ERROR	(1<<3)
-#define FS_FLUSH	(1<<4)
-#define FS_FORK		(1<<5)
-#define FS_FS		(1<<6)
-#define FS_GLOBAL	(1<<7)
-#define FS_INIT		(1<<8)
-#define FS_INTERACTIVE	(1<<9)
-#define FS_INTERNAL	(1<<10)
-#define FS_LICENSED	(1<<11)
-#define FS_LOAD		(1<<12)
-#define FS_LOCK		(1<<13)
-#define FS_MAGIC	(1<<14)
-#define FS_MONITOR	(1L<<15)
-#define FS_NAME		(1L<<16)
-#define FS_ON		(1L<<17)
-#define FS_OPEN		(1L<<18)
-#define FS_RAW		(1L<<19)
-#define FS_RECEIVE	(1L<<20)
-#define FS_REFERENCED	(1L<<21)
-#define FS_REGULAR	(1L<<22)
-#define FS_UNIQUE	(1L<<23)
-#define FS_VALIDATED	(1L<<24)
-#define FS_WRITE	(1L<<25)
-
-#define FS_LOCAL	(1L<<26)
-
-#define cancel(p)	(*(p)>=RESERVED_FD?(state.file[*(p)].reserved=0,CLOSE(*(p)),*(p)=0):(-1))
-#define fsfd(p)		((((p)->flags&(FS_ERROR|FS_ON|FS_OPEN))==(FS_ON|FS_OPEN))?(p)->fd:((((p)->flags&(FS_BOUND|FS_ERROR|FS_INIT|FS_ON))==(FS_BOUND|FS_ON))?fsinit(p,-1):-1))
-#define fson(p)		(((p)->flags&(FS_BOUND|FS_ERROR|FS_ON))==(FS_BOUND|FS_ON))
-#define initialize()	do { if (!state.pid) init(0,0,0); else if (state.control.note) control(); } while(0)
-#define monitored()	((state.path.monitor&&!state.path.mount)?state.path.monitor:(Mount_t*)0)
-#define mounted()	((state.path.monitor&&state.path.mount)?state.path.monitor:(Mount_t*)0)
-#if _hdr_alloca
-#define reclaim()
-#else
-#define reclaim()	do { if (state.brk.beg) fix(); } while (0)
-#endif
-#define reserve(p)	((state.file[*(p)].flags|=FILE_LOCK,*(state.file[*(p)].reserved=(p)))<RESERVED_FD?close(*(p)):0)
-
-#if FS
-#define fgetmount(f)	((f)>=0&&(f)<=state.cache?state.file[f].mount:(Mount_t*)0)
-#define fsmonitored(p)	((state.path.monitor=getmount((p),NiL))&&(state.path.monitor->fs->flags&(FS_ERROR|FS_MONITOR|FS_ON))==(FS_MONITOR|FS_ON))
-#define fsmount(p)	(((p)->channel&&(p)->fs->fd)?((p)->channel==-1?-1:(p)->fs->fd):fschannel(p))
-#define fssys(p,c)	(fson((p)->fs)&&(((p)->fs->call&MSG_MASK(c))||((p)->fs->flags&FS_GLOBAL)&&(fsmount(p),0)))
-#endif
-
-#define var_3d		"__="
-#define var_pwd		"PWD="
-#define var_shell	"SHELL="
-#define var_view	"VPATH="
-
-typedef struct
-{
-	char*		key;
-	char*		val;
-	unsigned short	keysize;
-	unsigned short	valsize;
-} Map_t;
-
-typedef struct
-{
-	unsigned int	size;
-	Map_t		table[TABSIZE];
-} Table_t;
-
-typedef struct
-{
-	int		level;
-	int		open_level;
-	int		synthesize;
-	int		nlinks;
-	char*		linkname;
-	int		linksize;
-#if FS
-	Mount_t*	monitor;
-#endif
-	char*		mount;
-	Table_t*	table;
-#if VCS && defined(VCS_PATH_STATE)
-	VCS_PATH_STATE;
-#endif
-	struct stat	st;
-	char		name[4 * PATH_MAX];
-} Path_t;
-
-typedef struct
-{
-	Fs_t*		fs;
-	char*		prefix;
-	int		prelen;
-} Visit_t;
-
-struct Intercept_s; typedef struct Intercept_s Intercept_t;
-
-typedef long (*Intercept_f)(Intercept_t*, int, int, void*, void*, void*, void*, void*, void*);
-
-struct Intercept_s
-{
-	Intercept_f		call;
-	unsigned long		mask;
-};
-
-#if _no_exit_exit
-typedef void (*Exitfunc_t)(int);
-#endif
-
-typedef struct
-{
-	/* the first elements are explicitly initialized */
-
-	const char*	id;
-	char*		cmd;
-	char		dot[2];
-	char		null[1];
-	char		one[2];
-	char*		binsh;
-	char		env3d[sizeof(var_3d)];
-	char		envpwd[sizeof(var_pwd) + 4 * PATH_MAX];
-	char		envshell[sizeof(var_shell) + PATH_MAX];
-	char		envview[sizeof(var_view)];
-	Fs_t		fs[TABSIZE];
-	char		vdefault[8];
-	char		opaque[8];
-	int		limit;
-
-	/* the rest are implicitly initialized */
-
-	struct
-	{
-	short		monitor;
-	short		name;
-	}		call;
-	struct
-	{
-	short		fd;
-	unsigned long	internal;
-	}		channel;
-	struct
-	{
-	int		note;
-	int		pathsize;
-	char*		path;
-	}		control;
-#if VCS && defined(VCS_STATE)
-	VCS_STATE;
-#endif
-	int		boundary;
-	struct
-	{
-	char*		beg;
-	char*		end;
-	}		brk;
-	int		cache;
-	char**		env;
-	char*		envpath;
-	void*		freedirp;
-	int		in_2d;
-	gid_t		gid;
-	int		kernel;
-	int		level;
-	char		license[64];
-	int		open;
-	pid_t		pid;
-	char*		pwd;
-	int		pwdsize;
-	char		pwdbuf[4 * PATH_MAX + 1];
-	long		ret;
-	Fs_t*		safe;
-	char*		shell;
-	uid_t		uid;
-	struct
-	{
-	char*		value;
-	char*		invert;
-	char*		next;
-	int		valsize;
-	int		invertsize;
-	}		key;
-	struct
-	{
-	short		fd;
-	short		version;
-	int		size;
-	char		buf[TABLE_MAX];
-	}		table;
-	unsigned long	test;
-	struct
-	{
-	unsigned long	call;
-	short		count;
-	pid_t		pid;
-	}		trace;
-	Table_t		vmap;
-	Table_t		vmount;
-	Table_t		vpath;
-	Table_t		vsafe;
-	Table_t		vintercept;
-	File_t		file[OPEN_MAX];
-	Visit_t		visit;
-	Path_t		path;
-	int		real;
-	struct
-	{
-	int		size;
-	Intercept_t	intercept[INTERCEPT_MAX];
-	}		trap;
-#if _no_exit_exit
-	Exitfunc_t	libexit;
-#endif
-#if FS
-	Mount_t*	global;
-	Mount_t		mount[2 * TABSIZE];
-#endif
-} State_t;
-
-#include "std_3d.h"
-
-extern State_t		state;
-
-extern int		bprintf(char**, char*, const char*, ...);
-extern ssize_t		bvprintf(char**, char*, const char*, va_list);
-extern void		calldump(char**, char*);
-extern void		callinit(void);
-extern int		checklink(const char*, struct stat*, int);
-extern void		control(void);
-extern int		fs3d_copy(int, int, struct stat*);
-extern int		fs3d_dup(int, int);
-extern int		fs3d_mkdir(const char*, mode_t);
-extern int		fs3d_open(const char*, int, mode_t);
-extern void		fsdrop(Fs_t*, int);
-extern int		fsinit(Fs_t*, int);
-extern unsigned long	getkey(const char*, const char*, int);
-extern int		init(int, const char*, int);
-extern int		instance(char*, char*, struct stat*, int);
-extern int		iterate(Table_t*, int(*)(Map_t*, char*, int), char*, int);
-extern int		keep(const char*, size_t, int);
-extern int		mapdump(Table_t*, char*, int);
-extern int		mapget(Map_t*, char*, int);
-extern int		mapinit(const char*, int);
-extern int		mapset(Table_t*, const char*, int, const char*, int);
-extern int		nosys(void);
-extern char*		pathcanon(char*, size_t, int);
-extern char*		pathcat(const char*, int, const char*, const char*, char*, size_t);
-extern char*		pathreal(const char*, int, struct stat*);
-extern ssize_t		peek(int, void*, size_t);
-extern Map_t*		search(Table_t*, const char*, int, const char*, int);
-extern Sysfunc_t	sysfunc(int);
-extern int		intercept(Intercept_f, unsigned long);
-
-#if FS
-extern int		fileinit(int, struct stat*, Mount_t*, int);
-extern int		fscall(Mount_t*, long, int, ...);
-extern int		fschannel(Mount_t*);
-extern char*		fsreal(Mount_t*, long, const char*);
-extern int		getattr(const char*, char*);
-extern Mount_t*		getmount(const char*, const char**);
-extern const char*	setattr(char*, const char*, const char*);
-#endif
-
-/*
- * non-standard standards
- */
-
-#if ! _UWIN
-extern void*		sbrk(ssize_t);
-#endif
-
-/*
- * backwards compatibility fixups
- * these should go away in 94 (ha!)
- */
-
-#if _int_st_spare1
-#define NIVIEW(p,v)	((p)->st_spare1=(v))
-#else
-#if _ary_st_spare4
-#define NIVIEW(p,v)	((p)->st_spare4[0]=(v))
-#else
-#if _ary_st_pad4
-#define NIVIEW(p,v)	((p)->st_pad4[0]=(v))
-#else
-#define NIVIEW(p,v)
-#endif
-#endif
-#endif
-
-#undef	IVIEW
-
-#if _mem_st_rdev_stat
-#define IVIEW(p,v)	do{NIVIEW(p,(v)&(INSTANCE-1));if(!S_ISBLK((p)->st_mode)&&!S_ISCHR((p)->st_mode))(p)->st_rdev=(v)&(INSTANCE-1);}while(0)
-#else
-#define IVIEW(p,v)	NIVIEW(p,(v)&(INSTANCE-1))
-#endif
-
-#endif

+ 0 - 376
src/cmd/3d/3d.sh

@@ -1,376 +0,0 @@
-########################################################################
-#                                                                      #
-#               This software is part of the ast package               #
-#          Copyright (c) 1989-2011 AT&T Intellectual Property          #
-#                      and is licensed under the                       #
-#                 Eclipse Public License, Version 1.0                  #
-#                    by AT&T Intellectual Property                     #
-#                                                                      #
-#                A copy of the License is available at                 #
-#          http://www.eclipse.org/org/documents/epl-v10.html           #
-#         (with md5 checksum b35adb5213ca9657e911e9befb180842)         #
-#                                                                      #
-#              Information and Software Systems Research               #
-#                            AT&T Research                             #
-#                           Florham Park NJ                            #
-#                                                                      #
-#                 Glenn Fowler <gsf@research.att.com>                  #
-#                  David Korn <dgk@research.att.com>                   #
-#                   Eduardo Krell <ekrell@adexus.cl>                   #
-#                                                                      #
-########################################################################
-# NOTE: retain this comment
-dir=$_ # NOTE: this line must appear before any commands
-
-command=3d
-
-case $RANDOM in
-$RANDOM)exec ksh 3d "$@" ;;
-esac
-
-case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
-0123)	ARGV0="-a $command"
-	USAGE=$'
-[-?
-@(#)$Id: 3d (AT&T Labs Research) 2006-10-01 $
-]
-'$USAGE_LICENSE$'
-[+NAME?3d - execute a command with nDFS filesystem services enabled]
-[+DESCRIPTION?\b3d\b executes a dynamically linked \acommand\a
-	with \an\a\bDFS\b filesystem services enabled. It intercepts pathname
-	system calls and applies the \an\a\bDFS\b operations specified
-	by the \bVPATH\b environment variable, the command line mounts,
-	and the \bvpath\b command. If \acommand\a is omitted then an
-	interactive \bsh\b(1) is started. All processes executed by \acommand\a
-	also have \an\a\bDFS\b enabled.]
-[+?The main \b3d\b service is \aviewpathing\a. A \aviewpath\a mounts one
-	directory tree on top of another. Files in the top level
-	(directory tree) obscure files in the lower level. Lower level files
-	have copy-on-write semantics to the top level. i.e., files in the lower
-	level are readonly; if a lower level file is modified it is first
-	copied to the top level before modification. Viewpath mounted
-	directories can be chained. All levels but the top in a chain are
-	readonly. The traditional \bVPATH=\b\ad1:d2:d3\a viewpathing is
-	specified by the two \b3d\b mounts "\ad1 d2\a" and "\ad2 d3\a".]
-[+?The following service mounts are initialized by default:]{
-	[+/dev/fd?\b/dev/fd/\b\an\a refers to the open file descriptor \an\a
-		in the current process.]
-	[+/dev/fdp?\b/dev/fdp/local/\aservice\a opens a 2-way stream to
-		\aservice\a on the local host. The stream supports file
-		descriptor exchange.]
-	[+/dev/tcp?\b/dev/tcp/\b\ahost\a\b/\b\aservice\a opens a 2-way
-		connection to \aservice\a on \ahost\a. \binetd\b(8) services
-		are named either by \binet.\b\aservice\a or by port number.]
-	[+/dev/udp?\b/dev/udb/\b\ahost\a\b/\b\aservice\a opens a datagram
-		connection to \aservice\a on \ahost\a. \binetd\b(8) services
-		are named either by \binet.\b\aservice\a or by port number.]
-}
-[c:command?Ignored; allows \b3d\b to be invoked like \bsh\b(1).]
-[d:debug?Set the debug trace level to \alevel\a. Higher levels produce more
-	output.]#[level]
-[l:lite?Disable the default service mounts.]
-[m:mount?Mount the path \atop\a onto the path \abottom\a. If \abottom\a is a
-	directory then the directory \atop\a is viewpathed on top of \abottom\a.
-	Otherwise \abottom\a must match a \b3d\b \bfs\b path of the form
-	\b/#\b\aspecial\a.]:["top bottom"]
-[n!:exec?Execute \acommand\a. \b--noexec\b shows how \acommand\a would be
-	invoked but does not execute.]
-[o:output?\b--trace\b and \b--debug\b output is written to \afile\a instead
-	of the standard error.]:[file]
-[s:shell?Sets the \bsh\b(1) executable path to \afile\a.]:[file:=ksh]
-[t:trace?If \aid\a is \b1\b then intercepted system calls for all child
-	processes will be traced. If \aid\a is greater than \b1\b then
-	intercepted system calls for the current process and all
-	children will be traced.]#[id]
-[v:version?Use \b3d\b version \amajor.minor\a instead of the latest
-	version.]:[major.minor]
-[x:?Passed to the \b3d\b \bsh\b(1).]
-[+FS PATHS?\b3d\b \bfs\b paths of the form \b/#\b\aspecial\a[\b/\b...]]
-	control the semantics of \b3d\b and allow services to be attached to
-	the file namespace. Unsupported \bfs\b paths are silently ignored. The
-	supported \bfs\b paths are:]{
-	[+/#fd? ]
-	[+/#fs/\aname\a[/\aoption\a/...]]? ]
-	[+/#map? ]
-	[+/#null? ]
-	[+/#option? ]{
-		[+2d? ]
-		[+3d? ]
-		[+boundary? ]
-		[+call=\avalue\a? ]
-		[+count=\avalue\a? ]
-		[+debug=\alevel\a? ]
-		[+dump=\b[\avalue\a]]? ]{
-			[+call=\avalue\a? ]
-			[+file=\avalue\a? ]
-			[+fs=\avalue\a? ]
-			[+map=\avalue\a? ]
-			[+mount=\avalue\a? ]
-			[+safe=\avalue\a? ]
-			[+state=\avalue\a? ]
-			[+view=\avalue\a? ]
-		}
-		[+file=\avalue\a? ]
-		[+fork? ]
-		[+init? ]
-		[+license=\apath\a? ]
-		[+mount=\avalue\a? ]
-		[+table=\avalue\a? ]
-		[+test=\abitmask\a? ]
-		[+timeout=\avalue\a? ]
-		[+timestamp? ]
-		[+trace=\avalue\a? ]
-		[+version=1? ]
-	}
-	[+/#pwd? ]
-	[+/#safe? ]
-	[+/#view? ]
-}
-[+DETAILS?\an\a\bDFS\b semantics are applied by intercepting system calls with
-	a dll that is preloaded at process startup before \amain\a() is called.
-	The interception mechanism may involve the environment on some systems;
-	in those cases commands like \benv\b(1) that clear the enviroment
-	before execution may defeat the \b3d\b intercepts. The intercepted
-	system calls are listed by \bvpath - /#option/dump=call\b. Note that
-	implementation system call names may differ from those listed in
-	section 2 of the manual; \bstat\b(2) is especially vulnerbale to
-	mangling.]
-[+?\b3d\b ignores calls not present in a particular host system. In addition,
-	\b3d\b only works on dynamically linked executables that have neither
-	set-uid nor set-gid permissions. It may not have the intended effect
-	on programs written in a language or linked with a language runtime
-	that hides or mangles system call library symbols, or that
-	directly emit system call instruction sequences rather than using
-	the corresponding library functions, or that dynamically link
-	libraries outside of the scope of the \b3d\b intercepts.]
-[+?Multi-process client-server applications may misbehave if the \b3d\b
-	environment between the related processes is not kept in sync.]
-
-[ command [ arg ... ] ]
-
-[+ENVIRONMENT?\b3d\b is implemented by four components: the \b3d\b script,
-	located on \b$PATH\b; the \b3d\b dll (shared library), located either
-	on \b$PATH\b or in one of the \b../lib\b* directories on \b$PATH\b,
-	depending on local compilation system conventions; and the \b2d\b
-	\bsh\b(1) alias and \b_2d\b \bsh\b(1) function that allow commands
-	to be run with \an\a\bDFS\b semantics disabled. Systems like
-	\bsgi.mips3\b that support multiple a.out formats may have multiple
-	versions of the \b3d\b dll. In all cases the \b3d\b script handles
-	the dll search.]
-[+EXAMPLES?]{
-	[+\b$ 3d]
-	[+\b$ VPATH=$INSTALLROOT::$PACKAGEROOT 3d]
-	[+\b$ 3d ls -l]
-	[+\b$ 2d ls -l]
-}
-[+SEE ALSO?\benv\b(1), \bie\b(1), \bsh\b(1), \btrace\b(1), \bwarp\b(1),
-	\bstat\b(2)]
-'
-	;;
-*)	ARGV0=""
-	USAGE='clnxd:m:o:s:t:v:[ command [ arg ... ] ]'
-	;;
-esac
-
-test . -ef "$PWD" || PWD=`pwd`
-case $dir in
-*/3d)	;;
-*)	case $0 in
-	*/*)	dir=$0
-		;;
-	*)	dir=`whence 3d 2>/dev/null`
-		dir=`whence -p $dir 2>/dev/null`
-		;;
-	esac
-esac
-case $dir in
-/*)	dir=${dir%/*} ;;
-*)	dir=${dir#./}; dir=$PWD/${dir%/*} ;;
-esac
-abi=
-dir=${dir%/*}
-case $dir in
-*/arch/sgi.mips[0123456789]*)
-	if	test -d /lib32 -o -d /lib64
-	then	d=${dir%-*}
-		d=${d%?}
-		for a in 2: 3:N32 4:64
-		do	t=${a#*:}
-			a=${a%:*}
-			if	test -d $d$a
-			then	abi="$abi $d$a:$t"
-			fi
-		done
-	fi
-	;;
-esac
-cflag=
-full="/dev/fdp/local/nam/user /#fs/nam/name/unique /dev/fdp /#nam /dev/tcp /#nam /dev/udp /#nam /dev/fd /#fd"
-mount="- -"
-options=
-output=
-show=
-shell=$SHELL
-trace=
-SHELL=
-version=
-case $VPATH in
-*:*)	ifs=${IFS-'
-	 '}
-	IFS=:
-	o=
-	for a in $VPATH
-	do	case $a in
-		""|-)	;;
-		*)	case $o in
-			""|-)	;;
-			*)	mount="$mount $o $a" ;;
-			esac
-			;;
-		esac
-		o=$a
-	done
-	IFS=$ifs
-	;;
-esac
-
-: grab the options
-
-while	getopts $ARGV0 "$USAGE" OPT
-do	case $OPT in
-	c)	cflag=1; break ;;
-	d)	trace="$trace/debug=$OPTARG" ;;
-	l)	full= ;;
-	m)	mount="$mount $OPTARG" ;;
-	n)	show="print -u2 --" ;;
-	o)	output=$OPTARG ;;
-	s)	SHELL=$OPTARG ;;
-	t)	trace="$trace/trace=$OPTARG" ;;
-	v)	case $OPTARG in
-		/*)	version=$OPTARG ;;
-		*)	version=.$OPTARG ;;
-		esac
-		;;
-	x)	options="$options -$OPT" ;;
-	*)	exit 2 ;;
-	esac
-done
-set x "$@"
-shift $OPTIND
-case $cflag in
-1)	set -- -c "$@" ;;
-esac
-
-case $full in
-?*)	mount="$full $mount" ;;
-esac
-mount="- /#option/3d$trace $mount"
-case $output in
-?*)	mount="$output /#fs/option $mount" ;;
-esac
-default=$version
-case $version in
-/*)	;;
-*)	if	getconf LIBPREFIX >/dev/null 2>&1
-	then	d=$(getconf LIBPATH)
-		d=${d##*,}
-		d=${d%%:*}
-		p=$(getconf LIBPREFIX)
-		s=$(getconf LIBSUFFIX)
-	else	d=lib
-		p=lib
-		s='.s[lo]'
-	fi
-	for x in $dir/$d/${p}3d${s}$version $dir/$d/${p}3d${version//./}${s}
-	do	case $x in
-		*/${p}3d${s}*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]*|*/${p}3d$*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]*${s})
-			;;
-		*)	version=$x
-			break
-			;;
-		esac
-	done
-	;;
-esac
-exp=
-if	test -f "$version"
-then	if	test -d $dir/3d
-	then	dir=$dir/3d
-	fi
-	case :$FPATH: in
-	*:$dir/fun:*)	;;
-	*)		export FPATH=$dir/fun${FPATH:+:$FPATH} ;;
-	esac
-	case :$PATH: in
-	*:$dir/bin:*)	;;
-	*)		export PATH=$dir/bin:$PATH ;;
-	esac
-	exp="$exp LD_PRELOAD=$version"
-	case $abi:-:$version in
-	?*:-:$dir/*)
-		v=${version#$dir/}
-		for a in $abi
-		do	d=${a%:*}
-			a=${a#*:}
-			exp="$exp _RLD${a}_LIST=$d/$v:DEFAULT"
-		done
-		;;
-	*)	v=${version%.*}
-		s=${version##*.}
-		if	test -f ${v}-n32.$s
-		then	exp="$exp _RLD64_LIST=$version:DEFAULT _RLDN32_LIST=$version-n32.$s:DEFAULT _RLD_LIST=${v}-o32.$s:DEFAULT"
-		elif	test -f ${v}-64.$s -o -f ${v}-o32.$s
-		then	exp="$exp _RLD64_LIST=$version-64.$s:DEFAULT _RLDN32_LIST=$version:DEFAULT _RLD_LIST=${v}-o32.$s:DEFAULT"
-		else	exp="$exp _RLD_LIST=$version:DEFAULT"
-		fi
-		if	test -f ${dir}/lib/libdir64.$s
-		then	exp="$exp:${dir}/lib/libdir64.$s"
-		fi
-		;;
-	esac
-	export $exp
-	case $mount in
-	??*)	export __=${mount#' '} ;;
-	*)	unset __ ;;
-	esac
-	unset VPATH
-else	print -u2 "$command: $version: no shared library"
-	case $default in
-	"*")	;;
-	*)	exit 1 ;;
-	esac
-	version=
-	options=
-fi
-case $SHELL in
-"")	t=`whence ksh 2>/dev/null`
-	SHELL=`PATH=$dir/bin:$PATH whence -p $t 2>/dev/null`
-	;;
-esac
-SHELL=${SHELL:-$shell}
-SHELL=${SHELL:-/bin/sh}
-export SHELL
-case `vpath /#option/3d 2>/dev/null` in
-*/2d)	$show vpath $mount ;;
-esac
-case $1:$#:$options in
--*)	;;
-*:0:*|*:*:?*)
-	shell="$SHELL $options"
-	;;
-*)	t=`whence $1 2>/dev/null`
-	t=`whence -p $t 2>/dev/null`
-	case $t in
-	""|"''"|'""')	shell="$SHELL $options" ;;
-	*)		shell= ;;
-	esac
-	;;
-esac
-case $show in
-"")	exec $shell "$@" ;;
-*)	case $version in
-	"")	$show __="'$__'" exec $shell "$@" ;;
-	*)	$show __="'$__'" $exp exec $shell "$@" ;;
-	esac
-	;;
-esac

+ 0 - 350
src/cmd/3d/3d.tst

@@ -1,350 +0,0 @@
-: 3d regression tests
-#
-# 3d.tst (AT&T Research) 2004-07-01
-#
-# the first section defines the test harness
-# the next section defines individual test functions
-# the tests are in the last section
-#
-
-( vpath ) >/dev/null 2>&1 || {
-	print -u2 $0: must be run from 3d shell
-	exit 1
-}
-
-export LC_ALL=C
-
-integer seconds=0
-
-COMMAND=3d
-
-FILE=
-FORMAT="%K"
-GROUP=
-INIT=
-NEW="new-and-improved"
-NUKE=
-OLD="original"
-pwd=$PWD
-PREFIX=
-STAMP="2005-07-17+04:05:06"
-VIRTUAL=
-
-TWD
-
-function ACTIVE
-{
-	DO return 0
-}
-
-function TEST
-{
-	case $INIT in
-	"")	INIT=1
-		mkdir -p $TWD/bottom || exit 1
-		cd $TWD
-		INTRO
-		;;
-	esac
-	cd $TWD
-	case $NUKE in
-	?*)	rm -rf $NUKE; NUKE= ;;
-	esac
-	PREFIX=
-	GROUP=$1
-	ACTIVE || return 1
-	vpath - -
-	shift
-	print "$GROUP	$*"
-}
-
-function FAIL # file message
-{
-	print -u2 "	FAIL $@"
-	rm -rf $1
-	(( ERRORS++ ))
-	return 0
-}
-
-function VERIFY # command ...
-{
-	(( TESTS++ ))
-	"$@" || FAIL "$@"
-}
-
-function PREFIX
-{
-	PREFIX=$1
-	case $1 in
-	/*)	NUKE="$NUKE $1" ;;
-	*)	NUKE="$NUKE $PWD/$1" ;;
-	esac
-}
-
-function VIRTUAL
-{
-	case $VIRTUAL in
-	?*)	pwd=$PWD
-		cd $TWD
-		rm -rf $TWD/$VIRTUAL
-		cd $pwd
-		;;
-	esac
-	VIRTUAL=$1
-}
-
-function CD
-{
-	VERIFY cd $TWD/$1
-}
-
-function VPATH
-{
-	VERIFY vpath "$@"
-}
-
-function CP
-{
-	VERIFY cp "$@"
-	shift $#-1
-	NUKE="$NUKE $1"
-}
-
-function LN
-{
-	VERIFY ln "$@"
-	shift $#-1
-	NUKE="$NUKE $1"
-}
-
-function MV
-{
-	VERIFY mv "$@"
-	shift $#-1
-	NUKE="$NUKE $1"
-}
-
-function MKDIR
-{
-	VERIFY mkdir -p $*
-	for i
-	do	case $i in
-		/*)	NUKE="$NUKE $i" ;;
-		*)	NUKE="$NUKE $i" ;;
-		esac
-	done
-}
-
-function DATA
-{
-	VIRTUAL $VIRTUAL
-	case $1 in
-	-)	remove=1; shift ;;
-	*)	remove=0 ;;
-	esac
-	case $# in
-	0)	return 0 ;;
-	1)	;;
-	*)	return 1 ;;
-	esac
-	path=$1
-	case $PREFIX in
-	"")	FILE=$path ;;
-	*)	FILE=$PREFIX/$path ;;
-	esac
-	file=bottom/$path
-	if	[[ ! -f $TWD/$file ]]
-	then	case $remove in
-		0)	if	[[ $path == */* && ! -d $TWD/${file%/*} ]]
-			then	mkdir -p $TWD/${file%/*} || FAIL $TWD/${file%/*} DATA mkdir
-			fi
-			print $OLD > $TWD/$file
-			mode=${file%???}
-			mode=${file#$mode}
-			chmod $mode $TWD/$file || FAIL $TWD/$file DATA chmod
-			;;
-		esac
-	else	case $remove in
-		1)	rm -f $TWD/$file ;;
-		esac
-	fi
-	(( TESTS++ ))
-	return 0
-}
-
-#
-# the remaining functions implement individiual parameterized tests
-#
-
-function APPEND
-{
-	DATA $*
-	print "$NEW" >> $FILE || FAIL $FILE write error
-	if	[[ $(<$FILE) != "$OLD"$'\n'"$NEW" ]]
-	then	FAIL $FILE unchanged by $0
-	elif	[[ -f $FILE/... && $(<$FILE/...) != "$OLD" ]]
-	then	FAIL $FILE/... changed by $0
-	fi
-}
-
-function MODE
-{
-	DATA $*
-	chmod 000 $FILE || FAIL $FILE chmod error
-	if	[[ -f $FILE/... && ! -r $FILE/... ]]
-	then	FAIL $FILE/... changed by $0
-	elif	[[ -r $FILE ]]
-	then	FAIL $FILE unchanged by $0
-	fi
-}
-
-function REMOVE
-{
-	DATA $*
-	rm $FILE || FAIL $FILE rm error
-	if	[[ ! -f $FILE/... ]]
-	then	FAIL $FILE/... changed by $0
-	fi
-	print "$NEW" > $FILE || FAIL $FILE write error
-	rm $FILE || FAIL $FILE rm error
-	if	[[ $(<$FILE) != "$OLD" ]]
-	then	FAIL $FILE unchanged by $0
-	elif	[[ $(<$FILE/...) != "$OLD" ]]
-	then	FAIL $FILE/... changed by $0
-	fi
-}
-
-function TOUCH
-{
-	DATA $*
-	touch -t "#$((seconds++))" $FILE/... || FAIL $FILE/... touch error
-	touch -t "#$((seconds++))" $TWD/reference || FAIL $TWD/reference touch error
-	touch -t "#$((seconds++))" $FILE || FAIL $FILE touch error
-	if	[[ $FILE/... -nt $TWD/reference ]]
-	then	FAIL $FILE/... changed by $0
-	elif	[[ ! $FILE -nt $TWD/reference ]]
-	then	FAIL $FILE unchanged by $0
-	fi
-	touch -t $STAMP $FILE
-	if	[[ $(date -m -f $FORMAT $FILE) != "$STAMP" ]]
-	then	FAIL $FILE modfiy time does not match $STAMP
-	fi
-}
-
-function UPDATE
-{
-	DATA $*
-	print "$NEW" 1<> $FILE || FAIL $FILE write error
-	if	[[ $(<$FILE) != "$NEW" ]]
-	then	FAIL $FILE unchanged by $0
-	elif	[[ -f $FILE/... && $(<$FILE/...) != "$OLD" ]]
-	then	FAIL $FILE/... changed by $0
-	fi
-}
-
-function WRITE
-{
-	DATA $*
-	print "$NEW" > $FILE || FAIL $FILE write error
-	if	[[ $(<$FILE) != "$NEW" ]]
-	then	FAIL $FILE unchanged by $0
-	elif	[[ -f $FILE/... && $(<$FILE/...) != "$OLD" ]]
-	then	FAIL $FILE/... changed by $0
-	fi
-}
-
-function RUN
-{
-	[[ $1 == 3d ]] || return
-	DATA
-	WRITE	w666
-	WRITE	w600
-	TOUCH	t777
-	MODE	m444
-	WRITE	dir/w666
-	WRITE	dir/w600
-	TOUCH	dir/t777
-	MODE	dir/m444
-	UPDATE	u644
-	UPDATE	u640
-	APPEND	a644
-	APPEND	a640
-	UPDATE	dir/u644
-	UPDATE	dir/u640
-	APPEND	dir/a644
-	APPEND	dir/a640
-	VIRTUAL
-	REMOVE	r644
-	WRITE	r644
-	REMOVE	r644
-}
-
-#
-# finally the tests
-#
-
-TEST 01 PWD==top top exists &&
-{
-	VPATH top bottom
-	MKDIR top
-	CD top
-	RUN 3d
-}
-
-TEST 02 PWD!=top top exists &&
-{
-	VPATH top bottom
-	MKDIR top
-	MKDIR junk
-	CD junk
-	PREFIX ../top
-	RUN 3d
-}
-
-TEST 03 PWD==top top virtual &&
-{
-	VIRTUAL top
-	VPATH top bottom
-	CD top
-	RUN 3d
-}
-
-TEST 04 PWD!=top top virtual &&
-{
-	VIRTUAL top
-	VPATH top bottom
-	MKDIR junk
-	CD junk
-	PREFIX ../top
-	RUN 3d
-}
-
-TEST 05 top symlink &&
-{
-	if	LN -s text link
-	then	[[ -L link ]] || FAIL lstat does stat
-	fi
-}
-
-TEST 06 symlink spaghetti &&
-{
-	MKDIR usr/bin sbin
-	echo : > sbin/cmd && chmod +x sbin/cmd
-	LN -s usr/bin bin
-	LN -s ../../sbin/cmd usr/bin/cmd
-	CD bin
-	PATH=:$PATH cmd
-}
-
-TEST 07 PWD==top top exists, bot virtual &&
-{
-	VPATH top bot
-	MKDIR top
-	CD top
-	echo foo > foo && echo bar > bar
-	CP foo ...
-	MV bar ...
-	CP foo ...
-	[[ -d ... ]] && FAIL ... is a directory && return
-	[[ $(cat foo 2>/dev/null) != foo ]] && FAIL top garbled -- $(cat foo 2>&1)
-}

+ 0 - 110
src/cmd/3d/Makefile

@@ -1,110 +0,0 @@
-if CC.HOSTTYPE == "no_build"
-/*
- * 3d fs library
- *
- * NOTE: ld -r does not work with $(CC.DLL) so lib3d.o is not possible
- *       (unless we compile it in one file -- no thanks)
- *	 so a static link needs -u _exit -l3d other-libs
- */
-
-:PACKAGE: ast:nolibrary
-
-LICENSE = since=1989,author=gsf+dgk+ekrell
-
-ID = 3d
-VERSION = 4.0
-CATALOG = 3d
-
-CCFLAGS = -O $(CC.DLL) /* NOTE: gcc $(CC.OPTIMIZE) fails here! */
-IFFEREFS = -last
-TMP = 3.$(tmp)
-
-DEBUG == 1
-DEBUG_TABLE == 0
-FS == 1
-IDNAME == "$(ID)"
-PATHCHECK == "$(ID)"
-MIX ==
-VCS == 1
-
-if LITE
-DEBUG = 0
-DEBUG_TABLE = 0
-FS = 0
-VCS = 0
-end
-
-$(ID)$(VARIANTID) $(VERSION) id=$(ID) :LIBRARY: README RELEASE PROMO.mm \
-	3d.h lib_3d.h dir_3d.h \
-	init.c \
-	bio.c copy.c error.c execv.c fs.c lib.c map.c \
-	pathcanon.c pathnext.c pathreal.c peek.c \
-	ast.c cs.c license.c \
-	vcs_3d.h vcs.c \
-	access3d.c brk3d.c chdir3d.c chmod3d.c chown3d.c close3d.c \
-	creat3d.c dir3d.c dup23d.c dup3d.c execve3d.c exit3d.c \
-	fchdir3d.c fchmod3d.c fchown3d.c fcntl3d.c fork3d.c fpathconf3d.c \
-	fstat3d.c fstatfs3d.c fstatvfs3d.c fsync3d.c \
-	ftruncate3d.c getdents3d.c kill3d.c link3d.c lseek3d.c \
-	lstat3d.c mkdir3d.c mknod3d.c mount3d.c open3d.c pathconf3d.c \
-	pipe3d.c read3d.c readlink3d.c rename3d.c rmdir3d.c sbrk3d.c \
-	stat3d.c statfs3d.c statvfs3d.c symlink3d.c syscall3d.c \
-	sysent3d.c truncate3d.c unlink3d.c utime3d.c utimes3d.c utimets3d.c \
-	vfork3d.c write3d.c \
-	acl3d.c facl3d.c \
-	dll3d.c \
-	utimensat3d.c \
-	-ldl
-
-if ! VARIANTID
-
-3d :: 3d.sh
-
-opaque :: opaque.sh
-
-vex :: vex.sh
-
-$(FUNDIR) :INSTALLDIR: mode=+x _2d
-
-end
-
-:VARIANT:
-
-/*
- * -l<library> :lib: <subdir> ...
- *
- * snarf src from <library> and its <subdir>s
- */
-
-NAME3D = lib_3d.h std_3d.h vcs_3d.h
-
-":lib:" : .MAKE .OPERATOR
-	local L
-	L := $(<:/-l//)
-	eval
-	_BLD_$(L) == 1
-	end
-	:: $(L)_3d.h
-	NAME3D += $(L)_3d.h
-	L := ../../$(VARIANTID:?../)lib/lib$(L)
-	.SOURCE.c : $(L:X=. $(>))
-	.SOURCE.features/% : $(L)
-
--last :lib: comp dir hash misc path port string tm
-
--lcs :lib:
-
--ldll :lib:
-
-terminal FEATURE/eaccess FEATURE/hack
-
-3d :TEST: 3d.tst
-	$(BINDIR)/3d $(SHELL) $(REGRESS) $(REGRESSFLAGS) $(*)
-
-:: sys.tab
-
-else
-
-:NOTHING:
-
-end

+ 0 - 1326
src/cmd/3d/Mamfile

@@ -1,1326 +0,0 @@
-info mam static 00000 1994-07-17 make (AT&T Research) 5.7 2012-06-20
-setv INSTALLROOT ../../..
-setv PACKAGE_ast_INCLUDE ${INSTALLROOT}/include/ast
-setv PACKAGE_ast_LIB ${INSTALLROOT}/lib
-setv PACKAGEROOT ../../../../..
-setv AR ${mam_cc_AR} ${mam_cc_AR_ARFLAGS}
-setv ARFLAGS rc
-setv AS as
-setv ASFLAGS
-setv CC cc
-setv mam_cc_FLAGS ${mam_cc_DLL}
-setv CCFLAGS ${-debug-symbols?1?${mam_cc_DEBUG} -D_BLD_DEBUG?${mam_cc_OPTIMIZE}?}
-setv CCLDFLAGS ${-strip-symbols?1?${mam_cc_LD_STRIP}??}
-setv COTEMP $$
-setv CPIO cpio
-setv CPIOFLAGS
-setv CPP "${CC} -E"
-setv F77 f77
-setv HOSTCC ${CC}
-setv IGNORE
-setv LD ld
-setv LDFLAGS
-setv LEX lex
-setv LEXFLAGS
-setv LPR lpr
-setv LPRFLAGS
-setv M4FLAGS
-setv NMAKE nmake
-setv NMAKEFLAGS
-setv PR pr
-setv PRFLAGS
-setv SHELL /bin/sh
-setv SILENT
-setv TAR tar
-setv YACC yacc
-setv YACCFLAGS -d
-make ${PACKAGEROOT}/lib/package/ast.lic
-done ${PACKAGEROOT}/lib/package/ast.lic
-make install
-make 3d
-make lib3d.a archive
-make 3d.req
-exec - set -
-exec - echo 'int main(){return 0;}' > 1.${COTEMP}.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -c 1.${COTEMP}.c &&
-exec - x=`${CC} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} -o 1.${COTEMP}.x 1.${COTEMP}.o -l'*' 2>&1 | sed -e 's/[][()+@?]/#/g' || :` &&
-exec - {
-exec - case "" in
-exec - *?) echo " " ;;
-exec - esac
-exec - for i in 3d dl
-exec - do case $i in
-exec - "3d"|3d)
-exec - ;;
-exec - *) if test -f ${INSTALLROOT}/lib/lib/$i
-exec - then y=`cat ${INSTALLROOT}/lib/lib/$i`
-exec - case $y in
-exec - *-?*) echo "" $y ;;
-exec - esac
-exec - continue
-exec - elif test ! -f ${INSTALLROOT}/lib/lib$i.a
-exec - then case `{ ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -L${INSTALLROOT}/lib ${LDFLAGS} -o 1.${COTEMP}.x 1.${COTEMP}.o -l$i 2>&1 || echo '' $x ;} | sed -e 's/[][()+@?]/#/g' || :` in
-exec - *$x*) case `{ ${CC} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} -o 1.${COTEMP}.x 1.${COTEMP}.o -l$i 2>&1 || echo '' $x ;} | sed -e 's/[][()+@?]/#/g' || :` in
-exec - *$x*) continue ;;
-exec - esac
-exec - ;;
-exec - esac
-exec - fi
-exec - ;;
-exec - esac
-exec - echo " -l$i"
-exec - done
-exec - } > 3d.req
-exec - rm -f 1.${COTEMP}.*
-done 3d.req generated
-make init.o
-make init.c
-make 3d.h implicit
-make std_3d.h implicit
-done std_3d.h dontcare
-make vcs_3d.h implicit
-done vcs_3d.h dontcare
-make FEATURE/syslib implicit
-meta FEATURE/syslib features/%>FEATURE/% features/syslib syslib
-make features/syslib
-done features/syslib
-bind -ldl dontcare
-bind -last
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} ' ref ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} -I${INSTALLROOT}/include ${mam_libdl} ${mam_libast} : run features/syslib
-done FEATURE/syslib dontcare generated
-make FEATURE/syscall implicit
-meta FEATURE/syscall features/%.sh>FEATURE/% features/syscall.sh syscall
-make features/syscall.sh
-make sys.tab implicit
-done sys.tab
-done features/syscall.sh
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} ' ref ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} -I${INSTALLROOT}/include ${mam_libdl} ${mam_libast} : run features/syscall.sh ${PACKAGEROOT}/src/cmd/3d/sys.tab
-done FEATURE/syscall dontcare generated
-make FEATURE/peek implicit
-meta FEATURE/peek features/%.c>FEATURE/% features/peek.c peek
-make features/peek.c
-make ${PACKAGE_ast_INCLUDE}/endian.h implicit
-make ${PACKAGE_ast_INCLUDE}/bytesex.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_map.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_map.h dontcare
-done ${PACKAGE_ast_INCLUDE}/ast_common.h dontcare
-done ${PACKAGE_ast_INCLUDE}/bytesex.h dontcare
-done ${PACKAGE_ast_INCLUDE}/endian.h dontcare
-make stropts.h implicit
-done stropts.h dontcare virtual
-make ${PACKAGE_ast_INCLUDE}/ast_tty.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_tty.h dontcare
-done features/peek.c
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I${PACKAGE_ast_INCLUDE} -D_BLD_ast ${LDFLAGS} ' ref ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} -I${INSTALLROOT}/include ${mam_libdl} ${mam_libast} : run features/peek.c
-done FEATURE/peek dontcare generated
-make ${INSTALLROOT}/src/lib/libcs/msg.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_api.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_api.h dontcare
-make ${PACKAGE_ast_INCLUDE}/vmalloc.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-make ${PACKAGE_ast_INCLUDE}/regex.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_api.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_wchar.h implicit
-make ${PACKAGE_ast_INCLUDE}/wctype.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_wctype.h implicit
-prev ${PACKAGE_ast_INCLUDE}/endian.h implicit
-make ${PACKAGE_ast_INCLUDE}/wchar.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_wchar.h implicit
-done ${PACKAGE_ast_INCLUDE}/wchar.h dontcare
-done ${PACKAGE_ast_INCLUDE}/ast_wctype.h dontcare
-done ${PACKAGE_ast_INCLUDE}/wctype.h dontcare
-make ${PACKAGE_ast_INCLUDE}/stdio.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_stdio.h implicit
-make ${PACKAGE_ast_INCLUDE}/sfio_s.h implicit
-done ${PACKAGE_ast_INCLUDE}/sfio_s.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_stdio.h dontcare
-done ${PACKAGE_ast_INCLUDE}/stdio.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/stdio.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_wchar.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
-make ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/prototyped.h dontcare
-done ${PACKAGE_ast_INCLUDE}/regex.h dontcare
-make ${PACKAGE_ast_INCLUDE}/getopt.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_getopt.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/getopt.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_map.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_botch.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_botch.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_limits.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_limits.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_fcntl.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_fs.h dontcare
-done ${PACKAGE_ast_INCLUDE}/ast_fcntl.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_sys.h implicit
-prev ${PACKAGE_ast_INCLUDE}/getopt.h implicit
-prev ${PACKAGE_ast_INCLUDE}/endian.h implicit
-prev ${PACKAGE_ast_INCLUDE}/endian.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_sys.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_lib.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_lib.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_std.h dontcare
-done ${PACKAGE_ast_INCLUDE}/vmalloc.h dontcare
-make ${PACKAGE_ast_INCLUDE}/sfio.h implicit
-prev ${PACKAGE_ast_INCLUDE}/sfio_s.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-done ${PACKAGE_ast_INCLUDE}/sfio.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast.h dontcare
-done ${INSTALLROOT}/src/lib/libcs/msg.h dontcare
-make ${PACKAGE_ast_INCLUDE}/fs3d.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/fs3d.h dontcare
-make ${PACKAGE_ast_INCLUDE}/dlldefs.h implicit
-done ${PACKAGE_ast_INCLUDE}/dlldefs.h dontcare
-make ${PACKAGE_ast_INCLUDE}/hashkey.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/hashkey.h dontcare
-make ${PACKAGE_ast_INCLUDE}/debug.h implicit
-make ${PACKAGE_ast_INCLUDE}/error.h implicit
-make ${PACKAGE_ast_INCLUDE}/option.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/option.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/error.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/debug.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
-make ${PACKAGE_ast_INCLUDE}/times.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_time.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_time.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/times.h dontcare
-make ${PACKAGE_ast_INCLUDE}/sig.h implicit
-done ${PACKAGE_ast_INCLUDE}/sig.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ls.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_mode.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_mode.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ls.h dontcare
-make lib_3d.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev std_3d.h implicit
-make dll_3d.h implicit
-prev ${PACKAGE_ast_INCLUDE}/dlldefs.h implicit
-prev lib_3d.h implicit
-done dll_3d.h dontcare
-make cs_3d.h implicit
-done cs_3d.h dontcare
-make ast_3d.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_lib.h implicit
-done ast_3d.h dontcare
-done lib_3d.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-done 3d.h
-done init.c
-meta init.o %.c>%.o init.c init
-prev init.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DIDNAME=\""3d"\" -DVCS -DFS -DDEBUG -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -c init.c
-done init.o generated
-make bio.o
-make bio.c
-prev 3d.h implicit
-done bio.c
-meta bio.o %.c>%.o bio.c bio
-prev bio.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c bio.c
-done bio.o generated
-make copy.o
-make copy.c
-prev 3d.h implicit
-done copy.c
-meta copy.o %.c>%.o copy.c copy
-prev copy.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c copy.c
-done copy.o generated
-make error.o
-make error.c
-prev 3d.h implicit
-done error.c
-meta error.o %.c>%.o error.c error
-prev error.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DDEBUG -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -c error.c
-done error.o generated
-make execv.o
-make execv.c
-prev 3d.h implicit
-done execv.c
-meta execv.o %.c>%.o execv.c execv
-prev execv.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c execv.c
-done execv.o generated
-make fs.o
-make fs.c
-make ${PACKAGE_ast_INCLUDE}/cs.h implicit
-prev ${PACKAGE_ast_INCLUDE}/times.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-make ${PACKAGE_ast_INCLUDE}/hashpart.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/hashpart.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_cs.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_cs.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/cs.h dontcare
-prev 3d.h implicit
-done fs.c
-meta fs.o %.c>%.o fs.c fs
-prev fs.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -DFS -DVCS -D_BLD_3d -D_BLD_dll -DDEBUG -c fs.c
-done fs.o generated
-make lib.o
-make lib.c
-prev ${PACKAGE_ast_INCLUDE}/cs.h implicit
-prev 3d.h implicit
-done lib.c
-meta lib.o %.c>%.o lib.c lib
-prev lib.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DDEBUG -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -DVCS -D_BLD_3d -D_BLD_dll -c lib.c
-done lib.o generated
-make map.o
-make map.c
-prev 3d.h implicit
-done map.c
-meta map.o %.c>%.o map.c map
-prev map.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DDEBUG_TABLE=0 -DPATHCHECK=\""3d"\" -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c map.c
-done map.o generated
-make pathcanon.o
-make pathcanon.c
-prev 3d.h implicit
-done pathcanon.c
-meta pathcanon.o %.c>%.o pathcanon.c pathcanon
-prev pathcanon.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c pathcanon.c
-done pathcanon.o generated
-make pathnext.o
-make pathnext.c
-prev 3d.h implicit
-done pathnext.c
-meta pathnext.o %.c>%.o pathnext.c pathnext
-prev pathnext.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c pathnext.c
-done pathnext.o generated
-make pathreal.o
-make pathreal.c
-prev 3d.h implicit
-done pathreal.c
-meta pathreal.o %.c>%.o pathreal.c pathreal
-prev pathreal.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -DDEBUG -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -c pathreal.c
-done pathreal.o generated
-make peek.o
-make peek.c
-prev ${PACKAGE_ast_INCLUDE}/cs.h implicit
-prev 3d.h implicit
-done peek.c
-meta peek.o %.c>%.o peek.c peek
-prev peek.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -DVCS -DFS -D_BLD_3d -D_BLD_dll -DDEBUG -c peek.c
-done peek.o generated
-make ast.o
-make ast.c
-make ${INSTALLROOT}/src/lib/libast/comp/gross.c implicit
-make ${INSTALLROOT}/src/lib/libast/comp/gross_sgi.h implicit
-make locale_attr.h implicit
-done locale_attr.h dontcare virtual
-done ${INSTALLROOT}/src/lib/libast/comp/gross_sgi.h dontcare
-make ../../lib/libast/FEATURE/hack implicit
-done ../../lib/libast/FEATURE/hack
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/comp/gross.c
-make ${INSTALLROOT}/src/lib/libast/comp/spawnveg.c implicit
-make ${PACKAGE_ast_INCLUDE}/ast_vfork.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_vfork.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_tty.h implicit
-prev ${PACKAGE_ast_INCLUDE}/sig.h implicit
-make process.h implicit
-done process.h dontcare virtual
-make ${PACKAGE_ast_INCLUDE}/wait.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_wait.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_wait.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/wait.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/comp/spawnveg.c
-make ${INSTALLROOT}/src/lib/libast/path/pathshell.c implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/path/pathshell.c
-make ${INSTALLROOT}/src/lib/libast/comp/waitpid.c implicit
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
-prev ${PACKAGE_ast_INCLUDE}/sig.h implicit
-prev ${PACKAGE_ast_INCLUDE}/wait.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/comp/waitpid.c
-make ${INSTALLROOT}/src/lib/libast/misc/sigcrit.c implicit
-prev ${PACKAGE_ast_INCLUDE}/sig.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/misc/sigcrit.c
-make strmatch.c implicit
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
-prev ${PACKAGE_ast_INCLUDE}/wctype.h implicit
-prev ${PACKAGE_ast_INCLUDE}/wchar.h implicit
-prev ${PACKAGE_ast_INCLUDE}/stdio.h implicit
-prev ${PACKAGE_ast_INCLUDE}/hashkey.h implicit
-prev ${PACKAGE_ast_INCLUDE}/endian.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done strmatch.c
-make touch.c implicit
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
-prev ${PACKAGE_ast_INCLUDE}/times.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done touch.c dontcare
-make ${INSTALLROOT}/src/lib/libast/string/tokscan.c implicit
-make ${PACKAGE_ast_INCLUDE}/tok.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/tok.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/string/tokscan.c dontcare
-make ${INSTALLROOT}/src/lib/libast/path/pathtmp.c implicit
-prev ${PACKAGE_ast_INCLUDE}/stdio.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/path/pathtmp.c dontcare
-make ${INSTALLROOT}/src/lib/libast/path/pathtemp.c implicit
-make ${PACKAGE_ast_INCLUDE}/tm.h implicit
-prev ${PACKAGE_ast_INCLUDE}/times.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/tm.h dontcare
-make ${PACKAGE_ast_INCLUDE}/tv.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${PACKAGE_ast_INCLUDE}/tv.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/path/pathtemp.c dontcare
-make ${INSTALLROOT}/src/lib/libast/path/pathcat.c implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_api.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/path/pathcat.c dontcare
-make ${INSTALLROOT}/src/lib/libast/comp/eaccess.c implicit
-make ../../lib/libast/FEATURE/eaccess implicit
-done ../../lib/libast/FEATURE/eaccess dontcare
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/comp/eaccess.c dontcare
-make ${INSTALLROOT}/src/lib/libast/tm/tvgettime.c implicit
-make FEATURE/tvlib implicit
-meta FEATURE/tvlib features/%>FEATURE/% ${INSTALLROOT}/src/lib/libast/features/tvlib tvlib
-make ${INSTALLROOT}/src/lib/libast/features/tvlib
-done ${INSTALLROOT}/src/lib/libast/features/tvlib
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} ' ref ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} -I${INSTALLROOT}/include ${mam_libdl} ${mam_libast} : run ${INSTALLROOT}/src/lib/libast/features/tvlib
-done FEATURE/tvlib dontcare generated
-prev ${PACKAGE_ast_INCLUDE}/tm.h implicit
-prev ${PACKAGE_ast_INCLUDE}/tv.h implicit
-done ${INSTALLROOT}/src/lib/libast/tm/tvgettime.c dontcare
-make ${INSTALLROOT}/src/lib/libast/string/fmterror.c implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/string/fmterror.c dontcare
-make ${INSTALLROOT}/src/lib/libast/comp/memset.c implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/comp/memset.c
-make ${INSTALLROOT}/src/lib/libast/hash/hashwalk.c implicit
-make ${INSTALLROOT}/src/lib/libast/hash/hashlib.h implicit
-make ${PACKAGE_ast_INCLUDE}/hash.h implicit
-prev ${PACKAGE_ast_INCLUDE}/hashpart.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/hash.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/hash/hashlib.h
-done ${INSTALLROOT}/src/lib/libast/hash/hashwalk.c
-make ${INSTALLROOT}/src/lib/libast/hash/hashsize.c implicit
-prev ${INSTALLROOT}/src/lib/libast/hash/hashlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/hash/hashsize.c
-make ${INSTALLROOT}/src/lib/libast/hash/hashscan.c implicit
-prev ${INSTALLROOT}/src/lib/libast/hash/hashlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/hash/hashscan.c
-make ${INSTALLROOT}/src/lib/libast/hash/hashlook.c implicit
-prev ${INSTALLROOT}/src/lib/libast/hash/hashlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/hash/hashlook.c
-make ${INSTALLROOT}/src/lib/libast/hash/hashfree.c implicit
-prev ${INSTALLROOT}/src/lib/libast/hash/hashlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/hash/hashfree.c
-make ${INSTALLROOT}/src/lib/libast/hash/hashalloc.c implicit
-prev ${INSTALLROOT}/src/lib/libast/hash/hashlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/hash/hashalloc.c
-make ${INSTALLROOT}/src/lib/libast/comp/getwd.c implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/comp/getwd.c
-make ${INSTALLROOT}/src/lib/libast/misc/getcwd.c implicit
-prev ${PACKAGE_ast_INCLUDE}/fs3d.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_dir.h implicit
-make ${PACKAGE_ast_INCLUDE}/dirent.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_dirent.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_dirent.h dontcare
-done ${PACKAGE_ast_INCLUDE}/dirent.h dontcare
-make ${INSTALLROOT}/src/lib/libast/dir/dirlib.h implicit
-make ${INSTALLROOT}/src/lib/libast/dir/dirstd.h implicit
-done ${INSTALLROOT}/src/lib/libast/dir/dirstd.h dontcare
-make direntry.h implicit
-done direntry.h dontcare virtual
-make ${PACKAGE_ast_INCLUDE}/ast_param.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_param.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/dirent.h implicit
-make ndir.h implicit
-done ndir.h dontcare virtual
-prev ${PACKAGE_ast_INCLUDE}/dirent.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/dir/dirlib.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_lib.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_dir.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
-prev FEATURE/syscall implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/misc/getcwd.c
-make ${INSTALLROOT}/src/lib/libast/misc/setenviron.c implicit
-prev ${PACKAGE_ast_INCLUDE}/fs3d.h implicit
-make ${INSTALLROOT}/src/lib/libast/misc/intercepts.h implicit
-make ${PACKAGE_ast_INCLUDE}/shcmd.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/shcmd.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/misc/intercepts.h
-done ${INSTALLROOT}/src/lib/libast/misc/setenviron.c
-make ${INSTALLROOT}/src/lib/libast/misc/getenv.c implicit
-make windows.h implicit
-done windows.h dontcare virtual
-prev ${INSTALLROOT}/src/lib/libast/misc/intercepts.h implicit
-done ${INSTALLROOT}/src/lib/libast/misc/getenv.c
-make ${INSTALLROOT}/src/lib/libast/misc/astintercept.c implicit
-prev ${INSTALLROOT}/src/lib/libast/misc/intercepts.h implicit
-done ${INSTALLROOT}/src/lib/libast/misc/astintercept.c
-make ${INSTALLROOT}/src/lib/libast/misc/state.c implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libast/misc/state.c
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev 3d.h implicit
-done ast.c
-meta ast.o %.c>%.o ast.c ast
-prev ast.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I../../lib/libast -I${PACKAGE_ast_INCLUDE} -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -DFS -DDEBUG -DVCS -D_BLD_cs -D_BLD_dll -c ast.c
-done ast.o generated
-make cs.o
-make cs.c
-make ${INSTALLROOT}/src/lib/libcs/msgsetmask.c implicit
-make ${INSTALLROOT}/src/lib/libcs/msglib.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_dir.h implicit
-prev ${INSTALLROOT}/src/lib/libcs/msg.h implicit
-make ../../lib/libcs/cs_lib.h implicit
-done ../../lib/libcs/cs_lib.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libcs/msglib.h
-done ${INSTALLROOT}/src/lib/libcs/msgsetmask.c
-make ${INSTALLROOT}/src/lib/libcs/msgname.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/msglib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/msgname.c
-make ${INSTALLROOT}/src/lib/libcs/msginfo.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/msglib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/msginfo.c
-make ${INSTALLROOT}/src/lib/libcs/msgindex.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/msglib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/msgindex.c
-make ${INSTALLROOT}/src/lib/libcs/msggetmask.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/msglib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/msggetmask.c
-make ${INSTALLROOT}/src/lib/libcs/cspoll.c implicit
-make ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-prev stropts.h implicit
-prev ${PACKAGE_ast_INCLUDE}/endian.h implicit
-prev ../../lib/libcs/cs_lib.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_tty.h implicit
-prev ${PACKAGE_ast_INCLUDE}/tok.h implicit
-prev ${PACKAGE_ast_INCLUDE}/sig.h implicit
-prev ${PACKAGE_ast_INCLUDE}/debug.h implicit
-prev ${PACKAGE_ast_INCLUDE}/cs.h implicit
-done ${INSTALLROOT}/src/lib/libcs/cslib.h dontcare
-done ${INSTALLROOT}/src/lib/libcs/cspoll.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/cspipe.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/cspipe.c
-make ${INSTALLROOT}/src/lib/libcs/cspeek.c implicit
-prev stropts.h implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/cspeek.c
-make ${INSTALLROOT}/src/lib/libcs/msguser.c implicit
-prev ${PACKAGE_ast_INCLUDE}/cs.h implicit
-prev ${INSTALLROOT}/src/lib/libcs/msglib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/msguser.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/msgread.c implicit
-prev ${PACKAGE_ast_INCLUDE}/cs.h implicit
-prev ${INSTALLROOT}/src/lib/libcs/msglib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/msgread.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/msgbuf.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/msglib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/msgbuf.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/cswrite.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/cswrite.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/csvar.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/csvar.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/cssend.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/cssend.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/csrecv.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/csrecv.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/csread.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/csread.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/csntoa.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/csntoa.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/csname.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/csname.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/cslocal.c implicit
-prev ${PACKAGE_ast_INCLUDE}/wait.h implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/cslocal.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/csbind.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/csbind.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/csauth.c implicit
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/csauth.c dontcare
-make ${INSTALLROOT}/src/lib/libcs/csdata.c implicit
-prev ${INSTALLROOT}/src/lib/libcs/cslib.h implicit
-done ${INSTALLROOT}/src/lib/libcs/csdata.c dontcare
-prev 3d.h implicit
-done cs.c
-meta cs.o %.c>%.o cs.c cs
-prev cs.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I../../lib/libcs -I${PACKAGE_ast_INCLUDE} -D_BLD_ast -D_BLD_3d -D_PACKAGE_ast -D_BLD_cs -DDEBUG -DFS -DVCS -D_BLD_dll -c cs.c
-done cs.o generated
-make license.o
-make license.c
-prev ${INSTALLROOT}/src/lib/libast/string/tokscan.c implicit
-prev 3d.h implicit
-done license.c
-meta license.o %.c>%.o license.c license
-prev license.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -D_BLD_ast -D_PACKAGE_ast -DVCS -DFS -D_BLD_cs -D_BLD_3d -D_BLD_dll -DDEBUG -c license.c
-done license.o generated
-make vcs.o
-make vcs.c
-prev 3d.h implicit
-done vcs.c
-meta vcs.o %.c>%.o vcs.c vcs
-prev vcs.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c vcs.c
-done vcs.o generated
-make access3d.o
-make access3d.c
-prev 3d.h implicit
-done access3d.c
-meta access3d.o %.c>%.o access3d.c access3d
-prev access3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c access3d.c
-done access3d.o generated
-make brk3d.o
-make brk3d.c
-prev 3d.h implicit
-done brk3d.c
-meta brk3d.o %.c>%.o brk3d.c brk3d
-prev brk3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c brk3d.c
-done brk3d.o generated
-make chdir3d.o
-make chdir3d.c
-prev 3d.h implicit
-done chdir3d.c
-meta chdir3d.o %.c>%.o chdir3d.c chdir3d
-prev chdir3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c chdir3d.c
-done chdir3d.o generated
-make chmod3d.o
-make chmod3d.c
-prev FEATURE/syscall implicit
-prev 3d.h implicit
-done chmod3d.c
-meta chmod3d.o %.c>%.o chmod3d.c chmod3d
-prev chmod3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c chmod3d.c
-done chmod3d.o generated
-make chown3d.o
-make chown3d.c
-prev 3d.h implicit
-done chown3d.c
-meta chown3d.o %.c>%.o chown3d.c chown3d
-prev chown3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c chown3d.c
-done chown3d.o generated
-make close3d.o
-make close3d.c
-prev 3d.h implicit
-done close3d.c
-meta close3d.o %.c>%.o close3d.c close3d
-prev close3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c close3d.c
-done close3d.o generated
-make creat3d.o
-make creat3d.c
-prev 3d.h implicit
-done creat3d.c
-meta creat3d.o %.c>%.o creat3d.c creat3d
-prev creat3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c creat3d.c
-done creat3d.o generated
-make dir3d.o
-make dir3d.c
-make ${INSTALLROOT}/src/lib/libast/dir/seekdir.c implicit
-prev ${INSTALLROOT}/src/lib/libast/dir/dirlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/dir/seekdir.c dontcare
-make ${INSTALLROOT}/src/lib/libast/dir/telldir.c implicit
-prev ${INSTALLROOT}/src/lib/libast/dir/dirlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/dir/telldir.c dontcare
-make ${INSTALLROOT}/src/lib/libast/dir/readdir.c implicit
-prev ${INSTALLROOT}/src/lib/libast/dir/dirlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/dir/readdir.c dontcare
-make ${INSTALLROOT}/src/lib/libast/dir/opendir.c implicit
-prev ${INSTALLROOT}/src/lib/libast/dir/dirlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/dir/opendir.c dontcare
-make ${INSTALLROOT}/src/lib/libast/dir/getdents.c implicit
-prev ${INSTALLROOT}/src/lib/libast/dir/dirlib.h implicit
-done ${INSTALLROOT}/src/lib/libast/dir/getdents.c dontcare
-prev ${INSTALLROOT}/src/lib/libast/dir/dirlib.h implicit
-make dir_3d.h implicit
-prev ${PACKAGE_ast_INCLUDE}/hash.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_dir.h implicit
-prev 3d.h implicit
-done dir_3d.h
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-done dir3d.c
-meta dir3d.o %.c>%.o dir3d.c dir3d
-prev dir3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -D_BLD_3d -D_BLD_ast -D_PACKAGE_ast -DVCS -DFS -D_BLD_cs -D_BLD_dll -DDEBUG -c dir3d.c
-done dir3d.o generated
-make dup23d.o
-make dup23d.c
-prev 3d.h implicit
-done dup23d.c
-meta dup23d.o %.c>%.o dup23d.c dup23d
-prev dup23d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c dup23d.c
-done dup23d.o generated
-make dup3d.o
-make dup3d.c
-prev 3d.h implicit
-done dup3d.c
-meta dup3d.o %.c>%.o dup3d.c dup3d
-prev dup3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c dup3d.c
-done dup3d.o generated
-make execve3d.o
-make execve3d.c
-prev 3d.h implicit
-done execve3d.c
-meta execve3d.o %.c>%.o execve3d.c execve3d
-prev execve3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c execve3d.c
-done execve3d.o generated
-make exit3d.o
-make exit3d.c
-prev 3d.h implicit
-done exit3d.c
-meta exit3d.o %.c>%.o exit3d.c exit3d
-prev exit3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c exit3d.c
-done exit3d.o generated
-make fchdir3d.o
-make fchdir3d.c
-prev 3d.h implicit
-done fchdir3d.c
-meta fchdir3d.o %.c>%.o fchdir3d.c fchdir3d
-prev fchdir3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c fchdir3d.c
-done fchdir3d.o generated
-make fchmod3d.o
-make fchmod3d.c
-prev 3d.h implicit
-done fchmod3d.c
-meta fchmod3d.o %.c>%.o fchmod3d.c fchmod3d
-prev fchmod3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c fchmod3d.c
-done fchmod3d.o generated
-make fchown3d.o
-make fchown3d.c
-prev 3d.h implicit
-done fchown3d.c
-meta fchown3d.o %.c>%.o fchown3d.c fchown3d
-prev fchown3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c fchown3d.c
-done fchown3d.o generated
-make fcntl3d.o
-make fcntl3d.c
-prev 3d.h implicit
-done fcntl3d.c
-meta fcntl3d.o %.c>%.o fcntl3d.c fcntl3d
-prev fcntl3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c fcntl3d.c
-done fcntl3d.o generated
-make fork3d.o
-make fork3d.c
-prev ${PACKAGE_ast_INCLUDE}/cs.h implicit
-prev 3d.h implicit
-done fork3d.c
-meta fork3d.o %.c>%.o fork3d.c fork3d
-prev fork3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -DFS -DVCS -D_BLD_3d -D_BLD_dll -DDEBUG -c fork3d.c
-done fork3d.o generated
-make fpathconf3d.o
-make fpathconf3d.c
-prev 3d.h implicit
-done fpathconf3d.c
-meta fpathconf3d.o %.c>%.o fpathconf3d.c fpathconf3d
-prev fpathconf3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c fpathconf3d.c
-done fpathconf3d.o generated
-make fstat3d.o
-make fstat3d.c
-prev FEATURE/syscall implicit
-prev 3d.h implicit
-done fstat3d.c
-meta fstat3d.o %.c>%.o fstat3d.c fstat3d
-prev fstat3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c fstat3d.c
-done fstat3d.o generated
-make fstatfs3d.o
-make fstatfs3d.c
-prev FEATURE/syscall implicit
-prev ../../lib/libcs/cs_lib.h implicit
-prev 3d.h implicit
-done fstatfs3d.c
-meta fstatfs3d.o %.c>%.o fstatfs3d.c fstatfs3d
-prev fstatfs3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I../../lib/libcs -I${PACKAGE_ast_INCLUDE} -DFS -D_BLD_ast -DVCS -D_BLD_cs -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c fstatfs3d.c
-done fstatfs3d.o generated
-make fstatvfs3d.o
-make fstatvfs3d.c
-prev 3d.h implicit
-done fstatvfs3d.c
-meta fstatvfs3d.o %.c>%.o fstatvfs3d.c fstatvfs3d
-prev fstatvfs3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c fstatvfs3d.c
-done fstatvfs3d.o generated
-make fsync3d.o
-make fsync3d.c
-prev 3d.h implicit
-done fsync3d.c
-meta fsync3d.o %.c>%.o fsync3d.c fsync3d
-prev fsync3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c fsync3d.c
-done fsync3d.o generated
-make ftruncate3d.o
-make ftruncate3d.c
-prev 3d.h implicit
-done ftruncate3d.c
-meta ftruncate3d.o %.c>%.o ftruncate3d.c ftruncate3d
-prev ftruncate3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c ftruncate3d.c
-done ftruncate3d.o generated
-make getdents3d.o
-make getdents3d.c
-prev 3d.h implicit
-done getdents3d.c
-meta getdents3d.o %.c>%.o getdents3d.c getdents3d
-prev getdents3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c getdents3d.c
-done getdents3d.o generated
-make kill3d.o
-make kill3d.c
-prev 3d.h implicit
-done kill3d.c
-meta kill3d.o %.c>%.o kill3d.c kill3d
-prev kill3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c kill3d.c
-done kill3d.o generated
-make link3d.o
-make link3d.c
-prev 3d.h implicit
-done link3d.c
-meta link3d.o %.c>%.o link3d.c link3d
-prev link3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c link3d.c
-done link3d.o generated
-make lseek3d.o
-make lseek3d.c
-prev FEATURE/syscall implicit
-prev 3d.h implicit
-done lseek3d.c
-meta lseek3d.o %.c>%.o lseek3d.c lseek3d
-prev lseek3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c lseek3d.c
-done lseek3d.o generated
-make lstat3d.o
-make lstat3d.c
-prev 3d.h implicit
-done lstat3d.c
-meta lstat3d.o %.c>%.o lstat3d.c lstat3d
-prev lstat3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c lstat3d.c
-done lstat3d.o generated
-make mkdir3d.o
-make mkdir3d.c
-prev FEATURE/syscall implicit
-prev 3d.h implicit
-done mkdir3d.c
-meta mkdir3d.o %.c>%.o mkdir3d.c mkdir3d
-prev mkdir3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c mkdir3d.c
-done mkdir3d.o generated
-make mknod3d.o
-make mknod3d.c
-prev FEATURE/syscall implicit
-prev 3d.h implicit
-done mknod3d.c
-meta mknod3d.o %.c>%.o mknod3d.c mknod3d
-prev mknod3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c mknod3d.c
-done mknod3d.o generated
-make mount3d.o
-make mount3d.c
-prev 3d.h implicit
-done mount3d.c
-meta mount3d.o %.c>%.o mount3d.c mount3d
-prev mount3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c mount3d.c
-done mount3d.o generated
-make open3d.o
-make open3d.c
-prev 3d.h implicit
-done open3d.c
-meta open3d.o %.c>%.o open3d.c open3d
-prev open3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DVCS -DFS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c open3d.c
-done open3d.o generated
-make pathconf3d.o
-make pathconf3d.c
-prev 3d.h implicit
-done pathconf3d.c
-meta pathconf3d.o %.c>%.o pathconf3d.c pathconf3d
-prev pathconf3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c pathconf3d.c
-done pathconf3d.o generated
-make pipe3d.o
-make pipe3d.c
-prev 3d.h implicit
-done pipe3d.c
-meta pipe3d.o %.c>%.o pipe3d.c pipe3d
-prev pipe3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c pipe3d.c
-done pipe3d.o generated
-make read3d.o
-make read3d.c
-prev 3d.h implicit
-done read3d.c
-meta read3d.o %.c>%.o read3d.c read3d
-prev read3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c read3d.c
-done read3d.o generated
-make readlink3d.o
-make readlink3d.c
-prev 3d.h implicit
-done readlink3d.c
-meta readlink3d.o %.c>%.o readlink3d.c readlink3d
-prev readlink3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c readlink3d.c
-done readlink3d.o generated
-make rename3d.o
-make rename3d.c
-prev 3d.h implicit
-done rename3d.c
-meta rename3d.o %.c>%.o rename3d.c rename3d
-prev rename3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c rename3d.c
-done rename3d.o generated
-make rmdir3d.o
-make rmdir3d.c
-prev dir_3d.h implicit
-prev 3d.h implicit
-done rmdir3d.c
-meta rmdir3d.o %.c>%.o rmdir3d.c rmdir3d
-prev rmdir3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -D_BLD_ast -D_BLD_3d -D_PACKAGE_ast -DVCS -D_BLD_cs -D_BLD_dll -DDEBUG -c rmdir3d.c
-done rmdir3d.o generated
-make sbrk3d.o
-make sbrk3d.c
-prev 3d.h implicit
-done sbrk3d.c
-meta sbrk3d.o %.c>%.o sbrk3d.c sbrk3d
-prev sbrk3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c sbrk3d.c
-done sbrk3d.o generated
-make stat3d.o
-make stat3d.c
-prev 3d.h implicit
-done stat3d.c
-meta stat3d.o %.c>%.o stat3d.c stat3d
-prev stat3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c stat3d.c
-done stat3d.o generated
-make statfs3d.o
-make statfs3d.c
-prev FEATURE/syscall implicit
-prev ../../lib/libcs/cs_lib.h implicit
-prev 3d.h implicit
-done statfs3d.c
-meta statfs3d.o %.c>%.o statfs3d.c statfs3d
-prev statfs3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I../../lib/libcs -I${PACKAGE_ast_INCLUDE} -DFS -D_BLD_ast -DVCS -D_BLD_cs -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c statfs3d.c
-done statfs3d.o generated
-make statvfs3d.o
-make statvfs3d.c
-prev 3d.h implicit
-done statvfs3d.c
-meta statvfs3d.o %.c>%.o statvfs3d.c statvfs3d
-prev statvfs3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c statvfs3d.c
-done statvfs3d.o generated
-make symlink3d.o
-make symlink3d.c
-prev 3d.h implicit
-done symlink3d.c
-meta symlink3d.o %.c>%.o symlink3d.c symlink3d
-prev symlink3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c symlink3d.c
-done symlink3d.o generated
-make syscall3d.o
-make syscall3d.c
-prev dir_3d.h implicit
-prev 3d.h implicit
-done syscall3d.c
-meta syscall3d.o %.c>%.o syscall3d.c syscall3d
-prev syscall3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -D_BLD_ast -D_BLD_3d -D_PACKAGE_ast -DVCS -DFS -D_BLD_cs -D_BLD_dll -DDEBUG -c syscall3d.c
-done syscall3d.o generated
-make sysent3d.o
-make sysent3d.c
-prev FEATURE/syscall implicit
-done sysent3d.c
-meta sysent3d.o %.c>%.o sysent3d.c sysent3d
-prev sysent3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -D_BLD_ast -c sysent3d.c
-done sysent3d.o generated
-make truncate3d.o
-make truncate3d.c
-prev 3d.h implicit
-done truncate3d.c
-meta truncate3d.o %.c>%.o truncate3d.c truncate3d
-prev truncate3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c truncate3d.c
-done truncate3d.o generated
-make unlink3d.o
-make unlink3d.c
-prev 3d.h implicit
-done unlink3d.c
-meta unlink3d.o %.c>%.o unlink3d.c unlink3d
-prev unlink3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c unlink3d.c
-done unlink3d.o generated
-make utime3d.o
-make utime3d.c
-prev FEATURE/syscall implicit
-prev 3d.h implicit
-done utime3d.c
-meta utime3d.o %.c>%.o utime3d.c utime3d
-prev utime3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c utime3d.c
-done utime3d.o generated
-make utimes3d.o
-make utimes3d.c
-prev 3d.h implicit
-done utimes3d.c
-meta utimes3d.o %.c>%.o utimes3d.c utimes3d
-prev utimes3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c utimes3d.c
-done utimes3d.o generated
-make utimets3d.o
-make utimets3d.c
-prev 3d.h implicit
-done utimets3d.c
-meta utimets3d.o %.c>%.o utimets3d.c utimets3d
-prev utimets3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c utimets3d.c
-done utimets3d.o generated
-make vfork3d.o
-make vfork3d.c
-prev ${PACKAGE_ast_INCLUDE}/ast_lib.h implicit
-done vfork3d.c
-meta vfork3d.o %.c>%.o vfork3d.c vfork3d
-prev vfork3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I${PACKAGE_ast_INCLUDE} -c vfork3d.c
-done vfork3d.o generated
-make write3d.o
-make write3d.c
-prev 3d.h implicit
-done write3d.c
-meta write3d.o %.c>%.o write3d.c write3d
-prev write3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c write3d.c
-done write3d.o generated
-make acl3d.o
-make acl3d.c
-prev 3d.h implicit
-done acl3d.c
-meta acl3d.o %.c>%.o acl3d.c acl3d
-prev acl3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c acl3d.c
-done acl3d.o generated
-make facl3d.o
-make facl3d.c
-prev 3d.h implicit
-done facl3d.c
-meta facl3d.o %.c>%.o facl3d.c facl3d
-prev facl3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c facl3d.c
-done facl3d.o generated
-make dll3d.o
-make dll3d.c
-make ${INSTALLROOT}/src/lib/libdll/dlfcn.c implicit
-make dll.h implicit
-done dll.h dontcare virtual
-make xcoff.h implicit
-done xcoff.h dontcare virtual
-make dl.h implicit
-done dl.h dontcare virtual
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
-prev ${PACKAGE_ast_INCLUDE}/dlldefs.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libdll/dlfcn.c
-make ${INSTALLROOT}/src/lib/libdll/dllnext.c implicit
-make rld_interface.h implicit
-done rld_interface.h dontcare virtual
-prev ${PACKAGE_ast_INCLUDE}/dlldefs.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done ${INSTALLROOT}/src/lib/libdll/dllnext.c
-prev dll_3d.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-done dll3d.c
-meta dll3d.o %.c>%.o dll3d.c dll3d
-prev dll3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -D_BLD_dll -D_BLD_ast -D_PACKAGE_ast -DDEBUG -c dll3d.c
-done dll3d.o generated
-make utimensat3d.o
-make utimensat3d.c
-prev 3d.h implicit
-done utimensat3d.c
-meta utimensat3d.o %.c>%.o utimensat3d.c utimensat3d
-prev utimensat3d.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DFS -DVCS -D_BLD_cs -D_BLD_ast -D_PACKAGE_ast -D_BLD_3d -D_BLD_dll -DDEBUG -c utimensat3d.c
-done utimensat3d.o generated
-exec - ${AR} rc lib3d.a init.o bio.o copy.o error.o execv.o fs.o lib.o map.o pathcanon.o pathnext.o pathreal.o peek.o ast.o cs.o license.o vcs.o access3d.o brk3d.o chdir3d.o chmod3d.o chown3d.o close3d.o creat3d.o dir3d.o dup23d.o dup3d.o execve3d.o exit3d.o fchdir3d.o fchmod3d.o
-exec - ${AR} rc lib3d.a fchown3d.o fcntl3d.o fork3d.o fpathconf3d.o fstat3d.o fstatfs3d.o fstatvfs3d.o fsync3d.o ftruncate3d.o getdents3d.o kill3d.o link3d.o lseek3d.o lstat3d.o mkdir3d.o mknod3d.o mount3d.o open3d.o pathconf3d.o pipe3d.o read3d.o readlink3d.o rename3d.o rmdir3d.o sbrk3d.o stat3d.o statfs3d.o statvfs3d.o symlink3d.o syscall3d.o sysent3d.o truncate3d.o unlink3d.o utime3d.o utimes3d.o utimets3d.o vfork3d.o write3d.o acl3d.o facl3d.o dll3d.o utimensat3d.o
-exec - (ranlib lib3d.a) >/dev/null 2>&1 || true
-done lib3d.a generated
-make 3d.sh
-done 3d.sh
-meta 3d %.sh>% 3d.sh 3d
-prev 3d.sh
-exec - case static,port:$OPTIND:$RANDOM in
-exec - ?*:*:*|*::*|*:*:$RANDOM)
-exec - ;;
-exec - *) if ENV= LC_ALL=C x= $SHELL -nc '[[ a || b ]] && : ${list[level]}  !(pattern)' 2>/dev/null
-exec - then if grep '### .*archaic.* ###' >/dev/null
-exec - then : 3d contains archaic constructs :
-exec - else ENV= LC_ALL=C $SHELL -n 3d.sh
-exec - fi
-exec - fi
-exec - ;;
-exec - esac
-exec - case '${mam_cc_SHELLMAGIC}' in
-exec - "") case 386 in
-exec - 0) cp 3d.sh 3d
-exec - ;;
-exec - *) {
-exec - i=`(read x; echo $x) < 3d.sh`
-exec - case $i in
-exec - '#!'*|*'||'*|':'*|'":"'*|"':'"*) echo "$i" ;;
-exec - esac
-exec - cat - 3d.sh <<'!'
-exec - USAGE_LICENSE="[-author?Glenn Fowler <gsf@research.att.com>][-author?David Korn <dgk@research.att.com>][-author?Eduardo Krell <ekrell@adexus.cl>][-copyright?Copyright (c) 1989-2012 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html]" IDNAME="3d" VCS=1 FS=1 DEBUG=1 _BLD_cs=1 _BLD_ast=1 _PACKAGE_ast=1 _BLD_3d=1 _BLD_dll=1 DEBUG_TABLE=0 PATHCHECK="3d"
-exec - !
-exec - } > 3d
-exec - ;;
-exec - esac
-exec - ;;
-exec - *) cat - 3d.sh > 3d <<'!'
-exec - ${mam_cc_SHELLMAGIC}
-exec - USAGE_LICENSE="[-author?Glenn Fowler <gsf@research.att.com>][-author?David Korn <dgk@research.att.com>][-author?Eduardo Krell <ekrell@adexus.cl>][-copyright?Copyright (c) 1989-2012 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html]" IDNAME="3d" VCS=1 FS=1 DEBUG=1 _BLD_cs=1 _BLD_ast=1 _PACKAGE_ast=1 _BLD_3d=1 _BLD_dll=1 DEBUG_TABLE=0 PATHCHECK="3d"
-exec - !
-exec - ;;
-exec - esac
-exec - silent test -w 3d -a -x 3d || chmod u+w,+x 3d
-done 3d generated
-prev lib3d.a archive
-make opaque
-make opaque.sh
-done opaque.sh
-meta opaque %.sh>% opaque.sh opaque
-prev opaque.sh
-exec - case static,port:$OPTIND:$RANDOM in
-exec - ?*:*:*|*::*|*:*:$RANDOM)
-exec - ;;
-exec - *) if ENV= LC_ALL=C x= $SHELL -nc '[[ a || b ]] && : ${list[level]}  !(pattern)' 2>/dev/null
-exec - then if grep '### .*archaic.* ###' >/dev/null
-exec - then : opaque contains archaic constructs :
-exec - else ENV= LC_ALL=C $SHELL -n opaque.sh
-exec - fi
-exec - fi
-exec - ;;
-exec - esac
-exec - case '${mam_cc_SHELLMAGIC}' in
-exec - "") case 0 in
-exec - 0) cp opaque.sh opaque
-exec - ;;
-exec - *) {
-exec - i=`(read x; echo $x) < opaque.sh`
-exec - case $i in
-exec - '#!'*|*'||'*|':'*|'":"'*|"':'"*) echo "$i" ;;
-exec - esac
-exec - cat - opaque.sh <<'!'
-exec -
-exec - !
-exec - } > opaque
-exec - ;;
-exec - esac
-exec - ;;
-exec - *) cat - opaque.sh > opaque <<'!'
-exec - ${mam_cc_SHELLMAGIC}
-exec -
-exec - !
-exec - ;;
-exec - esac
-exec - silent test -w opaque -a -x opaque || chmod u+w,+x opaque
-done opaque generated
-make vex
-make vex.sh
-done vex.sh
-meta vex %.sh>% vex.sh vex
-prev vex.sh
-exec - case static,port:$OPTIND:$RANDOM in
-exec - ?*:*:*|*::*|*:*:$RANDOM)
-exec - ;;
-exec - *) if ENV= LC_ALL=C x= $SHELL -nc '[[ a || b ]] && : ${list[level]}  !(pattern)' 2>/dev/null
-exec - then if grep '### .*archaic.* ###' >/dev/null
-exec - then : vex contains archaic constructs :
-exec - else ENV= LC_ALL=C $SHELL -n vex.sh
-exec - fi
-exec - fi
-exec - ;;
-exec - esac
-exec - case '${mam_cc_SHELLMAGIC}' in
-exec - "") case 0 in
-exec - 0) cp vex.sh vex
-exec - ;;
-exec - *) {
-exec - i=`(read x; echo $x) < vex.sh`
-exec - case $i in
-exec - '#!'*|*'||'*|':'*|'":"'*|"':'"*) echo "$i" ;;
-exec - esac
-exec - cat - vex.sh <<'!'
-exec -
-exec - !
-exec - } > vex
-exec - ;;
-exec - esac
-exec - ;;
-exec - *) cat - vex.sh > vex <<'!'
-exec - ${mam_cc_SHELLMAGIC}
-exec -
-exec - !
-exec - ;;
-exec - esac
-exec - silent test -w vex -a -x vex || chmod u+w,+x vex
-done vex generated
-make ${INSTALLROOT}/lib
-exec - if silent test ! -d ${INSTALLROOT}/lib
-exec - then mkdir -p ${INSTALLROOT}/lib
-exec - fi
-done ${INSTALLROOT}/lib generated
-make ${INSTALLROOT}/lib/lib3d.a archive
-prev ${INSTALLROOT}/lib
-prev lib3d.a archive
-exec - test '' = 'lib3d.a' || ${STDCMP} 2>/dev/null -s lib3d.a ${INSTALLROOT}/lib/lib3d.a || { ${STDMV} ${INSTALLROOT}/lib/lib3d.a ${INSTALLROOT}/lib/lib3d.a.old 2>/dev/null || true; ${STDCP} lib3d.a ${INSTALLROOT}/lib/lib3d.a ;}
-exec - (ranlib ${INSTALLROOT}/lib/lib3d.a) >/dev/null 2>&1 || true
-done ${INSTALLROOT}/lib/lib3d.a generated
-make ${INSTALLROOT}/lib/lib
-exec - if silent test ! -d ${INSTALLROOT}/lib/lib
-exec - then mkdir -p ${INSTALLROOT}/lib/lib
-exec - fi
-done ${INSTALLROOT}/lib/lib generated
-make ${INSTALLROOT}/lib/lib/3d
-prev ${INSTALLROOT}/lib/lib
-prev 3d.req
-exec - test '' = '3d.req' || ${STDCMP} 2>/dev/null -s 3d.req ${INSTALLROOT}/lib/lib/3d || { ${STDMV} ${INSTALLROOT}/lib/lib/3d ${INSTALLROOT}/lib/lib/3d.old 2>/dev/null || true; ${STDCP} 3d.req ${INSTALLROOT}/lib/lib/3d ;}
-done ${INSTALLROOT}/lib/lib/3d generated
-make ${INSTALLROOT}/bin
-exec - if silent test ! -d ${INSTALLROOT}/bin
-exec - then mkdir -p ${INSTALLROOT}/bin
-exec - fi
-done ${INSTALLROOT}/bin generated
-make ${INSTALLROOT}/bin/3d
-prev ${INSTALLROOT}/bin
-prev 3d
-exec - test '' = '3d' || ${STDCMP} 2>/dev/null -s 3d ${INSTALLROOT}/bin/3d || { ${STDMV} ${INSTALLROOT}/bin/3d ${INSTALLROOT}/bin/3d.old 2>/dev/null || true; ${STDCP} 3d ${INSTALLROOT}/bin/3d ;}
-done ${INSTALLROOT}/bin/3d generated
-make ${INSTALLROOT}/bin/opaque
-prev opaque
-exec - test '' = 'opaque' || ${STDCMP} 2>/dev/null -s opaque ${INSTALLROOT}/bin/opaque || { ${STDMV} ${INSTALLROOT}/bin/opaque ${INSTALLROOT}/bin/opaque.old 2>/dev/null || true; ${STDCP} opaque ${INSTALLROOT}/bin/opaque ;}
-done ${INSTALLROOT}/bin/opaque generated
-make ${INSTALLROOT}/bin/vex
-prev vex
-exec - test '' = 'vex' || ${STDCMP} 2>/dev/null -s vex ${INSTALLROOT}/bin/vex || { ${STDMV} ${INSTALLROOT}/bin/vex ${INSTALLROOT}/bin/vex.old 2>/dev/null || true; ${STDCP} vex ${INSTALLROOT}/bin/vex ;}
-done ${INSTALLROOT}/bin/vex generated
-make ${INSTALLROOT}/fun
-exec - if silent test ! -d ${INSTALLROOT}/fun
-exec - then mkdir -p ${INSTALLROOT}/fun
-exec - fi
-done ${INSTALLROOT}/fun generated
-make ${INSTALLROOT}/fun/_2d
-prev ${INSTALLROOT}/fun
-make _2d
-done _2d
-setv mode -Dmode="+x"
-exec - test '' = '_2d' || ${STDCMP} 2>/dev/null -s _2d ${INSTALLROOT}/fun/_2d || { ${STDMV} ${INSTALLROOT}/fun/_2d ${INSTALLROOT}/fun/_2d.old 2>/dev/null || true; ${STDCP} _2d ${INSTALLROOT}/fun/_2d && chmod ugo+x ${INSTALLROOT}/fun/_2d ;}
-done ${INSTALLROOT}/fun/_2d generated
-done install virtual
-make test
-make test.3d
-make 3d.tst
-done 3d.tst
-exec - set +x; (ulimit -c 0) >/dev/null 2>&1 && ulimit -c 0; set -x
-exec - ${INSTALLROOT}/bin/3d ${SHELL} regress 3d.tst
-done test.3d virtual
-done test dontcare virtual

+ 0 - 106
src/cmd/3d/PROMO.mm

@@ -1,106 +0,0 @@
-.H 1 3d
-.B 3d
-is the historical name for
-.IB n DFS ,
-the multiple dimension file system.
-It is implemented as a shared library that is preloaded
-before any other shared library using the recently documented
-.RI ( ahem )
-.B LD_PRELOAD
-or
-.B _RLD_LIST
-feature of the runtime linker.
-.B 3d
-intercepts pathname system calls (and other calls if tracing is
-turned on) and provides a logical namespace on top of the underlying
-physical file system.
-The shared library implementation currently works
-only on
-.IR bsd.i386 ,
-.IR linux.i386 ,
-.IR osf.alpha ,
-.IR sun4 ,
-.IR sol.* ,
-and
-.IR sgi.* .
-.P
-.B 3d
-works in conjunction with
-.B ksh88
-or
-.BR ksh93 .
-The
-.B 3d
-command with no arguments enters a
-.B 3d
-shell.
-The
-.B vpath
-builtin controls the logical
-filesystem view:
-.EX
-vpath dir_1 dir_2
-.EE
-mounts the directory hierarchy
-.I dir_1
-on top of
-.IR dir_2 .
-Files under
-.I dir_1
-overlay files under
-.IR dir_2 .
-Files under
-.I dir_2
-are readonly;
-any files under
-.I dir_2
-that are modified are first copied to the
-corresponding place in
-.IR dir_1 .
-.I vpaths
-may be chained:
-.EX
-vpath dir_2 dir_3
-.EE
-.I vpaths
-are per-process; every process may have a different view.
-.I vpaths
-are a handy way to separate source and generated files.
-Typical
-.B advsoft
-users set up
-.B 3d
-at login or
-.B xterm
-time:
-.EX
-export HOSTTYPE=$(package)
-vpath $HOME/arch/$HOSTTYPE $HOME
-.EE
-with source files in
-.LR $HOME/src/(cmd|lib)/* .
-.B nmake
-is run in
-.L $HOME/arch/$HOSTTYPE/src/(cmd|lib)/*
-and generated files (objects and executables) are dropped in the top hierarchy.
-.P
-.B 2d
-can prefix any command to disable 
-.B 3d
-for that command:
-.EX
-2d ls *.c
-.EE
-.P
-.B 3d
-also provides tracing, monitoring and call intercept services.
-.B vpm
-uses monitoring to graph the process and io hierarchy.
-The
-.I cs
-name server uses pathname call intercepts to translate network
-pathnames.
-Try this for any host:
-.EX
-cat /dev/tcp/hostname/inet.daytime
-.EE

+ 0 - 25
src/cmd/3d/README

@@ -1,25 +0,0 @@
-vpath - /#option/debug=level
-
-	set debug trace level
-
-vpath - /#option/trace[=pid]
-
-	turn on truss style tracing with option pid prefix
-
-vpath	/dev/tcp/share/cat/#/home/gsf/tmp/call.out \
-	/#fs/proc/global/monitor/call=fork,exec,exit
-
-	monitor fork,exec,exit by sending messages to the cat server
-
-vpath	/tmp/io.out \
-	/#fs/io/global/monitor/call=open,close,write
-
-	monitor open,close,write by appending messages /tmp/io.out
-
-vpath /home/gsf/tmp/rpl.out /#fs/rpl/monitor
-
-	create a per-tree monitor to rpl.out
-
-vpath . /#rpl /tmp /#rpl
-
-	all calls on files in . and /tmp trees monitored to rpl.out

+ 0 - 152
src/cmd/3d/RELEASE

@@ -1,152 +0,0 @@
-12-06-25 change strcpy() within buffer to strcopy()
-12-06-22 sys.tab,utimensat3d.c: add utimensat()
-12-05-25 sys.tab: handle missing getdents64 on linux+gcc-4.4
-12-05-25 syscall3d.c: tweak _exit() logic (really?) to dumped core on recent solaris
-11-12-01 fix fcntl 3rd arg int vs void*
-10-06-01 sync with ast api 20100601
-10-04-10 mkdir3d.c: fix mkdir() intermediate dir logic
-10-01-19 3d.h: increase some path buffer sizes -- these need to be dynamic!
-09-05-15 dll_3d.h: handle dllopen => dlopen
-08-12-04 fs.c: change open(/dev/fd/NN,...) try open(2) first, then dup(2)
-08-06-20 ast_3d.h,ast.c: add libast/misc/setenviron.c
-07-03-26 Makefile: drop -L* from IFFEREFS -- handled by .IFFE.REF.
-07-03-21 lib_3d.h,error.c: handle error_info => *_error_data_
-06-12-04 3d.h: strmode() bsd conflict tweak
-06-11-23 finally get linux to pass regression tests
-06-11-21 fchdir3d: let chdir do the work if fd matches cached path
-06-09-28 3d.sh: used getconf LIBPATH|LIBPREFIX|LIBSUFFIX -- how novel
-06-09-26 3d.h,dir3d.c,dll3d.c: fix strtou*l*l maps for __int64 vs. long long
-06-09-18 strmatch.c,touch.c: add private obsolete api copies
-06-08-27 mkdir3d.c: foloow mkdir -p mode rules for missing intermediates
-05-02-01 3d.sh: IFS may be unset and { ash bsh } don't on startup -- wow
-05-01-01 sys.tab,utimets3d.c: add utimets() intercept
-04-12-15 pathreal.c: "..." should fail if no lower view -- doh
-04-10-01 features/syslib: _exit test now uses SIGKILL (openbsd abort() hangs)
-04-07-26 3d.sh: update runtime docs
-	 3d.1: drop in deference to the 3d.sh runtime docs
-04-07-20 3d.h: undef _BLD_DEBUG to avoid raw libast symbols
-04-07-19 fs.c,lib.c,open3d.c,vcs_3d.h: { O_RDONLY O_WRONLY O_RDWR } are values
-04-07-19 dir3d.c: rewinddir643d() must call seekdir643d() (not seekdir64())
-04-07-01 3d.tst: TMP => TWD to match regress(1)
-04-06-16 3d.tst: coordinate $TMP with regress(1)
-04-06-14 lib.c: fix fs3d() 2d return value
-04-06-11 3d.tst: fix test and error counts
-04-05-04 open3d.c: create missing lower level dirs for O_CREAT ... file paths
-03-08-15 mount3d.c: change 3d intercept test to handle NiL || ""
-03-06-11 ast.c: add _map_malloc checks for _ast_malloc => malloc
-03-06-05 pathreal.c: fix ancient multiple relative|.. symlink bug
-03-06-04 3d.sh: change `shift $OPTIND-1' to `set x "@"; shift $OPTIND'
-03-03-28 dir3d.c,rmdir3d.c,syscall3d.c: add D_FILENO and D_TYPE ifdefs
-03-03-25 dup3d.c: fix bug that cleared Dir_t pointer just after allocation
-03-03-07 ftruncate3d.c,lseek3d.c,truncate3d.c: check _typ_off64_t
-02-10-18 features/syscall.sh: handle pseudo files in cc -E line syncs
-02-07-17 syscall3d.c: clean up user level intercept code
-02-06-25 open3d.c: fix bug that created 0 mode file with only O_RDWR
-02-06-14 ast_3d.h,cs.c: move fmttime() macro override to cs.c
-02-06-06 dir3d.c: fix rewinddir() bug that did not decrement intercepted count
-02-04-01 Makefile,cs.c,cs_3d.h,ast_3d.h: _WIN32 tweaks
-01-11-26 pathreal.c: empty path is an error
-01-11-16 ftruncate3d.c,truncate3d.c: use lseek3d indirection via sysfunc()
-01-10-31 fchdir3d: add along with state.file[].dir to cache open dir paths
-	 dir3d.c: add recursive call intercepts
-	 error.c: add recursive call intercepts
-	 pathreal.c: add buffer size check
-	 features/syscall.sh: add bsd syscall __RENAME() checks
-	 syscall3d.c: check _lib_syscall before using it!
-01-10-30 features/syscall.sh,syscall3d.c: handle -ldl calls back into 3d
-01-09-20 3d.sh: drop extra } in USAGE that emitted -} for --?
-01-07-17 Makefile: don't link 3d dll against ast dll
-01-02-19 close3d: dup reserved fd's higher
-01-02-14 add :VARIANT: to build dll's for CC.DLL.VARIANTS
-01-01-01 dir_3d.h: real readdir must be struct dirent, not dirent64
-00-12-14 3d.sh: fix -c
-00-10-31 ast.c add pathtemp.c
-00-10-19 init.c: initialize _3d_2d
-00-07-17 fix fchown to call MSG_fchown (not MSG_fchown); fixes vim dump!
-00-02-14 3d command long options (finally)
-99-01-01 --- release 4.0 ---
-99-04-01 dll: sfsprintf => _3d_sfsprintf
-	 check for __*_nc (osf.alpha)
-99-02-14 pathreal: copy to state.path.name if not already there
-	 rewinddir3d: just call seekdir(p,0); fixes `top' core dump
-99-01-11 lseek3d,syscall3d: add sysfunc() for off_t!=long
-99-01-01 --- release 3.0 ---
-98-02-14 3d.sh: fix _RLD32_LIST => _RLDN32_LIST typo
-	 pathreal: fix (P_LSTAT|P_READLINK) under pwd bug that did phys on .
-	 features/syscall.sh: tighten up version __call header grep
-	 unlink: trap remove() too
-	 features/syscall.sh: favor strong (_ prefix) name for some arch's
-98-02-06 syscall3d: handle longjmp with cp->active
-98-01-23 features/syscall.sh: check for _xstat vs __xstat
-98-01-01 add readdir64 rewinddir64 seekdir64 telldir64
-97-10-11 fix lefty's virtual dir touch bug -- recursive doubling on stbuf
-97-07-17 CS_INTERFACE=2
-97-04-01 features/syscall.sh: fix __exit() test for new sgi
-96-12-25 handle stat64() implementations on top of _xstat()
-	 3d.tst must be run under 3d!
-	 _SCO_STAT_VER tweaks
-	 sgi _RLD_NEXT_PATHNAME fix for -32 -n32 -64 differentiation
-	 _*xstat() hacks around proto in *stat3d.c
-	 add constant casts for long shift counts
-	 fix pathnext() to report version instance level in state.path.level
-96-11-28 fix rename() to do physical stat on subject path!
-96-02-29 handle syscall loops caused by botched libs like solaris libsocket.so
-	 generalize name service interface to handle ifs+vcs
-	 catch acl,facl even if not on local sys
-	 fix features/syscall.sh bug that set $stdc incorrectly
-	 use alloca() in execve() if possible
-	 add 3d.tst and test makefile action
-	 fix a few important virtual dir / create / append bugs
-	 fix null dereference in open3d() for state.in_2d
-96-02-14 add NFS acl,facl
-96-02-08 fix 2d bug in link,rename,symlink that generated empty arg 1
-96-01-30 fix features/syscall.sh for compilers that ignore prototypes
-96-01-22 P_TOP only takes effect for files in virtual dir!
-95-11-24 optimize exec $shell to eval in 3d.sh
-95-11-11 don't fs3d_copy opaqued files
-95-10-11 fs3d_mkdir virtual dir fix 
-	 fix 2d virtual dir test in pathreal()
-	 solaris _rename() != weak rename()
-	 solaris exit() doesn't call _exit()
-	 all static data in state
-	 test state.in_2d in link3d()
-	 fix opaque.sh that was broken sometime after 91
-	 linux LD_BIND_NOW not needed with ld.so-1.7.9
-95-07-17 handle irix-5.3 struct stat64 and off64_t
-	 dlsym(__exit) before dlsym(_exit)
-95-05-09 fix pathcanon() bug that incremented state.path.level too far on ...
-	 percolate inode metadata changes to the top level too (no more EROFS)
-	 add P_TOP to truncate() too!
-	 feature/syscall.sh does not generate #include, up to *3d.c
-	 spawnveg.c must come after spawnve.c in ast.c
-	 cspoll.c must come after cs*.c in cs.c
-	 fix 3d to work like $SHELL if no shared 3d lib found
-	 fix chdir .. symlink bug that set state.pwd to physical path
-	 add %n.n.nd to bvprintf
-	 ignore a few more non-initialization setcwd() errors
-95-01-19 fix undefined var ref for _VER_ hack calls in features/syscall.sh
-95-01-11 access W_OK succeeds if on lower view
-94-12-01 add /#fs/NAME/load to load shared lib fs
-	 add user system call trap() stack
-	 VPATH=*::* or VPATH=*:-:* to separate disjoint views
-	 change trap() to intercept()
-94-07-17 add /#fs/safe
-94-06-01 fix symlink() and link() bug that didn't instantiate virtual dir
-	 fix [f]statvfs() infinite loop for att hybrids
-94-05-11 merge with the real vcs
-	 add char*_3d_2d: if _3d_2d!=0&&getenv(_3d_2d)==0 then 2d
-	 trailing slash in pathreal() interpreted as slash dot (off/w test=010)
-93-05-28 add /#option/limit=n to limit view depth
-93-04-01 --- release 2.0 ---
-93-03-11 change /dev/3d/* to /#*
-	 remove anno and rpl specific hooks
-	 add name,monitor,active fs mounts
-92-04-01 --- release 1.1 ---
-92-02-11 change retained mounts to /dev/3d/dev
-92-01-11 add $SHELL and /bin/sh exec() checks to force 3d sh
-	 fix checklink() to concatenate relative links with original prefix
-91-11-11 --- release 1.0 ---
-	 add feature/syscall.sh to handle att s5r4, hp snake, sun 4.1
-	 change umask() 3d state toggle to mount(-,/dev/3d/option/{2d,3d})
-	 fix creat() virtual dir bug for umteenth time
-	 link() and rename() now migrate to top instead of EROFS

+ 0 - 40
src/cmd/3d/_2d

@@ -1,40 +0,0 @@
-#
-# 2d  [ - | + ] | [ cmd ... ]
-#
-# @(#)2d (AT&T Bell Laboratories) 06/22/93
-#
-#	2d	start 2d shell
-#	2d -	disable 2d [ enable 3d ]
-#	2d +	enable 2d [ disable 3d ]
-#	2d cmd	run cmd in 2d
-#
-
-function _2d
-{
-	option=$(vpath /#option/3d 2>/dev/null)
-	case $option in
-	?*)	trap "set +o noglob; vpath \$option; export LD_PRELOAD='$LD_PRELOAD' _RLD_LIST='$_RLD_LIST' _RLDN32_LIST='$_RLDN32_LIST'" 0 INT QUIT
-		vpath - /#option/2d
-		;;
-	esac
-	set +o noglob
-	if	test -d .
-	then	case $1 in
-		-|+)	case $1 in
-			+)	option="- /#option/2d" ;;
-			-)	option="- /#option/3d" ;;
-			esac
-			return
-			;;
-		esac
-		# this is close: ^A can't appear in $@
-		typeset IFS=''
-		unset __ LD_PRELOAD _RLD_LIST
-		case $1 in
-		[-+]*)	$SHELL $@ ;;
-		*)	${@-$SHELL} ;;
-		esac
-	else	print -u2 . not found
-		return 1
-	fi
-}

+ 0 - 104
src/cmd/3d/access3d.c

@@ -1,104 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-int
-access3d(const char* path, int mode)
-{
-	register char*	sp;
-	mode_t		test;
-	struct stat 	st;
-
-#if FS
-	if (!fscall(NiL, MSG_stat, 0, path, &st))
-	{
-		if (state.ret) return(-1);
-		sp = 0;
-	}
-	else
-#endif
-	if (!(sp = pathreal(path, 0, &st)))
-		return(-1);
-
-	/*
-	 * handle some frequent cases separately
-	 */
-
-	switch (mode)
-	{
-	case F_OK:
-		return(0);
-	case R_OK:
-		if ((st.st_mode&(S_IRUSR|S_IRGRP|S_IROTH)) == (S_IRUSR|S_IRGRP|S_IROTH))
-			return(0);
-		break;
-	case W_OK:
-		if (state.path.level && (st.st_mode&(S_IWUSR|S_IWGRP|S_IWOTH)) && !ACCESS(sp, R_OK))
-			return(0);
-		break;
-	case X_OK:
-		if ((st.st_mode&(S_IXUSR|S_IXGRP|S_IXOTH)) == (S_IXUSR|S_IXGRP|S_IXOTH))
-			return(0);
-		break;
-	}
-#if FS
-	if (sp)
-#endif
-	return(ACCESS(sp, mode));
-#if FS
-
-	/*
-	 * simulate access()
-	 */
-
-	if (mode & (R_OK|W_OK|X_OK))
-	{
-		test = 0;
-		if (st.st_uid == state.uid)
-		{
-			if (mode & R_OK) test |= S_IRUSR;
-			if (mode & W_OK) test |= S_IWUSR;
-			if (mode & X_OK) test |= S_IXUSR;
-		}
-		else if (st.st_gid == state.gid)
-		{
-			if (mode & R_OK) test |= S_IRGRP;
-			if (mode & W_OK) test |= S_IWGRP;
-			if (mode & X_OK) test |= S_IXGRP;
-		}
-		else 
-		{
-			if (mode & R_OK) test |= S_IROTH;
-			if (mode & W_OK) test |= S_IWOTH;
-			if (mode & X_OK) test |= S_IXOTH;
-		}
-		if ((st.st_mode & test) != test)
-		{
-			errno = EACCES;
-			return(-1);
-		}
-	}
-	return(0);
-#endif
-}

+ 0 - 62
src/cmd/3d/acl3d.c

@@ -1,62 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if !defined(ACL3D) || !defined(SETACL)
-
-#define aclent_t	char
-#define SETACL		1
-
-#endif
-
-#define MSG_acl		MSG_INIT(MSG_control, 051121, MSG_VAR_FILE)
-
-int
-acl3d(const char* path, int cmd, int cnt, aclent_t* buf)
-{
-	register char*		sp;
-	register int		r;
-
-#if FS
-	register Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_acl, 0, path, cmd, cnt, buf))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, cmd == SETACL ? (state.safe ? (P_SAFE|P_TOP) : P_TOP) : 0, NiL)))
-		return -1;
-	r = ACL(sp, cmd, cnt, buf);
-#if FS
-	if (r >= 0)
-	{
-		if (mp)
-			fscall(mp, MSG_acl, 0, state.path.name, cmd, cnt, buf);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_acl))
-				fscall(mp, MSG_acl, 0, state.path.name, cmd, cnt, buf);
-	}
-#endif
-	return r;
-}

+ 0 - 121
src/cmd/3d/ast.c

@@ -1,121 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#define NoN(x)
-
-#include "3d.h"
-#include "ast.h"
-
-static char	conf[] = "";
-
-#define astconf(a,b,c)	conf
-#define ctermid		___ctermid
-
-#include "state.c"
-
-#include "astintercept.c"
-#include "getenv.c"
-#include "setenviron.c"
-#include "getcwd.c"
-#include "getwd.c"
-#include "hashalloc.c"
-#include "hashfree.c"
-#include "hashlook.c"
-#include "hashscan.c"
-#include "hashsize.c"
-#include "hashwalk.c"
-#include "memset.c"
-
-#if DEBUG
-#include "fmterror.c"
-#endif
-
-#if FS
-#include "tvgettime.c"
-#include "eaccess.c"
-#include "pathcat.c"
-#include "pathtemp.c"
-#include "pathtmp.c"
-
-char*
-pathbin(void)
-{
-	char*	p;
-
-	if (!(p = state.envpath) && !(p = getenv("PATH")))
-		p = ":/bin:/usr/bin:/usr/ucb";
-	return(p);
-}
-
-#include "tokscan.c"
-#include "touch.c"
-
-#endif
-
-#include "strmatch.c"
-#include "sigcrit.c"
-#include "waitpid.c"
-
-#undef	_real_vfork
-
-#define close	CLOSE
-#define fcntl	FCNTL
-#define read	READ
-#define write	WRITE
-
-#include "pathshell.c"
-
-/*
- * 3d doesn't handle spawnve() yet
- * we need spawnveg3d()
- */
-
-#if _lib_fork || _lib_vfork
-#undef	_lib_spawnve
-#endif
-
-#include "spawnveg.c"	/* follows spawnve.c because of #undef's */
-
-#include "gross.c"
-
-#if _map_malloc
-
-#undef	calloc
-#undef	free
-#undef	malloc
-#undef	realloc
-#undef	strdup
-
-extern void*	calloc(size_t, size_t);
-extern void	free(void*);
-extern void*	malloc(size_t);
-extern void*	realloc(void*, size_t);
-extern char*	strdup(const char*);
-
-extern void*	_ast_calloc(size_t n, size_t m) { return calloc(n, m); }
-extern void	_ast_free(void* p) { free(p); }
-extern void*	_ast_malloc(size_t n) { return malloc(n); }
-extern void*	_ast_realloc(void* p, size_t n) { return realloc(p, n); }
-extern char*	_ast_strdup(const char* s) { return strdup(s); }
-
-#endif

+ 0 - 61
src/cmd/3d/ast_3d.h

@@ -1,61 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-/*
- * libast 3d symbol mappings to minimize pollution
- */
-
-#ifndef _NAME3D_AST_H
-#define _NAME3D_AST_H
-
-#define _ast_state	_3d_ast_state
-#define _ast_getenv	_3d_ast_getenv
-#define _ast_info	_3d_ast_info
-#define _ast_setenviron	_3d_ast_setenviron
-#define _hash_info_	_3d_hash_info
-#define astintercept	_3d_astintercept
-#define fmterror	_3d_fmterror
-#define fmttime		_3d_fmttime
-#define hashalloc	_3d_hashalloc
-#define hashdone	_3d_hashdone
-#define hashfree	_3d_hashfree
-#define hashlook	_3d_hashlook
-#define hashnext	_3d_hashnext
-#define hashscan	_3d_hashscan
-#define hashsize	_3d_hashsize
-#define hashwalk	_3d_hashwalk
-#define pathbin		_3d_pathbin
-#define pathcheck	_3d_pathcheck
-#define pathshell	_3d_pathshell
-#define pathtemp	_3d_pathtemp
-#define strmatch	_3d_strmatch
-#define strsubmatch	_3d_strsubmatch
-#define tokscan		_3d_tokscan
-#define touch		_3d_touch
-
-#include <ast_lib.h>
-
-#undef	_lib_fmterror
-
-extern char*		_3d_ast_getenv(const char*);
-
-#endif

+ 0 - 391
src/cmd/3d/bio.c

@@ -1,391 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * 3d buffer io
- */
-
-#include "3d.h"
-
-/*
- * stripped down printf -- only { %c %[l[l]][dopux] %s }
- */
-
-ssize_t
-bvprintf(char** buf, char* end, register const char* format, va_list ap)
-{
-	register int	c;
-	register char*	p;
-	register char*	e;
-	int		w;
-	int		l;
-	int		f;
-	int		g;
-	int		r;
-	long		n;
-	unsigned long	u;
-	ssize_t		z;
-#if _typ_int64_t
-	int64_t		q;
-	uint64_t	v;
-#endif
-	char*		s;
-	char*		b;
-	char*		x;
-	char		num[32];
-
-	static char	digits[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ@_";
-
-	if (buf)
-	{
-		p = *buf;
-		e = end;
-	}
-	else e = (p = end) + SHRT_MAX;
-	for (;;)
-	{
-		switch (c = *format++)
-		{
-		case 0:
-			goto done;
-		case '%':
-			if (*format == '-')
-			{
-				format++;
-				l = 1;
-			}
-			else l = 0;
-			if (*format == '0')
-			{
-				format++;
-				f = l ? ' ' : '0';
-			}
-			else f = ' ';
-			if ((c = *format) == '*')
-			{
-				format++;
-				w = va_arg(ap, int);
-			}
-			else
-			{
-				w = 0;
-				while (c >= '0' && c <= '9')
-				{
-					w = w * 10 + c - '0';
-					c = *++format;
-				}
-			}
-			r = 0;
-			if (c == '.')
-			{
-				if ((c = *++format) == '*')
-				{
-					format++;
-					va_arg(ap, int);
-				}
-				else while (c >= '0' && c <= '9') c = *++format;
-				if (c == '.')
-				{
-					if ((c = *++format) == '*')
-					{
-						format++;
-						r = va_arg(ap, int);
-					}
-					else while (c >= '0' && c <= '9')
-					{
-						r = r * 10 + c - '0';
-						c = *++format;
-					}
-				}
-			}
-			if ((c = *format++) != 'l')
-				n = 0;
-			else if ((c = *format++) != 'l')
-				n = 1;
-			else
-			{
-				n = 2;
-				c = *format++;
-			}
-			g = 0;
-			b = num;
-			switch (c)
-			{
-			case 0:
-				break;
-			case 'c':
-				*b++ = va_arg(ap, int);
-				break;
-			case 'd':
-				switch (n)
-				{
-				case 0:
-					n = va_arg(ap, int);
-					break;
-				default:
-#if _typ_int64_t
-					q = va_arg(ap, int64_t);
-					if (q < 0)
-					{
-						g = '-';
-						q = -q;
-					}
-					v = q;
-					goto dec_8;
-				case 1:
-#endif
-					n = va_arg(ap, long);
-					break;
-				}
-				if (n < 0)
-				{
-					g = '-';
-					n = -n;
-				}
-				u = n;
-				goto dec;
-			case 'o':
-				switch (n)
-				{
-				case 0:
-					u = va_arg(ap, unsigned int);
-					break;
-				default:
-#if _typ_int64_t
-					v = va_arg(ap, uint64_t);
-					goto oct_8;
-				case 1:
-#endif
-					u = va_arg(ap, unsigned long);
-					break;
-				}
-				do *b++ = (u & 07) + '0'; while (u >>= 3);
-				break;
-			case 's':
-				s = va_arg(ap, char*);
-				if (!s) s = "(null)";
-				if (w)
-				{
-					n = w - strlen(s);
-					if (l)
-					{
-						while (w-- > 0)
-						{
-							if (p >= e) goto done;
-							if (!(*p = *s++)) break;
-							p++;
-						}
-						while (n-- > 0)
-						{
-							if (p >= e) goto done;
-							*p++ = f;
-						}
-						continue;
-					}
-					while (n-- > 0)
-					{
-						if (p >= e) goto done;
-						*p++ = f;
-					}
-				}
-				for (;;)
-				{
-					if (p >= e) goto done;
-					if (!(*p = *s++)) break;
-					p++;
-				}
-				continue;
-			case 'u':
-				switch (n)
-				{
-				case 0:
-					u = va_arg(ap, unsigned int);
-					break;
-				default:
-#if _typ_int64_t
-					v = va_arg(ap, uint64_t);
-					goto dec_8;
-				case 1:
-#endif
-					u = va_arg(ap, unsigned long);
-					break;
-				}
-			dec:
-				if (r <= 0 || r >= sizeof(digits)) r = 10;
-				do *b++ = digits[u % r]; while (u /= r);
-				break;
-			case 'p':
-				if (x = va_arg(ap, char*))
-				{
-					g = 'x';
-					w = 10;
-					f = '0';
-					l = 0;
-				}
-#if _typ_int64_t
-				if (sizeof(char*) == sizeof(int64_t))
-				{
-					v = (uint64_t)x;
-					goto hex_8;
-				}
-#endif
-				u = (unsigned long)x;
-				goto hex;
-			case 'x':
-				switch (n)
-				{
-				case 0:
-					u = va_arg(ap, unsigned int);
-					break;
-				default:
-#if _typ_int64_t
-					v = va_arg(ap, uint64_t);
-					goto hex_8;
-				case 1:
-#endif
-					u = va_arg(ap, unsigned long);
-					break;
-				}
-			hex:
-				do *b++ = ((n = (u & 0xf)) >= 0xa) ? n - 0xa + 'a' : n + '0'; while (u >>= 4);
-				break;
-			default:
-				if (p >= e) goto done;
-				*p++ = c;
-				continue;
-#if _typ_int64_t
-			dec_8:
-				if (r <= 0 || r >= sizeof(digits)) r = 10;
-				do *b++ = digits[v % r]; while (v /= r);
-				break;
-			hex_8:
-				do *b++ = ((n = (v & 0xf)) >= 0xa) ? n - 0xa + 'a' : n + '0'; while (v >>= 4);
-				break;
-			oct_8:
-				do *b++ = (v & 07) + '0'; while (v >>= 3);
-				break;
-#endif
-			}
-			if (w)
-			{
-				if (g == 'x') w -= 2;
-				else if (g) w -= 1;
-				n = w - (b - num);
-				if (!l)
-				{
-					if (g && f != ' ')
-					{
-						if (g == 'x')
-						{
-							if (p >= e) goto done;
-							*p++ = '0';
-							if (p >= e) goto done;
-							*p++ = 'x';
-						}
-						else if (p >= e) goto done;
-						else *p++ = g;
-						g = 0;
-					}
-					while (n-- > 0)
-					{
-						if (p >= e) goto done;
-						*p++ = f;
-					}
-				}
-			}
-			if (g == 'x')
-			{
-				if (p >= e) goto done;
-				*p++ = '0';
-				if (p >= e) goto done;
-				*p++ = 'x';
-			}
-			else if (g)
-			{
-				if (p >= e) goto done;
-				*p++ = g;
-			}
-			while (b > num)
-			{
-				if (p >= e) goto done;
-				*p++ = *--b;
-			}
-			if (w && l) while (n-- > 0)
-			{
-				if (p >= e) goto done;
-				*p++ = f;
-			}
-			continue;
-		default:
-			if (p >= e) goto done;
-			*p++ = c;
-			continue;
-		}
-		break;
-	}
- done:
-	if (p < e) *p = 0;
-	if (buf)
-	{
-		z = p - *buf;
-		*buf = p;
-	}
-	else z = p - end;
-	return(z);
-}
-
-int
-bprintf(char** buf, char* end, const char* format, ...)
-{
-	va_list	ap;
-	ssize_t	n;
-
-	va_start(ap, format);
-	n = bvprintf(buf, end, format, ap);
-	va_end(ap);
-	return(n);
-}
-
-ssize_t
-sfsprintf(char* buffer, size_t size, const char* format, ...)
-{
-	va_list	ap;
-	char**	buf;
-	char*	end;
-	int	n;
-
-	va_start(ap, format);
-	if (size)
-	{
-		buf = &buffer;
-		end = buffer + size;
-	}
-	else
-	{
-		buf = 0;
-		end = buffer;
-	}
-	n = bvprintf(buf, end, format, ap);
-	va_end(ap);
-	return(n);
-}

+ 0 - 50
src/cmd/3d/brk3d.c

@@ -1,50 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef	brk3d
-
-int
-brk3d(void* p)
-{
-#if FS
-	register Mount_t*	mp;
-	int			r;
-
-	initialize();
-	if (!(r = BRK(p)))
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_break))
-				fscall(mp, MSG_break, 0, p);
-	return(r);
-#else
-	return(BRK(p));
-#endif
-}
-
-#else
-
-NoN(brk)
-
-#endif

+ 0 - 82
src/cmd/3d/chdir3d.c

@@ -1,82 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-int
-chdir3d(const char* path)
-{
-	register char*	sp;
-	char		buf[2 * PATH_MAX + 1];
-
-#if FS
-	if (!fscall(NiL, MSG_stat, 0, path, &state.path.st))
-	{
-		if (state.ret)
-			return -1;
-		if (!S_ISDIR(state.path.st.st_mode))
-		{
-			errno = ENOTDIR;
-			return -1;
-		}
-		state.level = 1;
-	}
-	else
-#else
-	initialize();
-#endif
-	{
-		if (state.level > 0 && state.pwd && !CHDIR(state.pwd))
-			state.level = 0;
-		if (!(sp = pathreal(path, P_SAFE, NiL)))
-			return -1;
-		if (CHDIR(sp))
-			return -1;
-	}
-	if (state.pwd)
-	{
-		/*
-		 * save absolute path in state.pwd
-		 */
-
-		if (*path != '/')
-		{
-			strcpy(buf, state.pwd);
-			sp = buf + state.pwdsize;
-			*sp++ = '/';
-		}
-		else
-			sp = buf;
-		strcpy(sp, path);
-#if 0
-		state.path.level = 0;
-#endif
-		if ((sp = pathcanon(buf, sizeof(buf), 0)) && *(sp - 1) == '.' && *(sp - 2) == '/')
-			*(sp -= 2) = 0;
-		state.pwdsize = strcopy(state.pwd, buf) - state.pwd;
-		memcpy(state.envpwd + sizeof(var_pwd) - 1, state.pwd, state.pwdsize);
-		state.level = state.path.level;
-		message((-1, "chdir: %s [%d]", state.pwd, state.level));
-	}
-	return 0;
-}

+ 0 - 70
src/cmd/3d/chmod3d.c

@@ -1,70 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide chmod
-#else
-#define chmod        ______chmod
-#endif
-#define _def_syscall_3d	1
-#define _LS_H		1
-
-#include "3d.h"
-
-#undef	_def_syscall_3d
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide chmod
-#else
-#undef  chmod
-#endif
-
-#include "FEATURE/syscall"
-
-int
-chmod3d(const char* path, mode_t mode)
-{
-	register char*	sp;
-	register int	r;
-
-#if FS
-	register Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_chmod, 0, path, mode))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, state.safe ? (P_SAFE|P_TOP) : P_TOP, NiL)))
-		return(-1);
-	r = CHMOD(sp, mode);
-#if FS
-	if (!r)
-	{
-		if (mp)
-			fscall(mp, MSG_chmod, 0, state.path.name, mode);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_chmod))
-				fscall(mp, MSG_chmod, 0, state.path.name, mode);
-	}
-#endif
-	return(r);
-}

+ 0 - 61
src/cmd/3d/chown3d.c

@@ -1,61 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef chown3d
-
-int
-chown3d(const char* path, uid_t uid, gid_t gid)
-{
-	register char*	sp;
-	register int	r;
-
-#if FS
-	register Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_chown, 0, path, uid, gid))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_SAFE|P_TOP, NiL)))
-		return(-1);
-	r = CHOWN(sp, uid, gid);
-#if FS
-	if (!r)
-	{
-		if (mp)
-			fscall(mp, MSG_chown, 0, path, uid, gid);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_chown))
-				fscall(mp, MSG_chown, 0, path, uid, gid);
-	}
-#endif
-	return(r);
-}
-
-#else
-
-NoN(chown)
-
-#endif

+ 0 - 82
src/cmd/3d/close3d.c

@@ -1,82 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-int
-close3d(int fd)
-{
-	initialize();
-	if (fd >= 0 && fd < elementsof(state.file))
-	{
-		register int		nfd;
-		register short*		rp;
-#if FS
-		register Mount_t*	mp;
-#endif
-
-#if defined(fchdir3d)
-		if (state.file[fd].dir)
-		{
-			free(state.file[fd].dir);
-			state.file[fd].dir = 0;
-		}
-#endif
-		if (rp = state.file[fd].reserved)
-		{
-			if ((nfd = FCNTL(fd, F_DUPFD, fd + 1)) < 0)
-			{
-				errno = EBADF;
-				return -1;
-			}
-			*rp = nfd;
-			state.file[nfd].reserved = rp;
-			state.file[nfd].flags = FILE_LOCK;
-			state.file[fd].reserved = 0;
-			CLOSE(fd);
-		}
-#if FS
-		if ((mp = state.file[fd].mount) && fssys(mp, MSG_close))
-		{
-			if (FSTAT(fd, &state.path.st))
-				state.path.st.st_mtime = 0;
-			fscall(mp, MSG_close, 0, fd, state.path.st.st_mtime);
-		}
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_close))
-			{
-				if ((state.file[fd].flags & FILE_OPEN) ? FSTAT(fd, &state.path.st) : fileinit(fd, NiL, NiL, 0))
-					state.path.st.st_mtime = 0;
-				fscall(mp, MSG_close, 0, fd, state.path.st.st_mtime);
-			}
-		if (state.file[fd].flags)
-		{
-			state.file[fd].flags = 0;
-			state.file[fd].mount = 0;
-			if (state.cache == fd)
-				while (state.cache > 1 && !state.file[--state.cache].flags);
-		}
-#endif
-	}
-	return(CLOSE(fd));
-}

+ 0 - 110
src/cmd/3d/copy.c

@@ -1,110 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if _hdr_utime
-#include <utime.h>
-#else
-struct utimbuf
-{
-	time_t  actime;
-	time_t  modtime;
-};
-#endif
-
-#define COPYBUF		8096
-
-#if __sun__ || sun
-
-#if _lib_mmap
-
-#define COPYMAP		(32*COPYBUF)
-
-#endif
-
-#endif
-
-/*
- * copy rfd to wfd
- * return 0 if success, otherwise -1.
- */
-
-int
-fs3d_copy(int rfd, int wfd, struct stat* st)
-{
-	register ssize_t	n;
-	ssize_t			filesize;
-	struct stat		stbuf;
-	struct utimbuf		ut;
-	char			buf[COPYBUF];
-
-#ifdef COPYMAP
-	off_t			offset;
-	size_t			munmapsize;
-	size_t			mapsize;
-	char*			mapbuf;
-#endif
-
-	if (!st && FSTAT(rfd, st = &stbuf)) return -1;
-	if (!S_ISREG(st->st_mode)) return 0;
-	if ((filesize = st->st_size) <= 0)
-		filesize = 1;
-#ifdef COPYMAP
-	mapsize = (filesize < COPYMAP) ? filesize : COPYMAP;
-	if ((filesize > COPYBUF) && ((mapbuf = mmap((caddr_t)0, mapsize, PROT_READ, MAP_SHARED, rfd, 0)) != ((caddr_t)-1)))
-	{
-		offset = 0;
-		munmapsize = mapsize;
-		for (;;)
-		{
-			if (write(wfd, mapbuf, mapsize) != mapsize)
-			{
-				munmap(mapbuf, munmapsize);
-				return -1;
-			}
-			filesize -= mapsize;
-			if (filesize <= 0) break;
-			offset += mapsize;
-			if (filesize < mapsize) mapsize = filesize;
-			if (mmap(mapbuf, mapsize, PROT_READ, MAP_SHARED|MAP_FIXED, rfd, offset) == (caddr_t)-1)
-			{
-				munmap(mapbuf, munmapsize);
-				return -1;
-			}
-		}
-		munmap(mapbuf, munmapsize);
-	}
-#endif
-	if (filesize > 0)
-	{
-		while ((n = read(rfd, buf, COPYBUF)) > 0)
-			if (write(wfd, buf, n) != n) 
-				return -1;
-		if (n < 0 || lseek(wfd, (off_t)0, 0)) return -1;
-	}
-	ut.actime = st->st_atime;
-	ut.modtime = st->st_mtime;
-	UTIME(state.path.name, &ut);
-	return 0;
-}

+ 0 - 30
src/cmd/3d/creat3d.c

@@ -1,30 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-int
-creat3d(const char* path, mode_t mode)
-{
-	return(open(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
-}

+ 0 - 75
src/cmd/3d/cs.c

@@ -1,75 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#define msgreserve(p)	reserve(p)
-
-#define gethostname	______gethostname
-
-#include "3d.h"
-
-#undef	gethostname
-#undef	FSYNC
-
-#include <ctype.h>
-
-#define CS_LIB_LOCAL	1
-
-#define _3d_fmttime(a,b)	"[NOW]"
-
-#if FS
-
-#undef	NoN
-#define NoN(x)
-
-#include "csdata.c"
-#undef	csaddr
-#define csaddr(p,x)	0
-#include "csauth.c"
-#include "csbind.c"
-#include "cslocal.c"
-#include "csname.c"
-#include "csntoa.c"
-#include "csread.c"
-#include "csrecv.c"
-#include "cssend.c"
-#include "csvar.c"
-#include "cswrite.c"
-
-#include "msgbuf.c"
-#include "msgread.c"
-#include "msguser.c"
-
-#endif
-
-#include "cspeek.c"
-#include "cspipe.c"
-
-#if FS
-#include "cspoll.c"	/* follows cs*.c because of #undef's */
-#endif
-
-#include "msggetmask.c"
-#include "msgindex.c"
-#include "msginfo.c"
-#include "msgname.c"
-#include "msgsetmask.c"

+ 0 - 97
src/cmd/3d/cs_3d.h

@@ -1,97 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * libcs 3d symbol mappings to minimize pollution
- */
-
-#ifndef _NAME3D_CS_H
-#define _NAME3D_CS_H
-
-#define CS_INTERFACE	2
-
-#define _cs_info_	_3d_cs_info_
-#define csauth		_3d_csauth
-#define csbind		_3d_csbind
-#define cschallenge	_3d_cschallenge
-#define cslocal		_3d_cslocal
-#define csname		_3d_csname
-#define csntoa		_3d_csntoa
-#define cspeek		_3d_cspeek
-#define cspipe		_3d_cspipe
-#define cspoll		_3d_cspoll
-#define csread		_3d_csread
-#define csrecv		_3d_csrecv
-#define cssend		_3d_cssend
-#define csvar		_3d_csvar
-#define cswrite		_3d_cswrite
-
-#define _cs_addr	_3d_cs_addr
-#define _cs_attr	_3d_cs_attr
-#define _cs_auth	_3d_cs_auth
-#define _cs_bind	_3d_cs_bind
-#define _cs_challenge	_3d_cs_challenge
-#define _cs_clone	_3d_cs_clone
-#define _cs_daemon	_3d_cs_daemon
-#define _cs_fd		_3d_cs_fd
-#define _cs_from	_3d_cs_from
-#define _cs_full	_3d_cs_full
-#define _cs_info	_3d_cs_info
-#define _cs_local	_3d_cs_local
-#define _cs_name	_3d_cs_name
-#define _cs_note	_3d_cs_note
-#define _cs_ntoa	_3d_cs_ntoa
-#define _cs_open	_3d_cs_open
-#define _cs_path	_3d_cs_path
-#define _cs_peek	_3d_cs_peek
-#define _cs_ping	_3d_cs_ping
-#define _cs_pipe	_3d_cs_pipe
-#define _cs_poll	_3d_cs_poll
-#define _cs_port	_3d_cs_port
-#define _cs_read	_3d_cs_read
-#define _cs_recv	_3d_cs_recv
-#define _cs_send	_3d_cs_send
-#define _cs_serve	_3d_cs_serve
-#define _cs_stat	_3d_cs_stat
-#define _cs_timeout	_3d_cs_timeout
-#define _cs_to		_3d_cs_to
-#define _cs_var		_3d_cs_var
-#define _cs_wakeup	_3d_cs_wakeup
-#define _cs_write	_3d_cs_write
-
-#define _msg_info_	_3d_msg_info
-#define msgcall		_3d_msgcall
-#define msggetmask	_3d_msggetmask
-#define msggetu		_3d_msggetu
-#define msggetz		_3d_msggetz
-#define msgindex	_3d_msgindex
-#define msgname		_3d_msgname
-#define msgputu		_3d_msgputu
-#define msgputz		_3d_msgputz
-#define msgread		_3d_msgread
-#define msgreturn	_3d_msgreturn
-#define msgsetmask	_3d_msgsetmask
-#define msgvcall	_3d_msgvcall
-#define msgvreturn	_3d_msgvreturn
-
-#endif

+ 0 - 528
src/cmd/3d/dir3d.c

@@ -1,528 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * 3d directory(3)
- *
- * NOTE: there are 3 limitations to this implementation
- *
- *	 (1) opendir() allocates one file descriptor for each directory
- *	     view and these remain open until closedir()
- *
- *	 (2) telldir() offsets are encoded with the directory view level
- *	     and TELLDIR() offset, and the directory view level takes
- *	     TABBITS bits, so TELLDIR() offsets are limited to (32-TABBITS)
- *	     bits, but that would be one big physical directory
- *
- *	(3) if dirent.d_type supported then directory stat.st_nlink is
- *	    inflated to foil viewpath subdirectory counting that would
- *	    skip lower view subdirs not reflected in the top level st_nlink
- */
-
-#define _def_map_ast	1
-#define _std_strtol	1
-
-#define getdirentries	______getdirentries
-#define sbrk		______sbrk
-#define strmode		______strmode
-
-#include <ast_std.h>
-
-#undef	getdirentries
-#undef	sbrk
-#undef	strmode
-
-#include "dir_3d.h"
-
-#if !_dir_ok
-#undef	dirent
-#define dirent	DIRdirent
-#endif
-
-#undef	strtol
-#undef	strtoul
-#undef	strtoll
-#undef	strtoull
-
-static int	intercepted;
-
-DIR*
-opendir3d(const char* apath)
-{
-	register char*	path;
-	register DIR*	dirp = 0;
-	register int	n;
-	int		oerrno;
-	long		visits = 0;
-	struct stat	st;
-
-	if (dirp = (DIR*)state.freedirp)
-		state.freedirp = 0;
-	else if (!(dirp = newof(0, DIR, 1, 0)))
-		return 0;
-	intercepted++;
-	dirp->fd = -1;
-	dirp->viewp = dirp->view;
-	n = state.in_2d;
-	if (path = pathreal(apath, P_SLASH, NiL))
-		state.in_2d = 2;
-	else
-		path = (char*)apath;
-	dirp->viewp->dirp = OPENDIR(path);
-	state.in_2d = n;
-	if (!dirp->viewp->dirp)
-	{
-		state.freedirp = (void*)dirp;
-		intercepted = 0;
-		return 0;
-	}
-	dirp->boundary = state.boundary;
-	if (state.in_2d)
-	{
-		dirp->overlay = 0;
-		(dirp->viewp++)->opaque = 0;
-		dirp->viewp->dirp = 0;
-	}
-	else
-	{
-		oerrno = errno;
-		n = strlen(path);
-		path[n] = '/';
-		strcpy(path + n + 1, state.opaque);
-		dirp->viewp->level = state.path.level;
-		state.in_2d++;
-		(dirp->viewp++)->opaque = LSTAT(path, &st) ? 0 : st.st_ino;
-		state.in_2d--;
-		path[n] = 0;
-		while (pathnext(state.path.name, NiL, &visits))
-		{
-			state.in_2d = 2;
-			dirp->viewp->dirp = OPENDIR(state.path.name);
-			state.in_2d = 0;
-			if (dirp->viewp->dirp)
-			{
-				n = strlen(state.path.name);
-				state.path.name[n] = '/';
-				strcpy(state.path.name + n + 1, state.opaque);
-				dirp->viewp->level = state.path.level;
-				(dirp->viewp++)->opaque = LSTAT(state.path.name, &st) ? 0 : st.st_ino;
-				state.path.name[n] = 0;
-			}
-		}
-		errno = oerrno;
-		(dirp->viewp--)->dirp = 0;
-		if (dirp->viewp <= dirp->view)
-			dirp->overlay = 0;
-		else if (!(dirp->overlay = hashalloc(NiL, HASH_set, HASH_ALLOCATE, 0)))
-		{
-			closedir(dirp);
-			intercepted = 0;
-			return 0;
-		}
-	}
-	dirp->viewp = dirp->view;
-	CHEATDIR(dirp);
-	intercepted = 0;
-	return dirp;
-}
-
-int
-closedir3d(register DIR* dirp)
-{
-	if (dirp)
-	{
-		if (intercepted++)
-		{
-			intercepted--;
-			return CLOSEDIR(dirp);
-		}
-		for (dirp->viewp = dirp->view; dirp->viewp->dirp; dirp->viewp++)
-			CLOSEDIR(dirp->viewp->dirp);
-		if (dirp->overlay)
-			hashfree(dirp->overlay);
-		if (!state.freedirp)
-			state.freedirp = (void*)dirp;
-		else
-			free((char*)dirp);
-		intercepted--;
-	}
-	return 0;
-}
-
-struct dirent*
-readdir3d(register DIR* dirp)
-{
-	register struct DIRdirent*	dp;
-	register Dir_physical_t*	covered;
-
-	if (intercepted++)
-	{
-		intercepted--;
-		return READDIR(dirp);
-	}
-	for (;;)
-	{
-		while (!(dp = (struct DIRdirent*)READDIR(dirp->viewp->dirp)))
-		{
-			if (!(++dirp->viewp)->dirp)
-			{
-				intercepted--;
-				return 0;
-			}
-			CHEATDIR(dirp);
-		}
-#ifdef D_FILENO
-		if (!state.in_2d)
-		{
-			register char*	s = dp->d_name;
-
-			/*
-			 * skip opaque and hidden entries
-			 */
-
-			if (*s++ == '.' && *s++ == '.' && *s++ == '.')
-			{
-				/*
-				 * the following for old opaque
-				 */
-
-				if (!*s && !dirp->viewp->opaque)
-					dirp->viewp->opaque = D_FILENO(dp);
-				continue;
-			}
-		}
-#endif
-
-		/*
-		 * NOTE: this (slimey) method assumes READDIR() returns . first
-		 */
-
-		if (dirp->overlay && (!dirp->boundary || dp->d_name[0] != '.' || dp->d_name[1]))
-		{
-			if ((covered = (Dir_physical_t*)hashget(dirp->overlay, dp->d_name)) && covered < dirp->viewp)
-				continue;
-			if ((dirp->viewp + 1)->dirp)
-				hashput(dirp->overlay, 0, (char*)dirp->viewp);
-		}
-#ifdef D_FILENO
-		if (D_FILENO(dp) == dirp->viewp->opaque)
-			continue;
-#endif
-		intercepted--;
-		return (struct dirent*)dp;
-	}
-	/*NOTREACHED*/
-}
-
-#undef	seekdir
-
-#define OFFBITS		(CHAR_BIT*sizeof(long)-TABBITS)
-#define SETPOS(l,o)	((((long)(l))<<OFFBITS)|GETOFF(o))
-#define GETOFF(p)	((p)&((((long)1)<<OFFBITS)-1))
-#define GETLEV(p)	(((p)>>OFFBITS)&((((long)1)<<TABBITS)-1))
-
-void
-seekdir3d(register DIR* dirp, long pos)
-{
-	register int	n;
-	int		lev;
-
-	if (intercepted++)
-	{
-		intercepted--;
-		SEEKDIR(dirp, pos);
-		return;
-	}
-	if (pos)
-	{
-		lev = GETLEV(pos);
-		pos = GETOFF(pos);
-		for (n = 0; dirp->view[n].dirp; n++)
-			if (lev == dirp->view[n].level)
-				break;
-	}
-	else
-	{
-		n = 0;
-		hashfree(dirp->overlay);
-		dirp->overlay = hashalloc(NiL, HASH_set, HASH_ALLOCATE, 0);
-	}
-	if (dirp->view[n].dirp)
-	{
-		SEEKDIR(dirp->view[n].dirp, pos);
-		dirp->viewp = &dirp->view[n];
-		CHEATDIR(dirp);
-		while (dirp->view[++n].dirp)
-			SEEKDIR(dirp->view[n].dirp, 0L);
-	}
-	intercepted--;
-}
-
-#undef	telldir
-
-long
-telldir3d(DIR* dirp)
-{
-	if (intercepted++)
-	{
-		intercepted--;
-		return TELLDIR(dirp);
-	}
-	return SETPOS(dirp->viewp->level, TELLDIR(dirp->viewp->dirp));
-}
-
-#undef	rewinddir
-
-void
-rewinddir3d(register DIR* dirp)
-{
-	seekdir(dirp, 0L);
-}
-
-#if !_nosys_readdir64
-
-struct dirent64*
-readdir643d(register DIR* dirp)
-{
-	register struct dirent64*	dp;
-	register Dir_physical_t*	covered;
-
-	if (intercepted++)
-	{
-		intercepted--;
-		return READDIR64(dirp);
-	}
-	for (;;)
-	{
-		while (!(dp = READDIR64(dirp->viewp->dirp)))
-		{
-			if (!(++dirp->viewp)->dirp)
-			{
-				intercepted--;
-				return 0;
-			}
-			CHEATDIR(dirp);
-		}
-#ifdef D_FILENO
-		if (!state.in_2d)
-		{
-			register char*	s = dp->d_name;
-
-			/*
-			 * skip opaque and hidden entries
-			 */
-
-			if (*s++ == '.' && *s++ == '.' && *s++ == '.')
-			{
-				/*
-				 * the following for old opaque
-				 */
-
-				if (!*s && !dirp->viewp->opaque)
-					dirp->viewp->opaque = D_FILENO(dp);
-				continue;
-			}
-		}
-#endif
-
-		/*
-		 * NOTE: this (slimey) method assumes READDIR() returns . first
-		 */
-
-		if (dirp->overlay && (!dirp->boundary || dp->d_name[0] != '.' || dp->d_name[1]))
-		{
-			if ((covered = (Dir_physical_t*)hashget(dirp->overlay, dp->d_name)) && covered < dirp->viewp)
-				continue;
-			if ((dirp->viewp + 1)->dirp)
-				hashput(dirp->overlay, 0, (char*)dirp->viewp);
-		}
-#ifdef D_FILENO
-		if (D_FILENO(dp) == dirp->viewp->opaque)
-			continue;
-#endif
-		intercepted--;
-		return dp;
-	}
-	/*NOTREACHED*/
-}
-
-#undef	seekdir
-
-#define OFFBITS64	(CHAR_BIT*sizeof(off64_t)-TABBITS)
-#define SETPOS64(l,o)	((((off64_t)(l))<<OFFBITS)|GETOFF(o))
-#define GETOFF64(p)	((p)&((((off64_t)1)<<OFFBITS)-1))
-#define GETLEV64(p)	(((p)>>OFFBITS)&((((off64_t)1)<<TABBITS)-1))
-
-void
-seekdir643d(register DIR* dirp, off64_t pos)
-{
-	register int	n;
-	int		lev;
-
-	if (intercepted++)
-	{
-		intercepted--;
-		SEEKDIR64(dirp, pos);
-		return;
-	}
-	if (pos)
-	{
-		lev = GETLEV(pos);
-		pos = GETOFF(pos);
-		for (n = 0; dirp->view[n].dirp; n++)
-			if (lev == dirp->view[n].level)
-				break;
-	}
-	else
-	{
-		n = 0;
-		if (dirp->overlay)
-		{
-			hashfree(dirp->overlay);
-			dirp->overlay = hashalloc(NiL, HASH_set, HASH_ALLOCATE, 0);
-		}
-	}
-	if (dirp->view[n].dirp)
-	{
-		SEEKDIR64(dirp->view[n].dirp, pos);
-		dirp->viewp = &dirp->view[n];
-		CHEATDIR(dirp);
-		while (dirp->view[++n].dirp)
-			SEEKDIR64(dirp->view[n].dirp, (off64_t)0);
-	}
-	intercepted--;
-}
-
-#undef	telldir
-
-off64_t
-telldir643d(DIR* dirp)
-{
-	if (intercepted)
-		return TELLDIR64(dirp);
-	return SETPOS(dirp->viewp->level, TELLDIR64(dirp->viewp->dirp));
-}
-
-#undef	rewinddir
-
-void
-rewinddir643d(register DIR* dirp)
-{
-	rewinddir(dirp);
-}
-
-#endif
-
-#if !_mangle_syscall && (!_lib_opendir || !_hdr_dirent)
-
-#include "dirlib.h"
-
-#undef	_dir_ok
-
-#define DIR		DIRDIR
-#undef	DIRDIR
-#define opendir		OPENDIR
-#if defined(SYS3D_opendir)
-#undef	OPENDIR
-#endif
-#define readdir		READDIR
-#if defined(SYS3D_readdir)
-#undef	READDIR
-#endif
-#define seekdir		SEEKDIR
-#if defined(SYS3D_seekdir)
-#undef	SEEKDIR
-#endif
-#define telldir		TELLDIR
-#if defined(SYS3D_telldir)
-#undef	TELLDIR
-#endif
-#define closedir	CLOSEDIR
-#if defined(SYS3D_closedir)
-#undef	CLOSEDIR
-#endif
-
-#define id		sys_id
-#define freedirp	sys_freedirp
-
-#ifndef	DIRBLKSIZ
-#ifdef	DIRBLK
-#define DIRBLKSIZ	DIRBLK
-#else
-#ifdef	DIRBUF
-#define DIRBLKSIZ	DIRBUF
-#else
-#define DIRBLKSIZ	8192
-#endif
-#endif
-#endif
-
-#include "getdents.c"
-#include "opendir.c"
-#include "readdir.c"
-#include "telldir.c"
-#include "seekdir.c"
-
-#if !_nosys_readdir64
-
-#undef	dirent
-#define dirent		dirent64
-#undef	getdents
-#define getdents	getdents64
-#define DIR		DIRDIR
-#undef	DIRDIR
-#undef	readdir
-#define readdir		READDIR64
-#if defined(SYS3D_readdir64)
-#undef	READDIR64
-#endif
-
-#if !_nosys_seekdir64
-#undef	seekdir
-#define seekdir		SEEKDIR64
-#if defined(SYS3D_seekdir64)
-#undef	SEEKDIR64
-#endif
-#endif
-
-#if !_nosys_telldir64
-#undef	telldir
-#define telldir		TELLDIR64
-#if defined(SYS3D_telldir64)
-#undef	TELLDIR64
-#endif
-#endif
-
-#include "readdir.c"
-
-#if !_nosys_telldir64
-#include "telldir.c"
-#endif
-
-#if !_nosys_seekdir64
-#include "seekdir.c"
-#endif
-
-#endif
-
-#endif

+ 0 - 224
src/cmd/3d/dir_3d.h

@@ -1,224 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-/*
- * AT&T Research
- *
- * directory stream access library private definitions
- * handles 3d file system
- */
-
-#ifndef _DIR3D_H
-#define _DIR3D_H
-
-#include "3d.h"
-
-#if !_mem_DIR
-#undef	_lib_opendir
-#endif
-
-#define DIRENT_ILLEGAL_ACCESS	1
-#define DIR			DIRDIR
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide opendir _opendir __opendir
-__STDPP__directive pragma pp:hide readdir _readdir __readdir readdir64 _readdir64 __readdir64
-__STDPP__directive pragma pp:hide rewinddir _rewinddir __rewinddir rewinddir64 _rewinddir64 __rewinddir64
-__STDPP__directive pragma pp:hide seekdir _seekdir __seekdir seekdir64 _seekdir64 __seekdir64
-__STDPP__directive pragma pp:hide telldir _telldir __telldir telldir64 _telldir64 __telldir64
-__STDPP__directive pragma pp:hide closedir _closedir __closedir
-__STDPP__directive pragma pp:hide _getdents __getdents getdents64 _getdents64 __getdents64 getdirentries
-#else
-#define opendir		DIRopendir
-#define _opendir	_DIRopendir
-#define __opendir	__DIRopendir
-#define readdir		DIRreaddir
-#define _readdir	_DIRreaddir
-#define __readdir	__DIRreaddir
-#define readdir64	DIRreaddir64
-#define _readdir64	_DIRreaddir64
-#define __readdir64	__DIRreaddir64
-#if _lib_rewinddir
-#define rewinddir	DIRrewinddir
-#define _rewinddir	_DIRrewinddir
-#define __rewinddir	__DIRrewinddir
-#define rewinddir64	DIRrewinddir64
-#define _rewinddir64	_DIRrewinddir64
-#define __rewinddir64	__DIRrewinddir64
-#endif
-#define seekdir		DIRseekdir
-#define _seekdir	_DIRseekdir
-#define __seekdir	__DIRseekdir
-#define seekdir64	DIRseekdir64
-#define _seekdir64	_DIRseekdir64
-#define __seekdir64	__DIRseekdir64
-#if _lib_telldir
-#define telldir		DIRtelldir
-#define _telldir	_DIRtelldir
-#define __telldir	__DIRtelldir
-#define telldir64	DIRtelldir64
-#define _telldir64	_DIRtelldir64
-#define __telldir64	__DIRtelldir64
-#endif
-#define closedir	DIRclosedir
-#define _closedir	_DIRclosedir
-#define __closedir	__DIRclosedir
-#define _getdents	_DIRgetdents
-#define __getdents	__DIRgetdents
-#define getdents64	DIRgetdents64
-#define _getdents64	_DIRgetdents64
-#define __getdents64	__DIRgetdents64
-#define getdirentries	DIRgetdirentries
-#endif
-
-#define _BLD_ast	1
-#include <ast_dir.h>
-#undef	_BLD_ast
-
-#if _lib_readdir64 && _typ_struct_dirent64
-#undef	dirent
-#undef	DIRdirent
-#define DIRdirent	dirent
-#endif
-
-#include <hash.h>
-
-#if !defined(SYS3D_opendir)
-extern DIR*		OPENDIR(const char*);
-#endif
-#if !defined(SYS3D_readdir)
-extern struct dirent*	READDIR(DIR*);
-#endif
-#if !defined(SYS3D_seekdir)
-extern void		SEEKDIR(DIR*, long);
-#endif
-#if !defined(SYS3D_telldir)
-extern long		TELLDIR(DIR*);
-#endif
-#if !defined(SYS3D_rewinddir)
-extern void		REWINDDIR(DIR*);
-#endif
-#if !defined(SYS3D_closedir)
-extern void		CLOSEDIR(DIR*);
-#endif
-
-#undef	DIR
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide opendir _opendir __opendir
-__STDPP__directive pragma pp:nohide readdir _readdir __readdir readdir64 _readdir64 __readdir64
-__STDPP__directive pragma pp:nohide rewinddir _rewinddir __rewinddir rewinddir64 _rewinddir64 __rewinddir64
-__STDPP__directive pragma pp:nohide seekdir _seekdir __seekdir seekdir64 _seekdir64 __seekdir64
-__STDPP__directive pragma pp:nohide telldir _telldir __telldir telldir64 _telldir64 __telldir64
-__STDPP__directive pragma pp:nohide closedir _closedir __closedir
-__STDPP__directive pragma pp:nohide _getdents __getdents getdents64 _getdents64 __getdents64 getdirentries
-#else
-#undef	opendir
-#undef	_opendir
-#undef	__opendir
-#undef	readdir
-#undef	_readdir
-#undef	__readdir
-#undef	readdir64
-#undef	_readdir64
-#undef	__readdir64
-#ifndef REWINDDIR
-#if _lib_rewinddir
-#undef	rewinddir
-#undef	_rewinddir
-#undef	__rewinddir
-#undef	rewinddir64
-#undef	_rewinddir64
-#undef	__rewinddir64
-#else
-#define REWINDDIR(p)	rewinddir(p)
-#define REWINDDIR64(p)	rewinddir64(p)
-#endif
-#endif
-#undef	seekdir
-#undef	_seekdir
-#undef	__seekdir
-#undef	seekdir64
-#undef	_seekdir64
-#undef	__seekdir64
-#ifndef TELLDIR
-#if _lib_telldir
-#undef	telldir
-#undef	_telldir
-#undef	__telldir
-#undef	telldir64
-#undef	_telldir64
-#undef	__telldir64
-#else
-#define TELLDIR64(p)	telldir64(p)
-#endif
-#endif
-#undef	closedir
-#undef	_closedir
-#undef	__closedir
-#undef	_getdents
-#undef	__getdents
-#undef	getdents64
-#undef	_getdents64
-#undef	__getdents64
-#undef	getdirentries
-#endif
-
-#if _mem_DIR
-#define CHEATDIR(p)	((p)->dir = *(p)->viewp->dirp)
-#else
-#define CHEATDIR(p)
-#endif
-
-typedef struct
-{
-	DIRDIR*		dirp;		/* system stream pointer	*/
-	ino_t		opaque;		/* opaque inode number		*/
-	int		level;		/* view level			*/
-} Dir_physical_t;
-
-typedef struct
-{
-	int		fd;		/* placeholder for dirfd()	*/
-#if _mem_DIR
-	DIRDIR		dir;		/* in case user checks *DIRDIR	*/
-#endif
-	Dir_physical_t*	viewp;		/* current directory in view	*/
-	Dir_physical_t	view[TABSIZE];	/* dirp's in view		*/
-	Hash_table_t*	overlay;	/* directory overlay hash	*/
-	int		boundary;	/* return . at each view level	*/
-} DIR;					/* directory stream descriptor	*/
-
-extern int		closedir(DIR*);
-extern DIR*		opendir(const char*);
-#if _HUH_2008_11_21
-extern struct dirent*	readdir(DIR*);
-#endif
-#if _lib_rewinddir && !defined(rewinddir)
-extern void		rewinddir(DIR*);
-#endif
-extern void		seekdir(DIR*, long);
-#if _lib_telldir && !defined(telldir)
-extern long		telldir(DIR*);
-#endif
-
-#endif

+ 0 - 46
src/cmd/3d/dll3d.c

@@ -1,46 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#define _def_map_ast	1
-#define _std_strtol	1
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE	1
-#endif
-#ifndef __EXTENSIONS__
-#define __EXTENSIONS__	1
-#endif
-
-#define strmode		______strmode
-
-#include <ast_std.h>
-
-#undef	strmode
-
-#include "dll_3d.h"
-
-#undef	strtol
-#undef	strtoul
-#undef	strtoll
-#undef	strtoull
-
-#include "dllnext.c"
-#include "dlfcn.c"

+ 0 - 36
src/cmd/3d/dll_3d.h

@@ -1,36 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "lib_3d.h"
-
-#include <dlldefs.h>
-
-#define dllopen		dlopen
-
-#ifdef _DLL_RLD_SYM_TYPE
-#define _dll_next	_3d_dllnext
-extern void*		_dll_next(int, _DLL_RLD_SYM_TYPE*);
-#else
-#define dllnext		_3d_dllnext
-extern void*		dllnext(int);
-#endif

+ 0 - 45
src/cmd/3d/dup23d.c

@@ -1,45 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef dup23d
-
-int
-dup23d(int fd, register int r)
-{
-	initialize();
-	if (r >= 0 && r < elementsof(state.file) && state.file[r].reserved) close(r);
-	r = DUP2(fd, r);
-#if FS
-	if (r >= 0 && r < elementsof(state.file))
-		fs3d_dup(fd, r);
-#endif
-	return(r);
-}
-
-#else
-
-NoN(dup2)
-
-#endif

+ 0 - 91
src/cmd/3d/dup3d.c

@@ -1,91 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if FS
-
-int
-fs3d_dup(int ofd, int nfd)
-{
-	register Mount_t*	mp;
-
-	if (nfd >= 0 && ofd >= 0 && ofd < elementsof(state.file))
-	{
-		if (state.cache)
-		{
-			if (!(state.file[ofd].flags & FILE_OPEN))
-				fileinit(ofd, NiL, NiL, 0);
-			state.file[nfd] = state.file[ofd];
-			state.file[nfd].flags &= ~FILE_CLOEXEC;
-			state.file[nfd].reserved = 0;
-			if (nfd > state.cache)
-				state.cache = nfd;
-			if (nfd > state.open)
-				state.open = nfd;
-			if (mp = state.file[nfd].mount)
-				fscall(mp, MSG_dup, nfd, ofd);
-			for (mp = state.global; mp; mp = mp->global)
-				if (fssys(mp, MSG_dup))
-					fscall(mp, MSG_dup, nfd, ofd);
-		}
-#if defined(fchdir3d)
-		if (state.file[nfd].dir)
-		{
-			free(state.file[nfd].dir);
-			state.file[nfd].dir = 0;
-		}
-		if (state.file[ofd].dir && (state.file[nfd].dir = newof(0, Dir_t, 1, strlen(state.file[ofd].dir->path))))
-		{
-			strcpy(state.file[nfd].dir->path, state.file[ofd].dir->path);
-			state.file[nfd].dir->dev = state.file[ofd].dir->dev;
-			state.file[nfd].dir->ino = state.file[ofd].dir->ino;
-		}
-#endif
-	}
-	return 0;
-}
-
-#endif
-
-#ifdef dup3d
-
-int
-dup3d(int fd)
-{
-	register int	r;
-
-	initialize();
-	r = DUP(fd);
-#if FS
-	if (r >= 0 && r < elementsof(state.file))
-		fs3d_dup(fd, r);
-#endif
-	return r;
-}
-
-#else
-
-NoN(dup)
-
-#endif

+ 0 - 248
src/cmd/3d/error.c

@@ -1,248 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * Glenn Fowler
- * AT&T Research
- *
- * error and message formatter
- *
- *	level is the error level
- *	level >= error_info.core!=0 dumps core
- *	level >= ERROR_FATAL calls error_info.exit
- *	level < 0 is for debug tracing
- *
- * NOTE: non-sfio version just for 3d
- */
-
-#include "3d.h"
-
-#if DEBUG
-
-static ssize_t
-fs3d_write(int fd, const void* buf, size_t n)
-{
-	return(WRITE(fd, buf, n));
-}
-
-#undef error_info
-#define error_info	_error_info_
-
-Error_info_t	_error_info_ = { 2, exit, fs3d_write };
-Error_info_t*	_error_infop_ = &_error_info_;
-Error_info_t*	_error_data_ = &_error_info_;
-
-/*
- * print a name, converting unprintable chars
- */
-
-static void
-print(char** buf, char* end, register char* name, char* delim)
-{
-	register char*	s = *buf;
-	register char*	e = end;
-	register int	c;
-
-	while (c = *name++)
-	{
-		if (c & 0200)
-		{
-			c &= 0177;
-			if (s >= e) break;
-			*s++ = '?';
-		}
-		if (c < ' ')
-		{
-			c += 'A' - 1;
-			if (s >= e) break;
-			*s++ = '^';
-		}
-		if (s >= e) break;
-		*s++ = c;
-	}
-	while (*delim)
-	{
-		if (s >= e) break;
-		*s++ = *delim++;
-	}
-	*buf = s;
-}
-
-void
-errorv(const char* lib, int level, va_list ap)
-{
-	register int	n;
-	int		fd;
-	int		flags;
-	char*		b;
-	char*		e;
-	char*		format;
-	char		buf[4096];
-
-	int		line;
-	char*		file;
-
-	static int	intercepted;
-
-	if (intercepted++)
-	{
-		intercepted--;
-		return;
-	}
-	if (level > 0)
-	{
-		flags = level & ~ERROR_LEVEL;
-		level &= ERROR_LEVEL;
-	}
-	else flags = 0;
-	if ((fd = fsfd(&state.fs[FS_option])) <= 0 || level < error_info.trace || lib && (error_info.clear & ERROR_LIBRARY) || level < 0 && error_info.mask && !(error_info.mask & (1<<(-level - 1))))
-	{
-		if (level >= ERROR_FATAL) (*error_info.exit)(level - 1);
-		intercepted--;
-		return;
-	}
-	if (error_info.trace < 0) flags |= ERROR_LIBRARY|ERROR_SYSTEM;
-	flags |= error_info.set;
-	flags &= ~error_info.clear;
-	if (!lib) flags &= ~ERROR_LIBRARY;
-	e = (b = buf) + elementsof(buf) - 1;
-	file = error_info.id;
-	if (flags & ERROR_USAGE)
-	{
-		bprintf(&b, e, (flags & ERROR_NOID) ? "       " : "Usage: ");
-		if (file) print(&b, e, file, " ");
-	}
-	else if (level && !(flags & ERROR_NOID))
-	{
-		if (file) print(&b, e, file, (flags & ERROR_LIBRARY) ? " " : ": ");
-		if (flags & ERROR_LIBRARY)
-			bprintf(&b, e, "[%s library]: ", lib);
-	}
-	if (level > 0 && error_info.line > 0)
-	{
-		if (error_info.file && *error_info.file)
-			bprintf(&b, e, "\"%s\", ", error_info.file);
-		bprintf(&b, e, "line %d: ", error_info.line);
-	}
-	switch (level)
-	{
-	case 0:
-		break;
-	case ERROR_WARNING:
-		error_info.warnings++;
-		bprintf(&b, e, "warning: ");
-		break;
-	case ERROR_PANIC:
-		error_info.errors++;
-		bprintf(&b, e, "panic: ");
-		break;
-	default:
-		if (level < 0)
-		{
-			if (error_info.trace < -1) bprintf(&b, e, "debug%d:%s", level, level > -10 ? " " : "");
-			else bprintf(&b, e, "debug: ");
-			for (n = 0; n < error_info.indent; n++)
-			{
-				*b++ = ' ';
-				*b++ = ' ';
-			}
-		}
-		else error_info.errors++;
-		break;
-	}
-	if (flags & ERROR_OUTPUT) fd = va_arg(ap, int);
-	if (flags & ERROR_SOURCE)
-	{
-		/*
-		 * source ([version], file, line) message
-		 */
-
-		file = va_arg(ap, char*);
-		line = va_arg(ap, int);
-		if (error_info.version) bprintf(&b, e, "(%s: %s, line %d) ", error_info.version, file, line);
-		else bprintf(&b, e, "(%s, line %d) ", file, line);
-	}
-	format = va_arg(ap, char*);
-	bvprintf(&b, e, format, ap);
-	if (!(flags & ERROR_PROMPT))
-	{
-		if ((flags & ERROR_SYSTEM) && errno && errno != error_info.last_errno)
-		{
-			n = state.in_2d;
-			state.in_2d = 1;
-			bprintf(&b, e, " [%s]", fmterror(errno));
-			state.in_2d = n;
-			if (error_info.set & ERROR_SYSTEM) errno = 0;
-			error_info.last_errno = (level >= 0) ? 0 : errno;
-		}
-		*b++ = '\n';
-	}
-	*b = 0;
-	if (error_info.write) (*error_info.write)(fd, buf, b - buf);
-	if (level >= error_info.core && error_info.core)
-	{
-		signal(SIGQUIT, SIG_DFL);
-		kill(getpid(), SIGQUIT);
-		pause();
-	}
-	if (level >= ERROR_FATAL) (*error_info.exit)(level - ERROR_FATAL + 1);
-	intercepted--;
-}
-
-void
-error(int level, ...)
-{
-	va_list	ap;
-
-	va_start(ap, level);
-	errorv(NiL, level, ap);
-	va_end(ap);
-}
-
-int
-errormsg(const char* dictionary, int level, ...)
-{
-	va_list	ap;
-
-	va_start(ap, level);
-	errorv(dictionary, level, ap);
-	va_end(ap);
-	return 0;
-}
-
-int
-errorf(void* handle, void* discipline, int level, ...)
-{
-	va_list	ap;
-
-	va_start(ap, level);
-	errorv(discipline ? *((char**)handle) : (char*)handle, (discipline || level < 0) ? level : (level | ERROR_LIBRARY), ap);
-	va_end(ap);
-	return 0;
-}
-
-#else
-
-NoN(error)
-
-#endif

+ 0 - 30
src/cmd/3d/execv.c

@@ -1,30 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-int
-execv(const char* path, char* const argv[])
-{
-	return(execve(path, argv, environ));
-}

+ 0 - 150
src/cmd/3d/execve3d.c

@@ -1,150 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if _hdr_alloca
-
-#include <alloca.h>
-
-#else
-
-void
-fix(void)
-{
-	if (state.brk.beg)
-	{
-		ssize_t	n;
-
-		if (state.brk.end && (n = state.brk.end - state.brk.beg) > 0)
-		{
-			memset(state.brk.beg, 0, n);
-			if ((char*)sbrk(0) == state.brk.end)
-				sbrk(-n);
-		}
-		state.brk.beg = state.brk.end = 0;
-	}
-}
-
-#endif
-
-int
-execve3d(const char* path, char* const* aargv, char* const* aarge)
-{
-	char**		argv = (char**)aargv;
-	char**		arge = (char**)aarge;
-	register char*	sp;
-	register char*	ep;
-	register int	size;
-	register int	argn = 0;
-	int		n;
-	char*		tp;
-	char		buf[PATH_MAX];
-#if FS
-	Mount_t*	mp;
-#endif
-
-	if (!(sp = pathreal(path, 0, NiL)))
-		return(-1);
-	if (state.safe && !state.path.level)
-	{
-		errno = EPERM;
-		return(-1);
-	}
-	if (*sp == '/')
-	{
-#if HUH920211 /* mh corrupts static state strings */
-		if (streq(sp, state.binsh)) sp = state.shell;
-#else
-		if (streq(sp, "/bin/sh")) sp = state.shell;
-#endif
-	}
-	else if (!state.in_2d && --sp > state.path.name) *--sp = '.';
-	sp = strncpy(buf, sp, sizeof(buf));
-	if (state.level)
-	{
-		/*
-		 * make sure dot is set correctly if not top level
-		 */
-
-		pathreal(state.pwd, 0, NiL);
-	}
-	if (arge == state.env + 1) arge--;
-	else
-	{
-		register char**	op = arge;
-
-		/*
-		 * compute size of environment pointers
-		 */
-
-		while (*op++) argn++;
-		argn += 2;
-		argn *= sizeof(char*);
-	}
-	size = mapdump(NiL, NiL, MAP_EXEC);
-	n = size + argn + 10;
-	n = roundof(n, 32);
-#if _hdr_alloca
-	state.brk.beg = (char*)alloca(n);
-#else
-	state.brk.beg = (char*)sbrk(n);
-	state.brk.end = (char*)sbrk(0);
-#endif
-	ep = state.brk.beg + argn + 10 - sizeof(var_3d) + 1;
-	tp = strcopy(ep, var_3d);
-	size = mapdump(NiL, tp, MAP_EXEC);
-	if (!keep(tp, size, 1))
-		reclaim();
-	else
-	{
-		if (argn)
-		{
-			register char**	op = arge;
-			register char**	np;
-
-			arge = (char**)state.brk.beg;
-			np = arge + 1;
-			while (*np++ = *op++);
-		}
-		arge[0] = ep;
-	}
-#if FS
-	for (mp = state.global; mp; mp = mp->global)
-	{
-		if (fssys(mp, MSG_exec))
-			fscall(mp, MSG_exec, 0, sp, argv, arge);
-		if (fssys(mp, MSG_close))
-		{
-			register File_t*	fp;
-
-			for (fp = state.file; fp <= state.file + state.open; fp++)
-				if ((fp->flags & FILE_OPEN) && ((fp->flags & FILE_CLOEXEC) || (size = FCNTL(fp - state.file, F_GETFD, NiL)) >= 0 && (size & FD_CLOEXEC)) && !FSTAT(fp - state.file, &state.path.st))
-					fscall(mp, MSG_close, 0, fp - state.file, state.path.st.st_mtime);
-		}
-	}
-#endif
-	EXECVE(sp, argv, arge);
-	reclaim();
-	return(-1);
-}

+ 0 - 42
src/cmd/3d/exit3d.c

@@ -1,42 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-void
-_exit3d(int code)
-{
-#if FS
-	Mount_t*	mp;
-#endif
-
-	PULL_IN_3D;
-
-	initialize();
-#if FS
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_exit))
-			fscall(mp, MSG_exit, 0, code, state.pid);
-#endif
-	EXIT(code);
-}

+ 0 - 58
src/cmd/3d/facl3d.c

@@ -1,58 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if !defined(ACL3D) || !defined(SETACL)
-
-#define aclent_t	char
-
-#endif
-
-#define MSG_facl	MSG_INIT(MSG_control, 051131, MSG_VAR_FILE)
-
-int
-facl3d(int fd, int cmd, int cnt, aclent_t* buf)
-{
-	register int	r;
-
-#if FS
-	register Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_facl, 0, fd, cmd, cnt, buf))
-		return(state.ret);
-	mp = monitored();
-#endif
-	r = FACL(fd, cmd, cnt, buf);
-#if FS
-	if (r >= 0)
-	{
-		if (mp)
-			fscall(mp, MSG_facl, 0, fd, cmd, cnt, buf);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_facl))
-				fscall(mp, MSG_facl, 0, fd, cmd, cnt, buf);
-	}
-#endif
-	return(r);
-}

+ 0 - 45
src/cmd/3d/fchdir3d.c

@@ -1,45 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if defined(fchdir3d)
-
-int
-fchdir3d(int fd)
-{
-	Dir_t*		dp;
-	struct stat	st;
-
-	if (fd >= 0 && fd < elementsof(state.file) && (dp = state.file[fd].dir) && !FSTAT(fd, &st) && dp->dev == st.st_dev && dp->ino == st.st_ino)
-		chdir(dp->path);
-	else if (FCHDIR(fd))
-		return -1;
-	return 0;
-}
-
-#else
-
-NoP(fchdir)
-
-#endif

+ 0 - 54
src/cmd/3d/fchmod3d.c

@@ -1,54 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef fchmod3d
-
-int
-fchmod3d(int fd, mode_t mode)
-{
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_fchmod, 0, fd, mode))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (FCHMOD(fd, mode))
-		return(-1);
-#if FS
-	if (mp)
-		fscall(mp, MSG_fchmod, 0, fd, mode);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_fchmod))
-			fscall(mp, MSG_fchmod, 0, fd, mode);
-#endif
-	return(0);
-}
-
-#else
-
-NoN(fchmod)
-
-#endif

+ 0 - 54
src/cmd/3d/fchown3d.c

@@ -1,54 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef fchown3d
-
-int
-fchown3d(int fd, uid_t uid, gid_t gid)
-{
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_fchown, 0, fd, uid, gid))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (FCHOWN(fd, uid, gid))
-		return -1;
-#if FS
-	if (mp)
-		fscall(mp, MSG_fchown, 0, fd, uid, gid);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_fchown))
-			fscall(mp, MSG_fchown, 0, fd, uid, gid);
-#endif
-	return 0;
-}
-
-#else
-
-NoN(fchown)
-
-#endif

+ 0 - 73
src/cmd/3d/fcntl3d.c

@@ -1,73 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef	fcntl3d
-
-#include <stdarg.h>
-
-int
-fcntl3d(int fd, int op, ...)
-{
-	register int	r;
-	int		n;
-	void*		arg;
-	va_list		ap;
-
-	initialize();
-	va_start(ap, op);
-	arg = va_arg(ap, void*);
-	va_end(ap);
-	n = (int)integralof(arg);
-	if (op == F_DUPFD && state.file[n].reserved)
-		close(n);
-	r = FCNTL(fd, op, arg);
-#if FS
-	if (r >= 0 && r < elementsof(state.file))
-		switch (op)
-		{
-		case F_DUPFD:
-			fs3d_dup(fd, r);
-			break;
-		case F_SETFD:
-			if (state.cache)
-			{
-				if (!(n & FD_CLOEXEC))
-					state.file[fd].flags &= ~FILE_CLOEXEC;
-				else if (!(state.file[fd].flags & FILE_OPEN))
-					fileinit(fd, NiL, NiL, 1);
-				else
-					state.file[fd].flags |= FILE_CLOEXEC;
-			}
-			break;
-		}
-#endif
-	return r;
-}
-
-#else
-
-NoN(fcntl)
-
-#endif

+ 0 - 68
src/cmd/3d/features/peek.c

@@ -1,68 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include <sys/types.h>
-
-#if _stream_peek
-#include <ast_tty.h>
-#include <stropts.h>
-#endif
-
-#if _socket_peek
-#include <sys/socket.h>
-#endif
-
-int
-main()
-{
-	int		fds[2];
-	static char	msg[] = "test";
-#if _stream_peek
-	struct strpeek	pk;
-#endif
-
-	if (pipe(fds) || write(fds[1], msg, sizeof(msg)) != sizeof(msg))
-		return(0);
-#if _stream_peek
-	pk.flags = 0;
-	pk.ctlbuf.maxlen = -1;
-	pk.ctlbuf.len = 0;
-	pk.ctlbuf.buf = 0;
-	pk.databuf.maxlen = sizeof(msg);
-	pk.databuf.buf = msg;
-	pk.databuf.len = 0;
-	if (ioctl(fds[0], I_PEEK, &pk) > 0 && pk.databuf.len == sizeof(msg))
-	{
-		printf("#undef	_socket_peek\n");
-		return(0);
-	}
-#endif
-#if _socket_peek
-	if (recv(fds[0], msg, sizeof(msg), MSG_PEEK) == sizeof(msg))
-	{
-		printf("#undef	_stream_peek\n");
-		return(0);
-	}
-#endif
-	return(0);
-}

+ 0 - 1207
src/cmd/3d/features/syscall.sh

@@ -1,1207 +0,0 @@
-########################################################################
-#                                                                      #
-#               This software is part of the ast package               #
-#          Copyright (c) 1989-2011 AT&T Intellectual Property          #
-#                      and is licensed under the                       #
-#                 Eclipse Public License, Version 1.0                  #
-#                    by AT&T Intellectual Property                     #
-#                                                                      #
-#                A copy of the License is available at                 #
-#          http://www.eclipse.org/org/documents/epl-v10.html           #
-#         (with md5 checksum b35adb5213ca9657e911e9befb180842)         #
-#                                                                      #
-#              Information and Software Systems Research               #
-#                            AT&T Research                             #
-#                           Florham Park NJ                            #
-#                                                                      #
-#                 Glenn Fowler <gsf@research.att.com>                  #
-#                  David Korn <dgk@research.att.com>                   #
-#                   Eduardo Krell <ekrell@adexus.cl>                   #
-#                                                                      #
-########################################################################
-: generate the 3d syscall features
-: include sys.tab
-#
-# this is the worst iffe script, we promise
-#
-# @(#)syscall.sh (AT&T Research) 2011-12-06
-#
-eval $1
-shell=
-( typeset -u u=a && test "A" = "$u" ) >/dev/null 2>&1 && shell=u$shell
-( integer n=1+1 && test "2" = "$n" ) >/dev/null 2>&1 && shell=n$shell
-( x=a.b.c && test "a" = "${x%%.*}" ) >/dev/null 2>&1 && shell=e$shell
-shift
-case $1 in
-"")	set /dev/null ;;
-esac
-input=$1
-comma=","
-nl="
-"
-tmpsuf="i z m d r f u s n b g t e"
-tmpall=
-for i in $tmpsuf
-do	tmpall=$tmpall$i
-done
-tmpall="$tmp.[$tmpall]"
-rm -f $tmpall
-sys=
-fun=
-stdc=
-sym=
-vers=
-weak=
-case $shell in
-*n*)	integer inx ;;
-esac
-inx=0
-A_OUTPUT=1
-A_INPUT=2
-A_ACCESS=3
-A_MODE=4
-A_NUMBER=5
-A_OPEN=6
-A_POINTER=7
-A_SIZE=8
-A_STRING=9
-A_VECTOR=A
-echo "
-#pragma prototyped"
-echo "
-#if defined(header)
-#include \"${tmp}s.h\"
-#endif
-extern
-#if defined(__cplusplus)
-\"C\"
-#endif
-int syscall();
-static int ((*i)())=syscall;
-main() { return(i==0); }" > $tmp.c
-
-SYS_PREFIX=
-SYS_HEADER=
-SYS_CALL=
-for f in syscall.h sys/syscall.h
-do	echo "
-#include <$f>
-int x;" > ${tmp}s.c
-	if	$cc -c ${tmp}s.c </dev/null >/dev/null
-	then	SYS_HEADER=$f
-		echo "
-#include <$f>
-" >> $tmp.f
-		echo "#include <sys/syscall.h>
-#ifdef SYS_exit
-int i;
-#else
-(
-#endif" > ${tmp}s.c
-		if	$cc -c ${tmp}s.c
-		then	l=fun
-			echo "int ${l}() { return 0; }" > ${tmp}s.c
-			if	$cc -c ${tmp}s.c </dev/null >/dev/null
-			then	SYS_CALL=syscall
-				s=`nm ${tmp}s.o | sed -e /${l}/!d -e 's/.*[^_]\(_*'$l'[0-9]*\).*/\1/'`
-				case $s in
-				_*)	SYS_PREFIX=_ ;;
-				esac
-			fi
-		fi
-		break
-	fi
-done
-
-while	:
-do	echo '#include <sys/types.h>
-#include <dlfcn.h>
-#ifdef RTLD_LAZY
-main()
-{
-	dlsym(dlopen("/lib/libc.so", RTLD_LAZY), "open");
-	return(0);
-}
-#else
-(
-#endif' > ${tmp}h.c
-	if	rm -f $tmp.x && {
-			$cc -o $tmp.x ${tmp}h.c -ldl </dev/null >/dev/null ||
-			$cc -o $tmp.x ${tmp}h.c </dev/null >/dev/null
-		} &&
-		$executable $tmp.x
-	then	sys=dynamic
-		echo "#define _dynamic_syscall		1" >> $tmp.m
-		lib=
-		for d in /lib /usr/lib /shlib /usr/shlib
-		do	for s in "*.*" "*.[!a]*"
-			do	for b in libc
-				do	for i in $d/$b.$s
-					do	if	test -f $i
-						then	lib=$i
-						fi
-					done
-					case $lib in
-					?*)	break 3 ;;
-					esac
-				done
-			done
-		done
-		case $lib in
-		*.[0-9]*.[0-9]*)
-			i=`echo $lib | sed 's,\([^0-9]*[0-9]*\).*,\1,`
-			if	test -f $i
-			then	lib=$i
-			fi
-			;;
-		esac
-		# some run time linkers barf with /lib/xxx if
-		# /usr/lib/xxx is there
-		case $lib in
-		/usr*)	;;
-		*)	if	test -f /usr$lib
-			then	lib=/usr$lib
-			fi
-			;;
-		esac
-		case $lib in
-		"")	lib=/lib/libc.so.1 ;;
-		esac
-		echo '#include <sys/types.h>
-#include <dlfcn.h>
-#ifdef RTLD_NEXT
-main()
-{
-	return 0;
-}
-#else
-(
-#endif' > ${tmp}h.c
-		if	rm -f $tmp.x && {
-			$cc -o $tmp.x ${tmp}h.c -ldl </dev/null >/dev/null ||
-			$cc -o $tmp.x ${tmp}h.c </dev/null >/dev/null
-			} &&
-			$executable $tmp.x
-		then	weak=1
-		fi
-		break
-	fi
-	if	rm -f $tmp.x &&
-		$cc $static -o $tmp.x $tmp.c </dev/null >/dev/null &&
-		$executable $tmp.x
-	then	case $SYS_HEADER in
-		?*)	echo "
-#include <$f>
-SYS" > ${tmp}s.c
-			;;
-		esac
-		inc="#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide syscall
-#else
-#define syscall        ______syscall
-#endif
-#include <$SYS_HEADER>
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide syscall
-#else
-#undef  syscall
-#endif"
-		{
-		case $SYS_HEADER in
-		?*)	echo "$inc" ;;
-		*)	echo "#define SYS_exit 1" ;;
-		esac
-		echo "main() { syscall(SYS_exit, 0); exit(1); }"
-		} > ${tmp}m.c
-		if	rm -f ${tmp}m.x &&
-			$cc $static -o ${tmp}m.x ${tmp}m.c </dev/null >/dev/null &&
-			./${tmp}m.x
-		then	case $SYS_HEADER in
-			?*)	echo "$inc" ;;
-			esac
-			rm -f $tmp.x
-			if	rm -f $tmp.x &&
-				$cc -Dsyscall=swapon $static -o $tmp.x $tmp.c </dev/null >/dev/null &&
-				$executable $tmp.x
-			then	sys=bsd
-			else	sys=att
-			fi
-			echo "#define _static_syscall		1" >> $tmp.m
-			break
-		fi
-	fi
-	sys=mangle
-	echo "#define _mangle_syscall		1" >> $tmp.m
-	if	LD_PRELOAD=/dev/null ${_ld_preload_test-cat} </dev/null >/dev/null
-	then	echo "
-static int _lib_mangle_lib_;" >> $tmp.m
-	fi
-	break
-done
-echo iffe: test: type=$sys header=$SYS_HEADER ${SYS_CALL:+call=$SYS_CALL} ${SYS_PREFIX:+prefix=$SYS_PREFIX} >&$stderr
-echo "#if SYSTRACE3D
-
-/* output */
-
-#define A_OUTPUT	0x$A_OUTPUT
-
-/* input only */
-
-#define A_INPUT		0x$A_INPUT
-#define A_ACCESS	0x$A_ACCESS
-#define A_MODE		0x$A_MODE
-#define A_NUMBER	0x$A_NUMBER
-#define A_OPEN		0x$A_OPEN
-#define A_POINTER	0x$A_POINTER
-#define A_SIZE		0x$A_SIZE
-#define A_STRING	0x$A_STRING
-#define A_VECTOR	0x$A_VECTOR
-
-typedef struct
-{
-	Sysfunc_t	func;
-	short		index;
-	short		nov;
-	unsigned short	call;
-	unsigned short	args;
-	const char*	name;
-	unsigned char	type[8];
-	unsigned long	count;
-	unsigned long	megs;
-	unsigned long	units;
-	Sysfunc_t	last;
-	unsigned short	active;
-} Systrace_t;
-" > $tmp.b
-
-echo "static Systrace_t	sys_trace[] =
-{
-" > $tmp.t
-case $sys in
-*)	SYSCALL3D=1 ;;
-esac
-for i in $cc
-do	case $i in
-	-D*)	case $shell in
-		*e*)	v=${i#-D}
-			v=${v%%=*}
-			;;
-		*)	v=`echo '' $i | sed -e 's/^ -D//' -e 's/=.*//'`
-			;;
-		esac
-		eval $v=1
-		;;
-	esac
-done
-exec <$input
-ifi=0
-ifs=${IFS-'
-	 '}
-while	:
-do	IFS="	"
-	read line || break
-	set $line
-	IFS=$ifs
-	case $1 in
-	\#*)	continue ;;
-	"")	break ;;
-	"if")	shift
-		eval $*
-		case $? in
-		0)	ifi="0 $ifi" ;;
-		*)	ifi="1 $ifi" ;;
-		esac
-		continue
-		;;
-	"elif")	case $ifi in
-		0)	echo "$0: no if for elif" >&$stderr
-			break
-			;;
-		esac
-		case $ifi in
-		1*)	shift
-			eval $*
-			case $? in
-			0)	;;
-			*)	continue ;;
-			esac
-			i=0
-			;;
-		*)	i=2
-			;;
-		esac
-		set $ifi
-		shift
-		ifi="$i $ifi"
-		;;
-	"else")	case $ifi in
-		0)	echo "$0: no if for else" >&$stderr
-			break
-			;;
-		esac
-		case $ifi in
-		1*)	i=0 ;;
-		*)	i=2 ;;
-		esac
-		set $ifi
-		shift
-		ifi="$i $ifi"
-		;;
-	"fi")	case $ifi in
-		0)	echo "$0: no if for fi" >&$stderr
-			break
-			;;
-		esac
-		set $ifi
-		shift
-		ifi=$*
-		continue
-		;;
-	esac
-	case $ifi in
-	0*)	;;
-	*)	continue ;;
-	esac
-	l=$1
-	q=$2
-	r=$3
-	p=$4
-	shift 4
-	echo iffe: test: system call $l >&$stderr
-	case $r in
-	"bool")	cast="(" tsac="<0?-1:0)" r=int ;;
-	"int")	cast= tsac= ;;
-	"DIR*")	cast="(DIR$r)" tsac= ;;
-	*)	cast="($r)" tsac= ;;
-	esac
-	case $shell in
-	*u*)	typeset -u u=$l ;;
-	*)	u=`echo $l | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
-	esac
-	w=$l
-	case $l in
-	_*)	case $shell in
-		*e*)	v=${u#?} ;;
-		*)	v=`echo $u | sed 's/.//'` ;;
-		esac
-		echo "#define $v			$u" >> $tmp.r
-		m=$l
-		echo "#undef	$l	/*MANGLENAME*/" >> $tmp.z
-		;;
-	*)	U=$u
-		m=_$l
-		for i in __libc_ _ __
-		do	if	rm -f $tmp.x &&
-				$cc -Dsyscall=${i}$l $static -o $tmp.x $tmp.c </dev/null >/dev/null &&
-				$executable $tmp.x
-			then	case $sys:$l in
-				*:creat|*:creat[0-9]*)	# sol6.sun4
-					;;
-				*:open|*:open[0-9]*)	# sol6.sun4
-					;;
-				dynamic:*)
-					# test if the _ version is a weak ref
-					echo "#include <sys/types.h>
-#include <dlfcn.h>
-main()
-{
-	void*	p;
-	void*	u;
-	void*	r;
-	p = dlopen(\"$lib\", 1);
-	u = dlsym(p, \"${i}$l\");
-	r = dlsym(p, \"$l\");
-	return(u == r);
-}" > ${tmp}h.c
-					if	rm -f $tmp.x && {
-							$cc -o $tmp.x ${tmp}h.c -ldl </dev/null >/dev/null ||
-							$cc -o $tmp.x ${tmp}h.c </dev/null >/dev/null
-						} &&
-						./$tmp.x
-					then	break
-					fi
-					;;
-				esac
-				w=${i}$l
-				case $shell in
-				*u*)	typeset -u I=$i ;;
-				*)	I=`echo $i | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
-				esac
-				{
-				echo "#undef  $u"
-				echo "#define $u			${I}$u"
-				} >> $tmp.r
-				u=${I}$u
-				break
-			fi
-		done
-		{
-		echo "#undef	$l	/*MANGLENAME*/"
-		case $w in
-		$l)	;;
-		*)	echo "#undef	$w" ;;
-		esac
-		} >> $tmp.z
-		;;
-	esac
-	case $p in
-	void)		b=0 a= ;;
-	*,*,*,*,*,*)	b=6 a=a,b,c,d,e,f ;;
-	*,*,*,*,*)	b=5 a=a,b,c,d,e ;;
-	*,*,*,*)	b=4 a=a,b,c,d ;;
-	*,*,*)		b=3 a=a,b,c ;;
-	*,*)		b=2 a=a,b ;;
-	*)		b=1 a=a ;;
-	esac
-	org=$p
-	A=$a
-	B=$b
-	alt=
-	def=
-	inc=
-	ind=
-	map=
-	num=
-	opt=
-	ref=
-	ver=
-	VER=
-	while	:
-	do	case $1 in
-		alt*)	alt=$2
-			shift 2
-			;;
-		num*)	shift
-			;;
-		var*)	var=$2
-			shift 2
-			set sys/types.h $1
-			{
-			for i
-			do	echo "#include <$i>"
-			done
-			echo "#ifdef __STDC__
-extern $r $l($var);
-#endif"
-			} > ${tmp}h.c
-			if	$cc -c ${tmp}h.c </dev/null >/dev/null
-			then	inc="$inc $*"
-				p=$var
-				case $p in
-				void)		b=0 a= ;;
-				*,*,*,*,*,*)	b=6 a=a,b,c,d,e,f ;;
-				*,*,*,*,*)	b=5 a=a,b,c,d,e ;;
-				*,*,*,*)	b=4 a=a,b,c,d ;;
-				*,*,*)		b=3 a=a,b,c ;;
-				*,*)		b=2 a=a,b ;;
-				*)		b=1 a=a ;;
-				esac
-				org=$p
-				A=$a
-				B=$b
-			fi
-			echo "#define ARG3D$m		$B" >> $tmp.f
-			break
-			;;
-		ver*)	VER=1
-			case $2 in
-			-)	ref= ;;
-			*)	ref=$2 ;;
-			esac
-			shift 2
-			case $l in
-			[fl]*)	case $shell in
-				*u*)	j=${l#?}
-					i=${l%$j}
-					xxx=_${i}x${j}
-					;;
-				*)	xxx=`echo $l | sed -e 's/\(.\)\(.*\)/_\1x\2/'`
-					;;
-				esac
-				;;
-			*)	xxx=_x${l}
-				;;
-			esac
-			for i in sys/types.h $ref
-			do	echo "#include <$i>"
-			done > ${tmp}h.c
-			i=
-			for j in `$cc -E ${tmp}h.c | sed -e '/^#[line 	]*1[ 	]/!d' -e 's/.*"\(.*\)".*/\1/'`
-			do	test -f "$j" && i="$i $j"
-			done
-			ver=`sed -e "/define[ 	]*[A-Z_0-9]*64_VER/!d" -e 's/.*define[ 	]*\([A-Z_0-9][A-Z_0-9]*\).*/\1/' $i </dev/null | sort -u`
-			ver64="$ver64 $ver"
-			ver=`sed -e "/${xxx}.*_VER/!d" -e 's/.*([ 	]*\([A-Z_0-9][A-Z_0-9]*\).*/\1/' $i </dev/null | sort -u`
-			case $l:$ver in
-			*:*STAT*)
-				;;
-			*stat:*)for j in _SCO_STAT_VER
-				do if grep '[ 	]_SCO_STAT_VER[ 	]' $i >/dev/null
-				   then	ver=$j; break
-				   fi
-				done
-				;;
-			esac
-			if	grep "[^a-zA-Z_0-9]_$xxx" $i >/dev/null
-			then	xxx=_$xxx
-			fi
-			;;
-		*.h)	inc="$inc $1"
-			shift
-			;;
-		[0-9]*)	case $sys in
-			bsd)	case $2 in
-				[0-9]*)	num=$2 ;;
-				*)	num=$1 ;;
-				esac
-				;;
-			*)	num=$1
-				;;
-			esac
-			case $2 in
-			[0-9]*)	shift 2 ;;
-			*)	shift ;;
-			esac
-			;;
-		"")	break
-			;;
-		*)	case $# in
-			[012])	break ;;
-			*)	shift 2 ;;
-			esac
-			;;
-		esac
-	done
-	case $num:$sys in
-	:dynamic)	num=1 ;;
-	esac
-	call=
-	case $inc in
-	?*)	for i in sys/types.h $inc
-		do	echo "#include <$i>"
-		done > ${tmp}s.h
-		opt="$opt -Dheader"
-		;;
-	esac
-	case $VER:$ver in
-	*:?*)	if	rm -f $tmp.x &&
-			$cc -Dsyscall=$xxx $static -o $tmp.x $tmp.c </dev/null >/dev/null &&
-			$executable $tmp.x
-		then	# hack test for last arg indirect in xxx version
-			case $stdc in
-			"")	{
-				echo "extern int foo(const char*);"
-				echo "extern int foo(const char**);"
-				} > ${tmp}h.c
-				if	$cc -c ${tmp}h.c </dev/null >/dev/null
-				then	stdc=0
-				else	stdc=1
-				fi
-				;;
-			esac
-			ra=$a
-			va=$a
-			case $stdc in
-			1)	{
-				for i in sys/types.h $ref
-				do	echo "#include <$i>"
-				done
-				echo "#ifdef INDIRECT"
-				echo "#define REFERENCE *"
-				echo "#else"
-				echo "#define REFERENCE"
-				echo "#endif"
-				echo "extern $r $xxx(const int, $p REFERENCE);"
-				} > ${tmp}h.c
-				if	$cc -c ${tmp}h.c </dev/null >/dev/null
-				then	: ok
-				elif	$cc -c -DINDIRECT ${tmp}h.c </dev/null >/dev/null
-				then	ind="*"
-					case $shell in
-					*e*)	i=${a%?}
-						ra="${i}&${a#$i}"
-						va="${i}*${a#$i}"
-						;;
-					*)	ra=`echo $a | sed -e 's/\(.\)$/\&\1'`
-						va=`echo $a | sed -e 's/\(.\)$/\*\1'`
-						;;
-					esac
-				fi
-				;;
-			esac
-			case $shell in
-			*u*)	typeset -u y=$xxx ;;
-			*)	y=`echo $xxx | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
-			esac
-			case $sys in
-			dynamic|mangle)
-				echo "extern $r		$y(const int, $p$ind);" >> $tmp.e
-				;;
-			esac
-			{
-			echo "#define SYS3D$m		$inx"
-			echo "#ifndef SYS$m"
-			echo "#define SYS$m		(-1)"
-			echo "#endif"
-			echo "#ifndef SYS$xxx"
-			echo "#define SYS$xxx		(-1)"
-			echo "#endif"
-			echo "#define SYSNOV$xxx	SYS$m"
-			} >> $tmp.f
-			case $shell in
-			*n*)	((inx=inx+1)) ;;
-			*)	inx=`expr $inx + 1` ;;
-			esac
-			case $ver in
-			*[mM][kK][nN][oO][dD]*)	verid=_MKNOD_VER ;;
-			*[sS][tT][aA][tT]*)	verid=_STAT_VER ;;
-			*)			verid=$ver ;;
-			esac
-			{
-			case $y in
-			__*)	case $shell in
-				*e*)	Y=${y#__} ;;
-				*)	Y=`echo $y | sed -e 's/__//'` ;;
-				esac
-				echo "#undef  $Y"
-				echo "#define $Y	$y"
-				;;
-			_*)	case $shell in
-				*e*)	Y=${y#_} ;;
-				*)	Y=`echo $y | sed -e 's/_//'` ;;
-				esac
-				echo "#undef  $Y"
-				echo "#define $Y	$y"
-				;;
-			esac
-			echo "#undef  $u"
-			echo "#define $u($a)	$y(_3D${verid}${ra:+,}$ra)"
-			echo "#undef  $y"
-			echo "#define $y(v${a:+,}$a)		${cast}SYSCALL(SYS3D$m,v${a:+,}$a)${tsac}"
-			} >> $tmp.u
-			case $p in
-			void)	c=1
-				set $r int
-				;;
-			*)	IFS=$comma
-				set int${comma}$p
-				c=$#
-				set $r${comma}int${comma}$p$ind
-				IFS=$ifs
-				;;
-			esac
-			d=
-			s=
-			for i in 0 1 2 3 4 5
-			do	case $# in
-				0)	break ;;
-				esac
-				case $1 in
-				*"mode_t")
-					d=${d}${s}A_MODE
-					;;
-				*"size_t")
-					d=${d}${s}A_SIZE
-					;;
-				*"char* const*"|*"char**")
-					d=${d}${s}A_VECTOR
-					;;
-				*"char*")
-					case $r:$2 in
-					*"ssize_t":*"size_t")
-						d=${d}${s}A_OUTPUT,A_SIZE
-						shift
-						;;
-					*)	d=${d}${s}A_STRING
-						;;
-					esac
-					;;
-				*"const void*")
-					d=${d}${s}A_INPUT
-					;;
-				*"void*")
-					d=${d}${s}A_OUTPUT
-					;;
-				*"struct stat*"|*"int*")
-					d=${d}${s}A_OUTPUT
-					;;
-				*"...")	case $l in
-					*open|*open64)	d=${d}${s}A_MODE ;;
-					*)		d=${d}${s}A_POINTER ;;
-					esac
-					;;
-				*"[]"|*"*")
-					d=${d}${s}A_POINTER
-					;;
-				*)	d=${d}${s}A_NUMBER
-					;;
-				esac
-				s=,
-				shift
-			done
-			case $sys in
-			dynamic)x="0, "
-				;;
-			mangle)	x="$u, "
-				echo "#undef $u
-extern long $u();" >> $tmp.g
-				;;
-			*)	x=
-				;;
-			esac
-			echo iffe: test: $l "=>" $xxx >&$stderr
-			echo "{ ${x}SYS$xxx, SYSNOV$xxx, MSG_CALL(MSG_$q), $c, \"$xxx\", { $d } }," >> $tmp.t
-			# NOTE: no varargs here
-			IFS=$comma
-			set $p
-			IFS=$ifs
-			d=
-			f=
-			o=
-			for i in a b c d e f
-			do	case $# in
-				0)	break ;;
-				1)	e=$ind ;;
-				*)	e= ;;
-				esac
-				case $1 in
-				*\[\])	case $shell in
-					*e*)	k=${1%\[\]} ;;
-					*)	k=`echo $1 | sed 's/\[\]\$//'` ;;
-					esac
-					i="$i"'[]'
-					;;
-				*)	k=$1
-					;;
-				esac
-				case $k in
-				*char*)	n=path ;;
-				*dev_t)	n=dev ;;
-				*int*)	n=fd ;;
-				*mode_t*)n=mode ;;
-				*stat*)	n=st ;;
-				*)	n="<$k>${i}" ;;
-				esac
-				case $f in
-				'')	f=$n ;;
-				*)	f=$f,$n ;;
-				esac
-				case $d in
-				"")	d="$k$e $n"
-					o="$k$e $n;"
-					;;
-				*)	d="$d, $k$e $n"
-					o="$o $k$e $n;"
-					;;
-				esac
-				shift
-			done
-			echo "#define ${U}3D		_3d_$m" >> $tmp.d
-			echo "#define ${l}3d($a)	$xxx __PARAM__((const int _3d_ver, $d),(_3d_ver${f:+,} $f)) __OTORP__(int _3d_ver; $o)" >> $tmp.d
-			eval v='$'_INIT$ver
-			case $v in
-			"")	eval _INIT$ver=1
-				vers="$vers $ver"
-				;;
-			esac
-			case $sym in
-			"")	sym="$xxx" fun="$xxx()" ;;
-			*)	sym="$sym,$nl	$xxx" fun="$fun,$nl	$xxx()" ;;
-			esac
-			eval _SYS_${l}_VER=_3D$verid
-			continue
-		fi
-		;;
-	1:*)	case $SYS_CALL in
-		?*)	echo "#include <${SYS_HEADER}>
-#ifdef SYS_${l}
-(
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-extern int ${l}();
-int fun() { struct stat st; return ${l}(0,&st); }" > ${tmp}s.c
-			if	$cc -c ${tmp}s.c >/dev/null 2>&1
-			then	s=`nm ${tmp}s.o | sed -e /$l/!d -e 's/.*[^_]\('${SYS_PREFIX}'_*'${l}'[0-9]*\).*/\1/'`
-				case $s in
-				$l)	;;
-				*)	echo "#include <sys/syscall.h>
-#ifndef SYS_${s}
-(
-#else
-int i;
-#endif" > ${tmp}s.c
-					if	$cc -c ${tmp}s.c >/dev/null 2>&1
-					then	def=1
-						map=$s
-						echo "#define SYS_${l}	SYS_${s}" >> $tmp.f
-						echo iffe: test: $l "=>" $s >&$stderr
-					fi
-					;;
-				esac
-			else	def=1
-			fi
-			;;
-		esac
-		;;
-	esac
-	if	rm -f $tmp.x &&
-		$cc -Dsyscall=$l $opt $static -o $tmp.x $tmp.c </dev/null >/dev/null &&
-		$executable $tmp.x
-	then	case $sys in
-		att|bsd|dynamic|mangle)
-			case $SYS_HEADER in
-			"")	case $num in
-				"")	;;
-				0)	echo "#define $u		$l" >> $tmp.r
-					;;
-				*)	case $sys in
-					att|bsd)	echo "#define SYS$m		$num" >> $tmp.s ;;
-					esac
-					call=sys
-					;;
-				esac
-				;;
-			*)	case `$cc -E -DSYS=SYS$m ${tmp}s.c </dev/null | grep SYS$m` in
-				"")	call=sys
-					;;
-				*)	case $num in
-					[0-9]*)	call=nosys ;;
-					*)	call=nolib ;;
-					esac
-					;;
-				esac
-				;;
-			esac
-			;;
-		*)	echo "#define _error_$u		1" >> $tmp.m
-			;;
-		esac
-	else	case $num in
-		[0-9]*)	call=nosys ;;
-		*)	call=nolib ;;
-		esac
-	fi
-	case $call in
-	nolib|nosys)
-		{
-		echo "#ifndef SYS$m"
-		echo "#define SYS$m	(-1)"
-		echo "#endif"
-		} >> $tmp.f
-		;;
-	*)	case $def:$SYS_HEADER in
-		:?*)	echo "#include <${SYS_HEADER}>
-#ifdef SYS${m}
-(
-#else
-int i;
-#endif" > ${tmp}s.c
-			if	$cc -c ${tmp}s.c >/dev/null 2>&1
-			then	echo "#define SYS$m		(-1)" >> $tmp.f
-			fi
-			;;
-		esac
-		;;
-	esac
-	case $call in
-	nolib|nosys)
-		echo "#define _nosys$m		1" >> $tmp.u
-		;;
-	esac
-	case $call in
-	nolib)	;;
-	nosys)	case $alt in
-		"")	
-			echo "#define $u($a)		NOSYS()" >> $tmp.u
-			echo "#define _stub_$w		1" >> $tmp.n
-			w=_no_$w
-			;;
-		*)	case $shell in
-			*u*)	typeset -u y=$alt ;;
-			*)	y=`echo $alt | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
-			esac
-			echo "#define $u			$y" >> $tmp.r
-			;;
-		esac
-		;;
-	sys)	{
-		echo "#define SYS3D$m		$inx"
-		case $sys in
-		dynamic|mangle)
-			echo "#ifndef SYS$m"
-			echo "#define SYS$m		(-1)"
-			echo "#endif"
-			;;
-		esac
-		} >> $tmp.f
-		case $shell in
-		*n*)	((inx=inx+1)) ;;
-		*)	inx=`expr $inx + 1` ;;
-		esac
-		{
-		echo "#undef  $u"
-		echo "#define $u($a)		${cast}SYSCALL(SYS3D$m${A:+,}$A)${tsac}"
-		} >> $tmp.u
-		case $p in
-		void)	set $r
-			c=0
-			;;
-		*)	IFS=$comma
-			set $p
-			c=$#
-			set $r${comma}$p
-			IFS=$ifs
-			;;
-		esac
-		d=
-		s=
-		for i in 0 1 2 3 4 5
-		do	case $# in
-			0)	break ;;
-			esac
-			case $1 in
-			*"mode_t")
-				d=${d}${s}A_MODE
-				;;
-			*"size_t")
-				d=${d}${s}A_SIZE
-				;;
-			*"char* const*"|*"char**")
-				d=${d}${s}A_VECTOR
-				;;
-			*"char*")
-				case $r:$2 in
-				*"ssize_t":*"size_t")
-					d=${d}${s}A_OUTPUT,A_SIZE
-					shift
-					;;
-				*)	d=${d}${s}A_STRING
-					;;
-				esac
-				;;
-			*"const void*")
-				d=${d}${s}A_INPUT
-				;;
-			*"void*")
-				d=${d}${s}A_OUTPUT
-				;;
-			*"struct stat*"|*"int*")
-				d=${d}${s}A_OUTPUT
-				;;
-			*"...")	case $l in
-				*open)	d=${d}${s}A_MODE ;;
-				*)	d=${d}${s}A_POINTER ;;
-				esac
-				;;
-			*"[]"|*"*")
-				d=${d}${s}A_POINTER
-				;;
-			*)	d=${d}${s}A_NUMBER
-				;;
-			esac
-			s=,
-			shift
-		done
-		case $sys in
-		mangle)	x="$u, "
-			echo "#undef $u
-extern long $u();" >> $tmp.g
-			;;
-		*)	x="0, "
-			;;
-		esac
-		i=$l
-		case $i in
-		_exit)	{
-			echo "static int hit;"
-			echo "void _exit(code) int code; { if (hit++) abort(); __exit(code); }"
-			echo "main() { return 0; }"
-			} > ${tmp}h.c
-			$cc -o ${tmp}h.x ${tmp}h.c && ./${tmp}h.x && i=_$i
-			;;
-		*)	case $map:$weak in
-			?*:*)	i=$map ;;
-			:?*)	i=$w ;;
-			esac
-			;;
-		esac
-		echo "{ ${x}SYS$m, (-1), MSG_CALL(MSG_$q), $c, \"$i\", { $d } }," >> $tmp.t
-		;;
-	*)	case $num in
-		?*)	echo "extern $r			$u($p);" >> $tmp.e ;;
-		esac
-		;;
-	esac
-	i=
-	case $call in
-	nolib)	;;
-	nosys)	;;
-	*)	case $l:$w in
-		_*)	;;
-		*:_*)	i=1 ;;
-		esac
-		;;
-	esac
-	case $i in
-	"")	echo "#define ${l}3d		$w" >> $tmp.d
-		;;
-	*)	case $p in
-		void)	d=void o= va= vo=
-			;;
-		*)	IFS=$comma
-			set $p
-			IFS=$ifs
-			d=
-			o=
-			va=$a
-			vo=
-			vx=
-			for i in a b c d e f
-			do	case $# in
-				0)	break ;;
-				esac
-				case $1 in
-				*...)	d="$d, ..."
-					va=va_alist
-					case $l in
-					fcntl)	t='void*' ;;
-					*)	t=int ;;
-					esac
-					vo="__OTORP__($o) $t $i; va_list ap; __VA_START__(ap,$vx); __OTORP__("
-					o=va_dcl
-					IFS=$comma
-					set $p
-					IFS=$ifs
-					for i in a b c d e f
-					do	case $1 in
-						*...)	break ;;
-						esac
-						vo="$vo$i = va_arg(ap, $1);"
-						shift
-					done
-					case $l in
-					fcntl)	vo="$vo) $i = va_arg(ap, void*); va_end(ap);" ;;
-					*)	vo="$vo) $i = va_arg(ap, int); va_end(ap);" ;;
-					esac
-					break
-					;;
-				*\[\])	case $shell in
-					*e*)	k=${1%\[\]} ;;
-					*)	k=`echo $1 | sed 's/\[\]\$//'` ;;
-					esac
-					i="$i"'[]'
-					;;
-				*)	k=$1
-					;;
-				esac
-				vx=$i
-				case $d in
-				"")	d="$k $i"
-					o="$k $i;"
-					;;
-				*)	d="$d, $k $i"
-					o="$o $k $i;"
-					;;
-				esac
-				shift
-			done
-			;;
-		esac
-		case $o in
-		?*)	o="__OTORP__($o) " ;;
-		esac
-		case $r in
-		void)	ft='*' fr= ;;
-		*)	ft= fr='return ' ;;
-		esac
-		z="$r $w"
-		echo "#define ${U}3D		${z}" >> $tmp.d
-		W=
-		case $w in
-		__libc_*) W=" $r __$l __PARAM__(($d),($va)) $o{$vo $fr$w($a); }" ;;
-		__*) W=" $r _$l __PARAM__(($d),($va)) $o{$vo $fr$w($a); }" ;;
-		esac
-		echo "#define ${l}3d		${ft}_3d_stub${m} = 0; extern __MANGLE__ $r $w __PROTO__(($p)); $r $l __PARAM__(($d),($va)) $o{$vo $fr$w($a); }$W $z" >> $tmp.d
-		;;
-	esac
-	case $call:$sym in
-	nolib:*);;
-	nosys:*);;
-	*:)	sym="$w" fun="$w()" ;;
-	*)	sym="$sym,$nl	$w" fun="$fun,$nl	$w()" ;;
-	esac
-done
-IFS=$ifs
-if	test -f $tmp.t
-then	{
-	echo "};
-"
-	case $sys in
-	dynamic|mangle)
-		echo "#define SYSCALL3D(z,a,b,c,d,e,f)	(*sys_trace[z].func)(a,b,c,d,e,f)"
-		case $sys in
-		dynamic|mangle)
-			echo "#undef	fstat"
-			case $_SYS_fstat_VER in
-			"")	echo "#define fstat(a,b)	SYSCALL3D(SYS3D_fstat,a,b,0,0,0,0)" ;;
-			*)	echo "#define fstat(a,b)	SYSCALL3D(SYS3D_fstat,$_SYS_fstat_VER,a,b,0,0,0)" ;;
-			esac
-			echo "#undef	write"
-			echo "#define write(a,b,c)	SYSCALL3D(SYS3D_write,a,b,c,0,0,0)"
-			;;
-		esac
-		;;
-	esac
-echo "
-#else
-"
-echo "
-#define SYSCALL		syscall3d
-
-extern long	syscall3d(int, ...);
-
-#endif"
-	} >> $tmp.t
-else	echo "#undef	SYSTRACE3D" > $tmp.t
-fi
-echo "
-#endif" >> $tmp.e
-echo "
-#ifdef	SYSENT3D
-
-extern int
-	$fun;
-
-int			(*_3d_sysent[])() = {
-	$sym
-};
-
-#else
-
-extern int		(*_3d_sysent[])();
-#define PULL_IN_3D		int (*pull_in_3d)() = _3d_sysent[0];
-" >> $tmp.m
-for ver in $vers
-do	vercall=
-	case $ver in
-	*[mM][kK][nN][oO][dD]*)	vercall=MKNOD ;;
-	*[sS][tT][aA][tT]*)	vercall=STAT ;;
-	esac
-	case $vercall in
-	?*)	echo "#define _3D_${vercall}_VER	${ver}"
-		for alt in $ver64
-		do	case $alt in
-			*${vercall}64*) echo "#define _3D_${vercall}64_VER	${alt}" ;;
-			esac
-		done
-		;;
-	esac
-done >> $tmp.f
-for i in $tmpsuf
-do	if	test -f $tmp.$i
-	then	echo
-		cat $tmp.$i
-	fi
-done
-echo

+ 0 - 51
src/cmd/3d/features/syslib

@@ -1,51 +0,0 @@
-typ	off64_t sys/stat.h
-
-hdr	alloca
-
-lib	syscall syscall.h sys/syscall.h
-
-mem	stat.st_atim,stat.st_fstype sys/types.h sys/stat.h
-mem	DIR dirent.h -DDIRENT_ILLEGAL_ACCESS
-
-tst	fdview execute{
-	#include <fcntl.h>
-	#define VIEW	15
-	main()
-	{
-		int	fd;
-		int	oflags;
-		int	nflags;
-		int	xflags;
-		if ((fd = open(argv[0], 0)) < 0) return(1);
-		if ((oflags = fcntl(fd, F_GETFL, 0)) < 0) return(1);
-		nflags = (oflags & 0xffff) | (VIEW<<16);
-		if (fcntl(fd, F_SETFL, nflags) < 0) return(1);
-		if ((xflags = fcntl(fd, F_GETFL, 0)) < 0) return(1);
-		if (xflags != nflags) return(1);
-		return(0);
-	}
-}end pass{
-	echo "#define getfdview(f)	((fcntl(f,F_GETFL,0)>>16)&037)"
-	echo "#define setfdview(f,v)	(fcntl(f,F_SETFL,(fcntl(f,F_GETFL,0)&0xffff)|(((v)&037)<<16)))"
-}end fail{
-	echo "/* hack alert -- this is the view of the last user open */"
-	echo "#define getfdview(f)	(state.path.open_level)"
-	echo "#define setfdview(f,v)"
-}end
-
-tst	no_exit_exit note{ exit() bypasses _exit() }end exec{
-	#include <sys/types.h>
-	#include <signal.h>
-	#ifdef __STDC__
-	#include <unistd.h>
-	#endif
-	#if _STD_
-	void _exit(int code) { kill(getpid(), SIGKILL); }
-	#else
-	void _exit(code) int code; { kill(getpid(), SIGKILL); }
-	#endif
-	int main()
-	{
-		return 0;
-	}
-}end

+ 0 - 135
src/cmd/3d/fork3d.c

@@ -1,135 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if FS
-
-#include <cs.h>
-
-/*
- * called in the child process by fork()
- */
-
-static void
-forked(pid_t pid)
-{
-	register int		fd;
-	register Fs_t*		fs;
-	register Mount_t*	mp;
-	char*			type;
-	long			addr;
-	long			port;
-	long			clone;
-	int			nfd;
-	pid_t			ppid;
-	char*			b;
-
-	reclaim();
-	ppid = state.pid;
-	state.pid = pid;
-	state.channel.internal = 0;
-	for (fs = state.fs; fs < state.fs + elementsof(state.fs); fs++)
-	{
-		if ((fs->flags & FS_FORK) && fs->set)
-			(*fs->set)(fs, state.null, 0, "fork", 4);
-		if ((fs->flags & (FS_ERROR|FS_ON|FS_OPEN|FS_UNIQUE)) == (FS_ON|FS_OPEN|FS_UNIQUE))
-			fsdrop(fs, 0);
-	}
-	for (mp = state.mount; mp < state.mount + elementsof(state.mount); mp++)
-		if (mp->fs)
-			switch (mp->fs->flags & (FS_ACTIVE|FS_ERROR|FS_GLOBAL|FS_MONITOR|FS_NAME|FS_ON))
-	{
-	case FS_ACTIVE|FS_ON:
-		if (!fscall(mp, MSG_INIT(MSG_fork, 01511, 0), ppid, state.path.name, sizeof(state.path.name)) && state.ret > 0)
-		{
-			type = b = state.path.name;
-			while (*b && *b != ' ') b++;
-			if (*b) *b++ = 0;
-			if (streq(type, "fdp")) fd = csrecv(&cs, mp->fs->fd, NiL, &nfd, 1) == 1 ? nfd : -1;
-			else
-			{
-				addr = strtol(b, &b, 0);
-				port = strtol(b, &b, 0);
-				clone = strtol(b, &b, 0);
-				fd = csbind(&cs, type, addr, port, clone);
-			}
-			if (fd >= 0)
-			{
-				FCNTL(fd, F_DUPFD, mp->fs->fd);
-				CLOSE(fd);
-			}
-		}
-		break;
-	case FS_ACTIVE|FS_GLOBAL|FS_MONITOR|FS_ON:
-	case FS_GLOBAL|FS_MONITOR|FS_ON:
-	case FS_ACTIVE|FS_MONITOR|FS_ON:
-	case FS_MONITOR|FS_ON:
-		if (fssys(mp, MSG_fork))
-			fscall(mp, MSG_fork, ppid);
-		break;
-	}
-
-	if (state.cache)
-		for (fd = 0; fd <= state.cache; fd++)
-			if ((mp = state.file[fd].mount) && !(mp->fs->flags & FS_ACTIVE) && fssys(mp, MSG_dup))
-				fscall(mp, MSG_dup, fd, fd);
-}
-
-#endif
-
-#ifdef	fork3d
-
-pid_t
-fork3d(void)
-{
-	pid_t			pid;
-
-	initialize();
-	if (!(pid = FORK()) || pid == state.pid || pid == getpid())
-	{
-		pid = 0;
-#if FS
-		forked(getpid());
-#else
-		state.pid = getpid();
-#endif
-	}
-#if FS
-	else
-	{
-		register Mount_t*	mp;
-
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_fork))
-				fscall(mp, MSG_fork, pid);
-	}
-#endif
-	return(pid);
-}
-
-#else
-
-NoN(fork)
-
-#endif

+ 0 - 61
src/cmd/3d/fpathconf3d.c

@@ -1,61 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef fpathconf3d
-
-long
-fpathconf3d(int fd, int op)
-{
-	long		r;
-	int		oerrno;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_fpathconf, 0, fd, op))
-		return(state.ret);
-	mp = monitored();
-#endif
-	oerrno = errno;
-	errno = 0;
-	r = FPATHCONF(fd, op);
-	if (!errno)
-	{
-		errno = oerrno;
-#if FS
-		if (mp)
-			fscall(mp, MSG_fpathconf, 0, fd, op);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_fpathconf))
-				fscall(mp, MSG_fpathconf, 0, fd, op);
-#endif
-	}
-	return(r);
-}
-
-#else
-
-NoN(fpathconf)
-
-#endif

+ 0 - 670
src/cmd/3d/fs.c

@@ -1,670 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * 3d mounted fs support
- *
- * NOTE: be vewwwy careful with errno
- */
-
-#include "3d.h"
-
-#if FS
-
-#include <cs.h>
-
-#define DEVFD		"/dev/fd"
-#define MNTFD		"path\n"
-#define MNTNAM		"/dev/tcp/*"
-
-/*
- * initialize mount channel and return fs fd for mp
- */
-
-int
-fschannel(register Mount_t* mp)
-{
-	register Fs_t*	fs;
-	register int	fd;
-
-	if (mp->channel == -1)
-		return -1;
-	fs = mp->fs;
-	if (mp->channel && fs->fd)
-		return fs->fd;
-	if ((fd = fsfd(fs)) <= 0)
-		return -1;
-	if (mp->channel)
-		return fs->fd;
-	mp->channel = 1;
-	mp->flags |= MOUNT_PRIMARY;
-	return fd;
-}
-
-/*
- * generate phony monitor open for fd inherited from parent
- */
-
-static void
-fsphony(register Mount_t* mp, register File_t* fp, int fd)
-{
-	register ssize_t	n;
-	int			nd;
-	Mount_t*		np;
-	char			buf[64];
-
-	state.kernel++;
-	fp->flags |= FILE_LOCK;
-	*buf = 0;
-	if (!(np = getmount(MNTNAM, NiL)) || (nd = fsfd(np->fs)) < 0)
-		sfsprintf(buf, sizeof(buf), "%s/%d", DEVFD, fd);
-	else if (!(np->fs->flags & FS_LOCK) && WRITE(nd, MNTFD, sizeof(MNTFD) - 1) == sizeof(MNTFD) - 1)
-	{
-		np->fs->flags |= FS_LOCK;
-		if (!cssend(&cs, nd, &fd, 1) && (n = READ(nd, buf, sizeof(buf))) > 1)
-			buf[n - 1] = 0;
-		np->fs->flags &= ~FS_LOCK;
-	}
-	state.kernel--;
-	if (*buf)
-	{
-		fp->open |= (1<<(mp-state.mount));
-		message((-3, "fs: phony: %s", buf));
-		fscall(mp, MSG_open, fd, buf, fp->oflag, 0, 0);
-	}
-	fp->flags &= ~FILE_LOCK;
-}
-
-/*
- * return real fd for up under mount mp to be accessed by call
- * return value stuck in tail portion of state.path.name
- */
-
-char*
-fsreal(register Mount_t* mp, long call, const char* up)
-{
-	char		dev[2 * PATH_MAX + 3];
-	register char*	s = dev;
-	register Fs_t*	fs = mp->fs;
-	register int	n;
-	register int	fd;
-	int		lz;
-	int		pz;
-
-	if (!(lz = mp->logicalsize))
-		lz = strlen(mp->logical);
-	if (!(pz = mp->physicalsize) && mp->physical)
-		pz = strlen(mp->physical);
-	n = sfsprintf(s, sizeof(dev) - 1, "%s %-*s %s%s%-*s pwd=%s%s%s", msgname(call), lz, mp->logical, up, pz ? " physical=" : "", pz, mp->physical ? mp->physical : "", state.pwd, mp->fs->attr, mp->attr);
-	s[n] = 0;
-	message((-2, "fs: %s: real: service=%-*s request=\"%s\"", fs->special, fs->servicesize, fs->service, s));
-	s[n++] = '\n';
-	if ((fd = fsfd(fs)) <= 0)
-		return 0;
-	s = state.path.name + PATH_MAX;
-	if (write(fd, dev, n) != n || (n = csread(&cs, fd, s, PATH_MAX, CS_LINE)) <= 0)
-	{
-		fsdrop(fs, 0);
-		return 0;
-	}
-	if (n <= 1)
-		return 0;
-	s[n - 1] = 0;
-	if (s[0] >= 'A' && s[0] <= 'Z' && s[1] == ' ')
-	{
-		message((-2, "fs: %s: real: %s", fs->special, s + 2));
-		return 0;
-	}
-	message((-2, "fs: %s: real: path=%s", fs->special, s));
-	return s;
-}
-
-/*
- * do fs call
- * -1 returned if not mounted
- * 0 returned if mounted with state.ret call return value
- * state.path.monitor set if monitor or name service mount
- */
-
-int
-fscall(register Mount_t* mp, long call, int ret, ...)
-{
-	register Fs_t*		fs;
-	register int		retry;
-	register int		tries;
-	const char*		up;
-	const char*		sp;
-	int			cd;
-	int			fd;
-	int			oerrno;
-	int			m;
-	long			n;
-	File_t*			fp;
-	Handler_t		handler;
-	Msg_return_t*		rp;
-	Msg_return_t		rv;
-	void**			xp;
-	void*			xv[2];
-	int*			ip;
-	Msg_file_t		iv[2];
-	va_list			ap;
-
-	oerrno = errno;
-	initialize();
-	state.ret = -1;
-	if (state.in_2d)
-		return -1;
-	up = 0;
-	/* proto workaround */
-	va_start(ap, ret); va_end(ap);
-	if (!mp)
-	{
-		state.path.monitor = 0;
-		state.path.mount = 0;
-		sp = 0;
-		va_start(ap, ret);
-		switch (MSG_ARG(call, 1))
-		{
-		case MSG_ARG_file:
-			fd = va_arg(ap, int);
-			if (fd < 0 || fd >= elementsof(state.file))
-				goto nope;
-			if (!state.kernel && (mp = state.global) && !((fp = &state.file[fd])->flags & FILE_LOCK)) do
-			{
-				if (fssys(mp, MSG_open) && ((fp->flags & FILE_OPEN) || !fileinit(fd, NiL, NiL, 0)))
-				{
-					fs = mp->fs;
-					if ((!(fs->flags & FS_REGULAR) || (fp->flags & FILE_REGULAR)) && (!(fs->flags & FS_WRITE) || (fp->flags & FILE_WRITE)) && ((mp->flags & MOUNT_PRIMARY) || fd > 2) && !(fp->open & (1<<(mp-state.mount))))
-						fsphony(mp, fp, fd);
-				}
-			} while (mp = mp->global);
-			mp = fgetmount(fd);
-			n = FS_ERROR|FS_INIT|FS_LOCK|FS_NAME|FS_ON;
-			break;
-		case MSG_ARG_string:
-			sp = va_arg(ap, const char*);
-			if (sp != state.path.name)
-				sp = pathreal(sp, P_PATHONLY|P_ABSOLUTE, NiL);
-			if (sp) mp = getmount(sp, &up);
-			n = FS_ERROR|FS_INIT|FS_LOCK|FS_ON;
-			break;
-		}
-		va_end(ap);
-		if (!mp || ((fs = mp->fs)->flags & n) != FS_ON)
-			goto nope;
-		if (fs->flags & FS_MONITOR)
-		{
-			if (!state.kernel && (fs->call & MSG_MASK(call)))
-			{
-				if (sp && fs->match)
-				{
-					if (fs->matchsize)
-					{
-						cd = fs->match[fs->matchsize];
-						fs->match[fs->matchsize] = 0;
-					}
-					if (strmatch(sp, fs->match))
-						state.path.monitor = mp;
-					if (fs->matchsize)
-						fs->match[fs->matchsize] = cd;
-				}
-				else state.path.monitor = mp;
-			}
-			goto nope;
-		}
-	}
-	else if (((fs = mp->fs)->flags & (FS_ERROR|FS_INIT|FS_LOCK|FS_ON)) != FS_ON)
-		goto nope;
-	if (!(fs->call & MSG_MASK(call)))
-		goto nope;
-	if (fs->flags & FS_MONITOR)
-	{
-		if (state.kernel)
-			goto nope;
-		if (MSG_ARG(call, 1) == MSG_ARG_file)
-		{
-			va_start(ap, ret);
-			fd = va_arg(ap, int);
-			va_end(ap);
-			if (fd < 0 || fd >= elementsof(state.file))
-				goto nope;
-			fp = &state.file[fd];
-			if (fp->flags & FILE_LOCK)
-				goto nope;
-			if (!(fp->flags & FILE_OPEN) && fileinit(fd, NiL, NiL, 0))
-				goto nope;
-			if ((fs->flags & FS_REGULAR) && !(fp->flags & FILE_REGULAR) || (fs->flags & FS_WRITE) && !(fp->flags & FILE_WRITE))
-				goto nope;
-			if (fssys(mp, MSG_open) && ((mp->flags & MOUNT_PRIMARY) || fd > 2) && !(fp->open & (1<<(mp-state.mount))))
-				fsphony(mp, fp, fd);
-		}
-		else if (call == MSG_open)
-		{
-			if (fsmount(mp) < 0)
-				goto nope;
-			if (fs->flags & FS_WRITE)
-			{
-				va_start(ap, ret);
-				va_arg(ap, const char*);
-				n = va_arg(ap, int);
-				va_end(ap);
-				if ((n & O_ACCMODE) == O_RDONLY)
-					goto nope;
-			}
-		}
-		if (MSG_ARG(call, 0) == MSG_ARG_file)
-		{
-			fp = &state.file[ret];
-			fp->open |= (1<<(mp-state.mount));
-			rv.file = fp->id;
-		}
-		else rv.number = ret;
-		rp = &rv;
-	}
-	else if (call == MSG_open)
-	{
-		int	oflag;
-		int	mode;
-		int	level;
-
-		fs->flags |= FS_LOCK;
-		va_start(ap, ret);
-		sp = va_arg(ap, const char*);
-		oflag = va_arg(ap, int);
-		mode = va_arg(ap, int);
-		level = va_arg(ap, int);
-		va_end(ap);
-		message((-3, "fs: %s: open: path=%s", fs->special, sp));
-		if (fs == &state.fs[FS_fd])
-		{
-			const char*	ep;
-
-			if ((fd = OPEN(sp, oflag, mode)) >= 0)
-			{
-				state.ret = fd;
-				goto unlock;
-			}
-			fd = strtol(up, (char**)&ep, 0);
-			if (*ep)
-			{
-				oerrno = ENOENT;
-				goto unlock;
-			}
-			if ((n = FCNTL(fd, F_GETFL, 0)) < 0)
-			{
-				oerrno = errno;
-				goto unlock;
-			}
-			n &= O_ACCMODE;
-			oflag &= O_ACCMODE;
-			if (n == O_RDONLY && oflag == O_WRONLY || n == O_WRONLY && oflag == O_RDONLY)
-			{
-				oerrno = EPERM;
-				goto unlock;
-			}
-			if ((state.ret = FCNTL(fd, F_DUPFD, 0)) < 0)
-				oerrno = errno;
-		}
-		else if ((sp = (const char*)fsreal(mp, MSG_open, up)) && (fd = fsfd(mp->fs)) > 0)
-		{
-			/*
-			 * /#<id>/[#]<path> for active fd's
-			 * /#<id>\n written back to initialize
-			 */
-
-			if (sp[0] == '/' && sp[1] == '#')
-			{
-				up = sp;
-				if (!(sp = strchr(sp + 2, '/')))
-				{
-					sp = up;
-					up = 0;
-				}
-				else
-				{
-					m = sp - up;
-					if (sp[1] == '#')
-						sp += 2;
-				}
-			}
-			else up = 0;
-			if (streq(sp, DEVFD))
-			{
-				cd = -1;
-				while (csrecv(&cs, fd, NiL, &cd, 1) != 1 && errno == EINTR);
-				fd = cd;
-			}
-			else if ((fd = fs3d_open(sp, oflag, mode)) == -1)
-				oerrno = errno;
-			if (fd >= 0 && up)
-			{
-				*((char*)up + m++) = '\n';
-				if (write(fd, up, m) != m)
-					fd = -1;
-				else
-				{
-					if (fd > state.cache)
-						state.cache = fd;
-					fp = &state.file[fd];
-					fp->open = ~0;
-					fp->flags = FILE_OPEN;
-					fp->mount = mp;
-				}
-			}
-			state.ret = fd;
-		}
-		goto unlock;
-	}
-	else
-		rp = 0;
-	if (fs->flags & FS_NAME)
-	{
-		if (up && fs != &state.fs[FS_fd])
-		{
-			state.path.monitor = mp;
-			state.path.mount = (char*)up;
-		}
-		goto nope;
-	}
-	if (MSG_MASK(call) & (MSG_MASK(MSG_close)|MSG_MASK(MSG_dup)))
-		goto nope;
-	message((-3, "fs: %s: %s: call", fs->special, msgname(call)));
-	fs->flags |= FS_LOCK;
-	if (fs->terse & MSG_MASK(call))
-	{
-		tries = MSG_ARG_CALL;
-		for (;;)
-		{
-			tries += MSG_ARG_TYPE;
-			switch ((call >> tries) & ((1 << MSG_ARG_TYPE) - 1))
-			{
-			case 0:
-				break;
-			case MSG_ARG_output:
-				if (!(fs->flags & FS_MONITOR)) break;
-				/*FALLTHROUGH*/
-			case MSG_ARG_input:
-			case MSG_ARG_vector:
-				call = (call & ~(((1 << MSG_ARG_TYPE) - 1) << tries)) | (MSG_ARG_number << tries);
-				continue;
-			default:
-				continue;
-			}
-			break;
-		}
-	}
-	if (fs->flags & FS_ACTIVE)
-	{
-		if (!(fs->flags & FS_MONITOR))
-			call |= MSG_RETURN;
-		else if (fs->ack & MSG_MASK(call))
-			call |= (fs->flags & FS_INTERACTIVE) ? MSG_RETURN : MSG_ACK;
-		retry = fs->retry;
-	}
-	else retry = 0;
-	if ((fs->flags & FS_FLUSH) && (call |= MSG_FLUSH) || retry)
-		handler = signal(SIGPIPE, SIG_IGN);
-	tries = 1;
-	for (;;)
-	{
-		if ((cd = fsmount(mp)) < 0)
-		{
-			message((-2, "fs: %s: %s: connect error on try %d", fs->special, msgname(call), tries));
-			goto unlock;
-		}
-		va_start(ap, ret);
-		xp = xv;
-		switch (MSG_ARG(call, 1))
-		{
-		case MSG_ARG_file:
-			fd = va_arg(ap, int);
-			if (!(fs->flags & FS_MONITOR))
-				cd = fd;
-			*xp++ = (void*)&state.file[fd].id;
-			break;
-		case MSG_ARG_string:
-			sp = va_arg(ap, const char*);
-			if (MSG_VAR(call) == MSG_VAR_FILE)
-			{
-				if (!(fs->flags & FS_MONITOR))
-					sp = up;
-				else if (sp != state.path.name && !(sp = (const char*)pathreal(sp, P_PATHONLY|P_ABSOLUTE, NiL)))
-					goto unlock;
-			}
-			*xp++ = (void*)sp;
-			break;
-		case MSG_ARG_output:
-			if (call == MSG_pipe)
-			{
-				ip = va_arg(ap, int*);
-				for (n = 0; n < 2; n++)
-				{
-					fp = &state.file[ip[n]];
-					if (!(fp->flags & FILE_OPEN))
-						fileinit(ip[n], NiL, NiL, 0);
-					fp->open |= (1<<(mp-state.mount));
-					iv[n] = fp->id;
-					*xp++ = (void*)iv;
-				}
-			}
-			break;
-		default:
-			xp = 0;
-			break;
-		}
-		if (xp)
-		{
-			*xp = 0;
-			xp = xv;
-		}
-		n = msgvcall(cd, MSG_CHANNEL(state.pid, mp->channel), call, rp, xp, ap);
-		va_end(ap);
-		if (n != -1)
-			break;
-		if (errno != EMSGIO)
-		{
-			if (!(fs->flags & FS_MONITOR))
-				oerrno = errno;
-			break;
-		}
-		message((-2, "fs: %s: %s: error on try %d", fs->special, msgname(call), tries));
-		if (tries++ > retry)
-			break;
-		fsdrop(fs, 0);
-	}
-	if ((fs->flags & FS_FLUSH) || retry)
-		signal(SIGPIPE, handler);
-	if (fs->flags & FS_ACTIVE)
-	{
-		if ((state.ret = n) > 0 && (fs->flags & (FS_ACTIVE|FS_INTERACTIVE|FS_MONITOR)) == (FS_ACTIVE|FS_INTERACTIVE|FS_MONITOR) && (fs->ack & MSG_MASK(call)))
-		{
-			char	buf[TABLE_MAX];
-
-			if ((n = READ(cd, buf, sizeof(buf))) > 1)
-			{
-				buf[n - 1] = 0;
-				mapinit(buf, 0);
-			}
-			else message((-3, "fs: %s: %s: interactive ack failed", fs->special, msgname(call)));
-		}
-	}
-	else if (!(fs->flags & FS_MONITOR))
-	{
-		oerrno = errno = ENODEV;
-		message((-3, "fs: %s: %s: return: passive fs", fs->special, msgname(call)));
-	}
-	else if (fs->ack & MSG_MASK(call))
-	{
-		oerrno = errno = ENODEV;
-		message((-3, "fs: %s: %s: ack: passive fs", fs->special, msgname(call)));
-	}
-	else state.ret = 0;
- unlock:
-	fs->flags &= ~FS_LOCK;
-	errno = oerrno;
-	return 0;
- nope:
-	errno = oerrno;
-	return -1;
-}
-
-#endif
-
-/*
- * initialize mounted fs and return device service fd
- */
-
-int
-fsinit(register Fs_t* fs, int fd)
-{
-	int	n;
-	int	oerrno;
-
-	if (fd < 0 && (fs->flags & (FS_BOUND|FS_ERROR|FS_INIT|FS_ON)) != (FS_BOUND|FS_ON) || state.kernel && (fs->flags & FS_GLOBAL))
-		return -1;
-	oerrno = errno;
-	fs->flags |= FS_INIT;
-	if ((fs->flags & (FS_ON|FS_OPEN)) != (FS_ON|FS_OPEN))
-	{
-		state.kernel++;
-		if ((fs->fd = fd) < 0)
-		{
-			char*	svc;
-			char	buf[PATH_MAX];
-
-			if (n = fs->servicesize)
-			{
-				if (n >= sizeof(buf)) n = sizeof(buf) - 1;
-				svc = (char*)memcpy(buf, fs->service, n);
-				svc[n] = 0;
-			}
-			else svc = fs->service;
-			message((-3, "fs: %s: init#1: service=%s", fs->special, svc));
-#if FS
-			fs->fd = cslocal(&cs, svc);
-			message((-3, "fs: %s: init#2: service=%s cslocal=%d", fs->special, svc, fs->fd));
-			if (fs->fd >= 0)
-			{
-				if (fs->flags & FS_RECEIVE)
-				{
-					n = csrecv(&cs, fs->fd, NiL, &fd, 1);
-					CLOSE(fs->fd);
-					fs->fd = n == 1 ? fd : -1;
-				}
-			}
-			else if (errno == ENOENT)
-#endif
-			fs->fd = fs3d_open(svc, O_CREAT|O_RDWR|O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
-		}
-		if (fs->fd < 0 || FSTAT(fs->fd, &fs->st))
-		{
-			fs->fd = -1;
-			fs->flags |= FS_ERROR;
-		}
-		else
-		{
-			if (fs->flags & FS_CLOSE)
-				FCNTL(fs->fd, F_SETFD, FD_CLOEXEC);
-			if (S_ISREG(fs->st.st_mode))
-				fs->flags &= ~FS_ACTIVE;
-			fs->flags |= FS_ON|FS_OPEN;
-			reserve(&fs->fd);
-			if (fd < 0)
-				message((-3, "fs: %s: init#3: service=%-*s fd=%d cache=%d", fs->special, fs->servicesize ? fs->servicesize : strlen(fs->service), fs->service, fs->fd, state.cache));
-		}
-		state.kernel--;
-	}
-	fs->flags &= ~FS_INIT;
-	errno = oerrno;
-	return fs->fd;
-}
-
-/*
- * drop internal 3d mount
- * if clear!=0 then path binding also cleared
- */
-
-void
-fsdrop(register Fs_t* fs, int clear)
-{
-	int	oerrno;
-
-	state.kernel++;
-	oerrno = errno;
-	message((-3, "fs: %s: drop:%s", fs->special, clear ? " clear" : state.null));
-	if (fs->flags & FS_OPEN)
-	{
-		fs->flags &= ~FS_OPEN;
-		cancel(&fs->fd);
-	}
-	fs->flags &= ~FS_ERROR;
-	if (clear)
-	{
-#if FS
-		if (fs->flags & FS_FS)
-		{
-			register int		n;
-			register int		m;
-			register Mount_t*	mp;
-
-			for (n = 0; n <= state.cache; n++)
-				if ((mp = state.file[n].mount) && mp->fs == fs)
-					state.file[n].mount = 0;
-			for (n = m = 0; n < state.vmount.size; n++)
-			{
-				if (((Mount_t*)state.vmount.table[n].val)->fs != fs)
-				{
-					if (n != m)
-						state.vmount.table[m] = state.vmount.table[n];
-					m++;
-				}
-				else if (state.vmount.table[n].valsize & T_ALLOCATE)
-					free(state.vmount.table[n].key);
-			}
-			state.vmount.size = m;
-			for (n = 0; n < elementsof(state.mount); n++)
-				if (state.mount[n].fs == fs)
-				{
-					state.mount[n].fs = 0;
-					if (state.mount[n].physical && !state.mount[n].physicalsize)
-					{
-						free(state.mount[n].physical);
-						state.mount[n].physical = 0;
-					}
-				}
-		}
-#endif
-		if (fs->flags & FS_INTERNAL) fs->flags &= ~(FS_BOUND|FS_ON);
-		else
-		{
-			fs->flags = 0;
-			if (fs->service && !fs->servicesize)
-			{
-				free(fs->service);
-				fs->service = 0;
-			}
-		}
-	}
-	errno = oerrno;
-	state.kernel--;
-}

+ 0 - 134
src/cmd/3d/fstat3d.c

@@ -1,134 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma noprototyped
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide fstat
-#else
-#define fstat		______fstat
-#endif
-
-#define _def_syscall_3d 1
-
-#include "3d.h"
-
-#undef	_def_syscall_3d
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide fstat
-#else
-#undef	fstat
-#endif
-
-#include "FEATURE/syscall"
-
-/* the 3 arg _fxstat() disrupts our proto game -- every party needs one */
-#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
-int fstat3d(int fd, struct stat* st)
-#else
-#if defined(_FSTAT)
-int _fstat(fd, st) int fd; struct stat* st; { return fstat(fd, st); }
-#endif
-int fstat(fd, st) int fd; struct stat* st;
-#endif
-{
-	int		oerrno;
-#if FS
-	Mount_t*	mp;
-
-	if (!state.kernel)
-	{
-		if (!fscall(NiL, MSG_fstat, 0, fd, st))
-			return state.ret;
-		mp = monitored();
-	}
-#endif
-#ifdef _3D_STAT_VER
-	if (FXSTAT(_3d_ver, fd, st))
-		return -1;
-#else
-	if (FSTAT(fd, st))
-		return -1;
-#endif
-#if _mem_d_type_dirent
-	if (S_ISDIR(st->st_mode))
-		st->st_nlink = _3D_LINK_MAX;
-#endif
-	if (state.kernel)
-		return 0;
-#if FS
-	if (mp)
-		fscall(mp, MSG_fstat, 0, fd, st);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_fstat))
-			fscall(mp, MSG_fstat, 0, fd, st);
-#endif
-	oerrno = errno;
-#ifdef _3D_STAT64_VER
-	if (_3d_ver == _3D_STAT64_VER)
-		IVIEW(((struct stat64*)st), getfdview(fd));
-	else
-#endif
-	IVIEW(st, getfdview(fd));
-	errno = oerrno;
-	return 0;
-}
-
-#if defined(_LARGEFILE64_SOURCE) && defined(STAT643D) && !defined(_3D_STAT64_VER)
-
-int
-fstat643d(int fd, struct stat64* st)
-{
-	int		oerrno;
-	struct stat	ss;
-#if FS
-	Mount_t*	mp;
-
-	if (!state.kernel)
-	{
-		if (!fscall(NiL, MSG_fstat, 0, fd, &ss))
-			return state.ret;
-		mp = monitored();
-	}
-#endif
-	if (FSTAT64(fd, st))
-		return -1;
-#if _mem_d_type_dirent
-	if (S_ISDIR(st->st_mode))
-		st->st_nlink = _3D_LINK_MAX;
-#endif
-	if (state.kernel)
-		return 0;
-#if FS
-	if (mp)
-		fscall(mp, MSG_fstat, 0, fd, st);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_fstat))
-			fscall(mp, MSG_fstat, 0, fd, st);
-#endif
-	oerrno = errno;
-	IVIEW(st, getfdview(fd));
-	errno = oerrno;
-	return 0;
-}
-
-#endif

+ 0 - 176
src/cmd/3d/fstatfs3d.c

@@ -1,176 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide fstatfs
-#else
-#define fstatfs        ______fstatfs
-#endif
-#define _def_syscall_3d	1
-
-#include "3d.h"
-
-#if defined(fstatfs3d) && ( _sys_statfs || _sys_vfs || _sys_mount && _mem_f_files_statfs )
-
-#include <cs_lib.h>
-
-#if _sys_statfs
-#include <sys/statfs.h>
-#else
-#if _sys_vfs
-#include <sys/vfs.h>
-#define _vfs_statfs	1
-#else
-#if _sys_mount
-#if _lib_getmntinfo
-#include <sys/param.h>		/* expect some macro redefinitions here */
-#endif
-#include <sys/mount.h>
-#endif
-#endif
-#endif
-
-#undef	_def_syscall_3d
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide fstatfs
-#else
-#undef  fstatfs
-#endif
-
-#include "FEATURE/syscall"
-
-#if _vfs_statfs
-#define VFS	(fs)
-#else
-#define VFS	(&vfs)
-#endif
-
-#if ARG3D_fstatfs == 4
-
-int
-fstatfs3d(int fd, struct statfs* fs, int size, int type)
-{
-#if FS
-	Mount_t*	mp;
-#if !_vfs_statfs
-	struct statvfs	vfs;
-#endif
-
-	if (!fscall(NiL, MSG_fstatfs, 0, fd, VFS, size, type))
-	{
-#if !_vfs_statfs
-		if (!state.ret)
-		{
-			memset(fs, 0, sizeof(*fs));
-			fs->f_bsize = vfs.f_bsize;
-			fs->f_blocks = vfs.f_blocks;
-			fs->f_bfree = vfs.f_bfree;
-			fs->f_files = vfs.f_files;
-			fs->f_ffree = vfs.f_ffree;
-		}
-#endif
-		return state.ret;
-	}
-	mp = monitored();
-#endif
-	if (FSTATFS(fd, fs, size, type))
-		return -1;
-#if FS
-#if !_vfs_statfs
-	if (mp || state.global)
-	{
-		memset(&vfs, 0, sizeof(vfs));
-		vfs.f_bsize = fs->f_bsize;
-		vfs.f_blocks = fs->f_blocks;
-		vfs.f_bfree = fs->f_bfree;
-		vfs.f_files = fs->f_files;
-		vfs.f_ffree = fs->f_ffree;
-	}
-#endif
-	if (mp)
-		fscall(mp, MSG_fstatfs, 0, fd, VFS, size, type);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_fstatfs))
-			fscall(mp, MSG_fstatfs, 0, fd, VFS, size, type);
-#endif
-	return 0;
-}
-
-#else
-
-int
-fstatfs3d(int fd, struct statfs* fs)
-{
-#if FS
-	Mount_t*	mp;
-#if !_vfs_statfs
-	struct statvfs	vfs;
-#endif
-
-	if (!fscall(NiL, MSG_fstatfs, 0, fd, VFS))
-	{
-#if !_vfs_statfs
-		if (!state.ret)
-		{
-			memset(fs, 0, sizeof(*fs));
-			fs->f_bsize = vfs.f_bsize;
-			fs->f_blocks = vfs.f_blocks;
-			fs->f_bfree = vfs.f_bfree;
-			fs->f_files = vfs.f_files;
-			fs->f_ffree = vfs.f_ffree;
-		}
-#endif
-		return state.ret;
-	}
-	mp = monitored();
-#endif
-	if (FSTATFS(fd, fs))
-		return -1;
-#if FS
-#if !_vfs_statfs
-	if (mp || state.global)
-	{
-		memset(&vfs, 0, sizeof(vfs));
-		vfs.f_bsize = fs->f_bsize;
-		vfs.f_blocks = fs->f_blocks;
-		vfs.f_bfree = fs->f_bfree;
-		vfs.f_files = fs->f_files;
-		vfs.f_ffree = fs->f_ffree;
-	}
-#endif
-	if (mp)
-		fscall(mp, MSG_fstatfs, 0, fd, VFS);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_fstatfs))
-			fscall(mp, MSG_fstatfs, 0, fd, VFS);
-#endif
-	return 0;
-}
-
-#endif
-
-#else
-
-NoN(fstatfs)
-
-#endif

+ 0 - 56
src/cmd/3d/fstatvfs3d.c

@@ -1,56 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if defined(fstatvfs3d) && defined(_sys_statvfs)
-
-#include <sys/statvfs.h>
-
-int
-fstatvfs3d(int fd, struct statvfs* fs)
-{
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_fstatfs, 0, fd, fs))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (FSTATVFS(fd, fs))
-		return(-1);
-#if FS
-	if (mp)
-		fscall(mp, MSG_fstatfs, 0, fd, fs);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_fstatfs))
-			fscall(mp, MSG_fstatfs, 0, fd, fs);
-#endif
-	return(0);
-}
-
-#else
-
-NoN(fstatvfs)
-
-#endif

+ 0 - 54
src/cmd/3d/fsync3d.c

@@ -1,54 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef fsync3d
-
-int
-fsync3d(int fd)
-{
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_fsync, 0, fd))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (FSYNC(fd))
-		return(-1);
-#if FS
-	if (mp)
-		fscall(mp, MSG_fsync, 0, fd);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_fsync))
-			fscall(mp, MSG_fsync, 0, fd);
-#endif
-	return(0);
-}
-
-#else
-
-NoN(fsync)
-
-#endif

+ 0 - 104
src/cmd/3d/ftruncate3d.c

@@ -1,104 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef ftruncate3d
-
-#if !_nosys_ftruncate64 && _typ_off64_t
-
-#undef	off_t
-#undef	ftruncate
-
-typedef int (*Real_f)(int, off64_t);
-
-int
-ftruncate64(int fd, off64_t size)
-{
-	static Real_f	realf;
-	int		r;
-	int		n;
-	int		m;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_ftruncate, 0, fd, size))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!realf)
-		realf = (Real_f)sysfunc(SYS3D_ftruncate64);
-	for (m = state.trap.size - 1; m >= 0; m--)
-		if (MSG_MASK(MSG_truncate) & state.trap.intercept[m].mask)
-			break;
-	if (m >= 0)
-	{
-		n = state.trap.size;
-		state.trap.size = m;
-		r = (*state.trap.intercept[m].call)(&state.trap.intercept[m], MSG_truncate, SYS3D_ftruncate64, (void*)fd, (void*)&size, NiL, NiL, NiL, NiL);
-		state.trap.size = n;
-	}
-	else
-		r = (*realf)(fd, size);
-#if FS
-	if (!r)
-	{
-		if (mp)
-			fscall(mp, MSG_ftruncate, 0, fd, size);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_ftruncate))
-				fscall(mp, MSG_ftruncate, 0, fd, size);
-	}
-#endif
-	return r;
-}
-
-#endif
-
-int
-ftruncate3d(int fd, off_t size)
-{
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_ftruncate, 0, fd, size))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (FTRUNCATE(fd, size))
-		return -1;
-#if FS
-	if (mp)
-		fscall(mp, MSG_ftruncate, 0, fd, size);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_ftruncate))
-			fscall(mp, MSG_ftruncate, 0, fd, size);
-#endif
-	return 0;
-}
-
-#else
-
-NoN(ftruncate)
-
-#endif

+ 0 - 90
src/cmd/3d/getdents3d.c

@@ -1,90 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2012 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef	getdents3d
-
-ssize_t
-getdents3d(int fd, void* buf, size_t n)
-{
-	ssize_t		r;
-
-#if FS
-	register Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_getdents, 0, fd, buf, n))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if ((r = GETDENTS(fd, buf, n)) >= 0)
-	{
-#if FS
-		if (mp)
-			fscall(mp, MSG_getdents, r, fd, buf, n);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_getdents))
-				fscall(mp, MSG_getdents, r, fd, buf, n);
-#endif
-	}
-	return(r);
-}
-
-#else
-
-NoN(getdents)
-
-#endif
-
-#ifdef	getdents643d
-
-ssize_t
-getdents643d(int fd, void* buf, size_t n)
-{
-	ssize_t		r;
-
-#if FS
-	register Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_getdents, 0, fd, buf, n))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if ((r = GETDENTS64(fd, buf, n)) >= 0)
-	{
-#if FS
-		if (mp)
-			fscall(mp, MSG_getdents, r, fd, buf, n);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_getdents))
-				fscall(mp, MSG_getdents, r, fd, buf, n);
-#endif
-	}
-	return(r);
-}
-
-#else
-
-NoN(getdents64)
-
-#endif

+ 0 - 1714
src/cmd/3d/init.c

@@ -1,1714 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2012 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * 3d file system initialization
- */
-
-#include "3d.h"
-
-static const char id[] =
-#if defined(__STDC__) || defined(__STDPP__)
-"\n@(#)$Id: 3d [ "
-#if DEBUG
-	"debug "
-#endif
-#if FS
-	"msg "
-#endif
-"safe "
-#if VCS
-	"vcs "
-#endif
-"] (AT&T Research) 2012-06-25 $\0\n"
-#else
-"\n@(#)$Id: 3d (AT&T Research) 2011-06-25 $\0\n"
-#endif
-;
-
-/*
- * if _3d_2d!=0 && getenv(_3d_2d)==0 then 2d
- */
-
-char*	_3d_2d = 0;
-
-/*
- * 3d mount get and set access functions
- */
-
-static int
-get_fs(Fs_t* gs, register char* buf, const char* op, int flags)
-{
-	register Fs_t*		fs;
-	register int		n;
-	register int		sum = 0;
-	register unsigned long	x;
-	int			m;
-#if FS
-	Mount_t*		mp;
-#endif
-
-	x = op ? getkey(op, op + strlen(op), 0) : 0;
-	for (fs = state.fs; fs < state.fs + elementsof(state.fs); fs++)
-		if (!(fs->flags & (FS_ERROR|FS_INIT)) && (fs->flags & (FS_BOUND|FS_OPEN)) && (!x || x == fs->key))
-		{
-			if (buf)
-			{
-				if (fs->flags & FS_BOUND) n = sfsprintf(buf, 0, "%-*s", fs->servicesize ? fs->servicesize : strlen(fs->service), fs->service);
-				else n = sfsprintf(buf, 0, "-");
-				n += sfsprintf(buf + n, 0, " /#%s/%s", gs->special, fs->special);
-				m = n;
-#if FS
-				if (fs->ack)
-				{
-					n += sfsprintf(buf + n, 0, "/ack=");
-					n += msggetmask(buf + n, SHRT_MAX, fs->ack);
-				}
-				if (fs->call != ~0)
-				{
-					n += sfsprintf(buf + n, 0, "/call=");
-					n += msggetmask(buf + n, SHRT_MAX, fs->call);
-				}
-				if (fs->flags & FS_CLOSE)
-					n += sfsprintf(buf + n, 0, "/close");
-				if (fs->flags & FS_FLUSH)
-					n += sfsprintf(buf + n, 0, "/flush");
-				if (fs->flags & FS_GLOBAL)
-				{
-					n += sfsprintf(buf + n, 0, "/global");
-					if (!(fs->flags & FS_ACTIVE))
-						for (mp = state.global; mp; mp = mp->global)
-							if (mp->fs == fs && mp->channel && mp->channel != -1)
-							{
-								n += sfsprintf(buf + n, 0, "=%d.%d", state.pid, MSG_CHANNEL_SYS(mp->channel));
-								break;
-							}
-				}
-				if (fs->flags & FS_INTERACTIVE)
-					n += sfsprintf(buf + n, 0, "/interactive");
-				if (fs->match)
-					n += sfsprintf(buf + n, 0, "/match=%-*s", fs->matchsize ? fs->matchsize : strlen(fs->match), fs->match);
-				if (fs->flags & FS_MONITOR)
-					n += sfsprintf(buf + n, 0, "/monitor");
-				if (fs->flags & FS_NAME)
-					n += sfsprintf(buf + n, 0, "/name");
-				if (!(fs->flags & FS_ON))
-					n += sfsprintf(buf + n, 0, "/off");
-				if (fs->flags & FS_RECEIVE)
-					n += sfsprintf(buf + n, 0, "/receive");
-				if (fs->flags & FS_REGULAR)
-					n += sfsprintf(buf + n, 0, "/regular");
-				if (fs->retry)
-					n += sfsprintf(buf + n, 0, "/retry=%d", fs->retry);
-				if (fs->terse)
-				{
-					n += sfsprintf(buf + n, 0, "/terse=");
-					n += msggetmask(buf + n, SHRT_MAX, fs->terse);
-				}
-				if (fs->flags & FS_UNIQUE)
-					n += sfsprintf(buf + n, 0, "/unique");
-				if (fs->flags & FS_WRITE)
-					n += sfsprintf(buf + n, 0, "/write");
-				n += getattr(fs->attr, buf + n);
-#endif
-				if ((flags & (MAP_EXEC|MAP_INIT)) && (fs->flags & FS_OPEN))
-				{
-					if (!(fs->flags & FS_CLOSE))
-					{
-						if (fs->fd >= RESERVED_FD)
-							n += sfsprintf(buf + n, 0, "/fd=%d", fs->fd);
-					}
-					else if ((flags & MAP_EXEC) && !(fs->flags & FS_BOUND))
-						n = 0;
-				}
-				if (n > m || (fs->flags & FS_BOUND))
-				{
-					buf += n++;
-					*buf++ = ' ';
-				}
-				else n = 0;
-			}
-			else n = ((fs->flags & FS_BOUND) ? (fs->servicesize ? fs->servicesize : strlen(fs->service)) : 0) +
-				gs->specialsize +
-				fs->specialsize +
-#if FS
-				(fs->ack ? (msggetmask(NiL, 0, fs->ack) + 6) : 0) +
-				(fs->call != ~0 ? (msggetmask(NiL, 0, fs->call) + 6) : 0) +
-				((fs->flags & FS_CLOSE) ? 6 : 0) +
-				((fs->flags & FS_FLUSH) ? 6 : 0) +
-				((fs->flags & FS_GLOBAL) ? ((fs->flags & (FS_ACTIVE|FS_CLOSE)) ? 7 : 22) : 0) +
-				((fs->flags & FS_INTERACTIVE) ? 11 : 0) +
-				(fs->match ? ((fs->matchsize ? fs->matchsize : strlen(fs->match)) + 7) : 0) +
-				((fs->flags & FS_MONITOR) ? 0 : 8) +
-				((fs->flags & FS_NAME) ? 5 : 0) +
-				((fs->flags & FS_ON) ? 0 : 3) +
-				((fs->flags & FS_RECEIVE) ? 0 : 8) +
-				((fs->flags & FS_REGULAR) ? 0 : 8) +
-				(fs->retry ? 12 : 0) +
-				(fs->terse ? (msggetmask(NiL, 0, fs->terse) + 8) : 0) +
-				((fs->flags & FS_UNIQUE) ? 0 : 7) +
-				((fs->flags & FS_WRITE) ? 0 : 6) +
-				getattr(fs->attr, NiL) +
-#endif
-				((flags & (MAP_EXEC|MAP_INIT)) && (fs->flags & (FS_CLOSE|FS_OPEN)) == FS_OPEN ? 10 : 0) +
-				6;
-			sum += n;
-			if (op)
-			{
-				state.visit.fs = fs;
-				break;
-			}
-		}
-	n = iterate(&state.vmount, mapget, buf, flags);
-	if (buf) buf += n;
-	sum += n;
-	state.visit.fs = 0;
-	return(sum);
-}
-
-/*
- * return mask for msg calls in state.key.*
- */
-
-static unsigned long
-getmsgmask(const char* e)
-{
-	register char*		s;
-	register char*		t;
-	register int		c;
-	register unsigned long	x = ~0;
-
-	if (!(s = state.key.invert)) s = state.key.value;
-	if (s != state.one)
-	{
-		for (t = s; t < (char*)e; t++)
-			if (*t == '/')
-				break;
-		if (c = *t) *t = 0;
-		x = msgsetmask(s);
-		if (c) *t = c;
-	}
-	return(state.key.invert ? ~x : x);
-}
-
-static int
-set_fs(register Fs_t* fs, const char* arg, int argsize, const char* op, int opsize)
-{
-	register Fs_t*		ff;
-	register unsigned long	x;
-	int			n;
-	int			old;
-	const char*		oe;
-#if FS
-	Mount_t*		mp;
-	Mount_t*		pm;
-#endif
-
-	oe = op + (opsize ? opsize : strlen(op));
-	if (!(x = getkey(op, oe, 0)))
-	{
-		if (!*arg)
-			while (state.vmount.table->key)
-				search(&state.vmount, state.vmount.table->key, state.vmount.table->keysize, NiL, T_DELETE);
-		return(0);
-	}
-	for (ff = 0, fs = state.fs; fs < state.fs + elementsof(state.fs); fs++)
-		if ((fs->flags & (FS_BOUND|FS_INTERNAL)) && fs->key == x) break;
-		else if (!ff && !fs->flags) ff = fs;
-	if (fs >= state.fs + elementsof(state.fs))
-	{
-		if (!*arg && !state.key.next) return(0);
-		if (!(fs = ff)) return(-1);
-		fs->specialsize = state.key.next ? (state.key.next - (char*)op - 1) : opsize ? opsize : strlen(op);
-		if (fs->specialsize >= elementsof(fs->special))
-			fs->specialsize = elementsof(fs->special) - 1;
-		strncpy(fs->special, op, fs->specialsize);
-		fs->special[fs->specialsize] = 0;
-		fs->key = x;
-		fs->call = ~0;
-		old = 0;
-	}
-	else if (!*arg && !state.key.next)
-	{
-		fsdrop(fs, 1);
-		return(0);
-	}
-	else old = 1;
-	if (*arg)
-	{
-		n = argsize ? argsize : strlen(arg);
-		if (!fs->service || (fs->servicesize ? fs->servicesize : strlen(fs->service)) != n || strncmp(arg, fs->service, n))
-		{
-			fsdrop(fs, 1);
-			if (fs->servicesize = argsize) fs->service = (char*)arg;
-			else fs->service = strcpy(newof(0, char, n, 1), arg);
-			fs->flags |= FS_BOUND|FS_ON;
-			if (!(fs->flags & FS_INTERNAL)) fs->flags |= FS_FS;
-			if (fs == &state.fs[FS_safe] && !(fs->flags & FS_INIT))
-				state.safe = fs;
-		}
-	}
-	while ((op = (const char*)state.key.next) && (x = getkey(op, oe, 0)))
-		switch (x)
-		{
-		case HASHKEY2('f','d'):
-			fsdrop(fs, 0);
-			if ((fs->fd = strtol(state.key.value, NiL, 0)) > 0)
-				fsinit(fs, fs->fd);
-			break;
-		case HASHKEY3('o','f','f'):
-			if (state.key.invert) fs->flags |= FS_ON;
-			else fs->flags &= ~FS_ON;
-			break;
-		case HASHKEY2('o','n'):
-			if (state.key.invert) fs->flags &= ~FS_ON;
-			else fs->flags |= FS_ON;
-			break;
-#if FS
-		case HASHKEY3('a','c','k'):
-			fs->ack = getmsgmask(oe);
-			break;
-		case HASHKEY6('a','c','t','i','v','e'):
-			if (!(fs->flags & FS_INTERNAL))
-			{
-				if (state.key.invert) fs->flags &= ~FS_ACTIVE;
-				else fs->flags |= FS_ACTIVE;
-			}
-			break;
-		case HASHKEY4('c','a','l','l'):
-			fs->call = getmsgmask(oe);
-			break;
-		case HASHKEY5('c','l','o','s','e'):
-			if (!(fs->flags & FS_INTERNAL))
-			{
-				if (state.key.invert) fs->flags &= ~FS_CLOSE;
-				else fs->flags |= FS_CLOSE;
-			}
-			break;
-		case HASHKEY5('f','l','u','s','h'):
-			if (state.key.invert) fs->flags &= ~FS_FLUSH;
-			else fs->flags |= FS_FLUSH;
-			break;
-		case HASHKEY4('f','o','r','k'):
-			if (!(fs->flags & FS_INTERNAL))
-			{
-				if (state.key.invert) fs->flags &= ~FS_FORK;
-				else fs->flags |= FS_FORK;
-			}
-			break;
-		case HASHKEY6('g','l','o','b','a','l'):
-			if (state.key.invert) fs->flags &= ~FS_GLOBAL;
-			else fs->flags |= FS_GLOBAL;
-			for (mp = state.global, pm = 0; mp && mp->fs != fs; pm = mp, mp = mp->global);
-			if (!mp)
-			{
-				if (!state.key.invert)
-				{
-					for (mp = state.mount; mp < state.mount + elementsof(state.mount) && mp->fs; mp++);
-					if (mp < state.mount + elementsof(state.mount))
-					{
-						mp->fs = fs;
-						mp->global = state.global;
-						state.global = mp;
-						if (state.key.value != state.one)
-						{
-							int	n;
-							char*	e;
-
-							n = strtol(state.key.value, &e, 0);
-							if (*e == '.' && n == state.pid && (n = strtol(e + 1, NiL, 0)))
-								mp->channel = MSG_CHANNEL(state.pid, n);
-						}
-					}
-				}
-			}
-			else if (state.key.invert)
-			{
-				mp->fs = 0;
-				if (pm) pm->global = mp->global;
-				else state.global = 0;
-			}
-			if (state.global && !state.cache) state.cache = 1;
-			break;
-		case HASHKEY6('i','n','t','e','r','a'):
-			if (state.key.invert) fs->flags &= ~FS_INTERACTIVE;
-			else fs->flags |= FS_INTERACTIVE;
-			break;
-		case HASHKEY4('l','o','a','d'):
-			if (!(fs->flags & (FS_INTERNAL|FS_LOAD)) && fs->service)
-			{
-				void*		dll;
-				Fs_get_t	get;
-				Fs_set_t	set;
-
-				if ((dll = dlopen(fs->service, RTLD_LAZY)) && (set = (Fs_set_t)dlsym(dll, "set")))
-				{
-					fs->flags |= FS_LOAD|FS_INIT|FS_ON;
-					fs->set = set;
-					(*fs->set)(fs, state.null, 0, "init", 4);
-					if (get = (Fs_get_t)dlsym(dll, "get"))
-						fs->get = get;
-				}
-			}
-			break;
-		case HASHKEY5('m','a','t','c','h'):
-			if (fs->match)
-			{
-				if (fs->matchsize) fs->matchsize = 0;
-				else free(fs->match);
-				fs->match = 0;
-			}
-			if (!state.key.invert)
-			{
-				if (opsize)
-				{
-					fs->match = state.key.value;
-					fs->matchsize = state.key.valsize;
-				}
-				else fs->match = strcpy(newof(0, char, state.key.valsize, 1), state.key.value);
-			}
-			break;
-		case HASHKEY6('m','o','n','i','t','o'):
-			if (!(fs->flags & FS_INTERNAL))
-			{
-				if (state.key.invert) fs->flags &= ~FS_MONITOR;
-				else fs->flags |= FS_MONITOR;
-			}
-			break;
-		case HASHKEY4('n','a','m','e'):
-			if (!(fs->flags & FS_INTERNAL))
-			{
-				if (state.key.invert) fs->flags &= ~FS_NAME;
-				else fs->flags |= FS_NAME;
-			}
-			break;
-		case HASHKEY6('r','e','c','e','i','v'):
-			if (!(fs->flags & FS_INTERNAL))
-			{
-				if (state.key.invert) fs->flags &= ~FS_RECEIVE;
-				else fs->flags |= FS_RECEIVE;
-			}
-			break;
-		case HASHKEY6('r','e','g','u','l','a'):
-			if (state.key.invert) fs->flags &= ~FS_REGULAR;
-			else fs->flags |= FS_REGULAR;
-			break;
-		case HASHKEY5('r','e','t','r','y'):
-			fs->retry = strtol(state.key.value, NiL, 0);
-			break;
-		case HASHKEY5('t','e','r','s','e'):
-			fs->terse = getmsgmask(oe);
-			break;
-		case HASHKEY6('u','n','i','q','u','e'):
-			if (state.key.invert) fs->flags &= ~FS_UNIQUE;
-			else fs->flags |= FS_UNIQUE;
-			break;
-		case HASHKEY5('w','r','i','t','e'):
-			if (state.key.invert) fs->flags &= ~FS_WRITE;
-			else fs->flags |= FS_WRITE;
-			break;
-		default:
-			setattr(fs->attr, op, oe);
-			break;
-#endif
-		}
-	if (!old)
-	{
-#if FS
-		if ((fs->flags & (FS_ACTIVE|FS_MONITOR)) == FS_ACTIVE)
-			fs->call |= MSG_MASK(MSG_fork);
-		if (fs->flags & FS_NAME) state.call.name++;
-		else state.call.monitor++;
-#endif
-	}
-	return(0);
-}
-
-static int
-get_map(Fs_t* fs, register char* buf, const char* op, int flags)
-{
-	register int	n;
-
-	if (op) return(-1);
-	state.visit.prefix = fs->special;
-	state.visit.prelen = fs->specialsize + 4;
-	n = iterate(&state.vmap, mapget, buf, flags);
-	state.visit.prelen = 0;
-	state.visit.prefix = 0;
-	return(n);
-}
-
-static int
-set_map(Fs_t* fs, const char* arg, int argsize, const char* op, int opsize)
-{
-	NoP(fs);
-	return(mapset(&state.vmap, arg, argsize, op, opsize));
-}
-
-static int
-get_safe(Fs_t* fs, register char* buf, const char* op, int flags)
-{
-	register int	n;
-
-	if (op) return(-1);
-	state.visit.prefix = fs->special;
-	state.visit.prelen = fs->specialsize + 4;
-	n = iterate(&state.vsafe, mapget, buf, flags);
-	state.visit.prelen = 0;
-	state.visit.prefix = 0;
-	return(n);
-}
-
-static int
-set_safe(Fs_t* fs, const char* arg, int argsize, const char* op, int opsize)
-{
-	NoP(fs);
-	return(mapset(&state.vsafe, arg, argsize, op, opsize));
-}
-
-static int
-get_intercept(Fs_t* fs, register char* buf, const char* op, int flags)
-{
-	register int	n;
-
-	if (op)
-		return -1;
-	state.visit.prefix = fs->special;
-	state.visit.prelen = fs->specialsize + 4;
-	n = iterate(&state.vintercept, mapget, buf, flags);
-	state.visit.prelen = 0;
-	state.visit.prefix = 0;
-	return n;
-}
-
-typedef int (*Init_f)(int, const char*, int);
-
-static int
-set_intercept(Fs_t* fs, const char* arg, int argsize, const char* op, int opsize)
-{
-	void*			dll;
-	Init_f			init;
-	char			buf[PATH_MAX + 1];
-
-	static const char	sym[] = "_3d_init";
-
-	NoP(fs);
-	if (!*arg || mapset(&state.vintercept, arg, argsize, op, opsize))
-		return -1;
-	if (argsize)
-	{
-		if (argsize > PATH_MAX)
-			return -1;
-		strncpy(buf, arg, argsize);
-		buf[argsize] = 0;
-		arg = (const char*)buf;
-	}
-	if (!(dll = dlopen(arg, RTLD_LAZY)))
-	{
-		error(2, "%s: %s", arg, dlerror());
-		return -1;
-	}
-	if (!(init = (Init_f)dlsym(dll, sym)))
-	{
-		error(2, "%s: %s: initialization function not found", arg, sym);
-		dlclose(dll);
-		return -1;
-	}
-	return (*init)(0, op, opsize);
-}
-
-#if FS
-
-static void
-bencode(char** b, char* e, register unsigned long n, int a, int r, int x)
-{
-	register char*	s;
-	register char*	t;
-	register int	m;
-	register int	z;
-	char		buf[16];
-
-	s = buf;
-	z = (1 << (r - (x != 0)));
-	do
-	{
-		m = n & ((1 << r) - 1);
-		*s++ = m + ((m >= z) ? x : a);
-	} while ((n >>= r) && s < &buf[sizeof(buf)]);
-	t = *b;
-	while (s > buf && t < e)
-		*t++ = *--s;
-}
-
-#endif
-
-static int
-get_option(register Fs_t* fs, register char* buf, const char* op, int flags)
-{
-	register int		c;
-	register int		n;
-	register int		sum = 0;
-	register unsigned long	x;
-	char*			b;
-	char*			e;
-	int			m;
-
-	x = op ? getkey(op, op + strlen(op), 0) : 0;
-
-	/*
-	 * table version
-	 */
-
-	if (!x && (flags & (MAP_EXEC|MAP_INIT)) || x == HASHKEY6('v','e','r','s','i','o'))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "- /#%s/version=%d ", fs->special, TABLE_VERSION);
-			buf += n;
-		}
-		else n = fs->specialsize + 18;
-		sum += n;
-	}
-
-	/*
-	 * trace output -- special case to capture redirection early
-	 */
-
-	if (!x && (fs->flags & FS_BOUND))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "%-*s /#%s/%s ", fs->servicesize ? fs->servicesize : strlen(fs->service), fs->service, state.fs[FS_fs].special, fs->special);
-			buf += n;
-		}
-		else n = (fs->servicesize ? fs->servicesize : strlen(fs->service)) + state.fs[FS_fs].specialsize + fs->specialsize + 4;
-		sum += n;
-	}
-
-	/*
-	 * test mask
-	 */
-
-	if (!x && state.test || x == HASHKEY4('t','e','s','t'))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "- /#%s/test=0%lo ", fs->special, state.test);
-			buf += n;
-		}
-		else n = fs->specialsize + 23;
-		sum += n;
-	}
-
-	/*
-	 * readdir() view boundaries
-	 */
-
-	if (x == HASHKEY6('b','o','u','n','d','a'))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "- /#%s/%sboundary ", fs->special, state.boundary ? state.null : "no");
-			buf += n;
-		}
-		else n = fs->specialsize + 16;
-		sum += n;
-	}
-
-#if DEBUG
-	/*
-	 * debug level
-	 */
-
-	if (!x && error_info.trace || x == HASHKEY5('d','e','b','u','g'))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "- /#%s/debug=%d ", fs->special, -error_info.trace);
-			buf += n;
-		}
-		else n = fs->specialsize + 18;
-		sum += n;
-	}
-#endif
-
-	/*
-	 * license features
-	 */
-
-	if (!x && *state.license || x == HASHKEY6('l','i','c','e','n','s'))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "- /#%s/license=%s ", fs->special, state.license);
-			buf += n;
-		}
-		else n = fs->specialsize + strlen(state.license) + 14;
-		sum += n;
-	}
-
-	/*
-	 * 2d && 3d
-	 */
-
-	if (!x && (state.in_2d || state.limit < TABSIZE) || x == HASHKEY2(HASHKEYN('2'),'d') || x == HASHKEY2(HASHKEYN('3'),'d'))
-	{
-		if (buf)
-		{
-			n = (state.limit == TABSIZE) ? sfsprintf(buf, 0, "- /#%s/%cd ", fs->special, state.in_2d ? '2' : '3') : sfsprintf(buf, 0, "- /#%s/2d=%d ", fs->special, state.limit);
-			buf += n;
-		}
-		else n = fs->specialsize + (state.limit == TABSIZE) ? 8 : 11;
-		sum += n;
-	}
-
-#if FS
-
-	/*
-	 * file table
-	 */
-
-	if (state.cache && (!x && (flags & (MAP_EXEC|MAP_INIT)) || x == HASHKEY4('f','i','l','e')))
-	{
-		b = state.path.name;
-		e = b + sizeof(state.path.name) - 1;
-		c = -1;
-		for (n = m = 0; n <= state.cache; n++)
-			if (state.file[n].flags & FILE_CLOEXEC)
-			{
-				if ((flags & MAP_EXEC) && state.file[n].mount && fssys(state.file[n].mount, MSG_close))
-					fscall(state.file[n].mount, MSG_close, 0, n);
-			}
-			else if (state.file[n].flags & FILE_OPEN)
-			{
-				if ((x = n - m - 1) > 0)
-					bencode(&b, e, x, '0', 3, 0);
-				if (x = state.file[n].id.fid[0])
-					bencode(&b, e, x, 'a', 4, 0);
-				bencode(&b, e, state.file[n].id.fid[1], 'A', 4, 0);
-				if (state.file[n].mount && (x = state.file[n].mount - state.mount) != c)
-					bencode(&b, e, c = x, 'Q', 4, 'q');
-				m = n;
-			}
-		n = b - state.path.name;
-		*b = 0;
-		b = state.path.name;
-		if (n)
-		{
-			if (buf)
-			{
-				n = sfsprintf(buf, 0, "- /#%s/file=%s ", fs->special, b);
- 				buf += n;
- 			}
- 			else n += fs->specialsize + 11;
- 			sum += n;
-		}
-	}
-
-#endif
-
-	/*
-	 * fd table
-	 */
-
-	if (!x && (flags & (MAP_EXEC|MAP_INIT)) && state.table.fd != TABLE_FD || x == HASHKEY5('t','a','b','l','e'))
-	{
-		if (buf)
-		{
-			if ((n = FCNTL(TABLE_FD, F_GETFD, 0)) >= 0)
-			{
-				n = n ? -1 : FCNTL(TABLE_FD, F_DUPFD, RESERVED_FD);
-				CLOSE(TABLE_FD);
-			}
-			if (state.table.fd <= 0 || FCNTL(state.table.fd, F_DUPFD, TABLE_FD) < 0)
-			{
-				if (state.table.fd > 0)
-					cancel(&state.table.fd);
-				n = -1;
-			}
-			else
-			{
-				cancel(&state.table.fd);
-				state.table.fd = TABLE_FD;
-				reserve(&state.table.fd);
-			}
-			if (n < 0) n = 0;
-			else
-			{
-				n = sfsprintf(buf, 0, "- /#%s/table=%d ", fs->special, n);
-				buf += n;
-			}
-		}
-		else n = fs->specialsize + 18;
-		sum += n;
-	}
-
-	/*
-	 * syscall count
-	 */
-
-	if (!x && state.trace.count || x == HASHKEY5('c','o','u','n','t'))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "- /#%s/%scount ", fs->special, state.trace.count ? state.null : "no");
-			buf += n;
-		}
-		else n = fs->specialsize + 13;
-		sum += n;
-	}
-
-	/*
-	 * syscall trace
-	 */
-
-	if (!x && state.trace.pid || x == HASHKEY5('t','r','a','c','e'))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "- /#%s/trace=%u ", fs->special, state.trace.pid + ((flags & (MAP_EXEC|MAP_INIT)) && state.trace.pid <= 2));
-			buf += n;
-		}
-		else n = fs->specialsize + 18;
-		sum += n;
-	}
-
-	/*
-	 * syscall calls
-	 */
-
-	if (state.trace.call != ~0 && (!x || x == HASHKEY4('c','a','l','l')))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "- /#%s/call=", fs->special);
-			n += msggetmask(buf + n, SHRT_MAX, state.trace.call);
-			buf += n++;
-			*buf++ = ' ';
-		}
-		else n = fs->specialsize + msggetmask(NiL, 0, state.trace.call) + 12;
-		sum += n;
-	}
-
-#if FS
-
-	/*
-	 * message timeout
-	 */
-
-	if (!x && msg_info.timeout != MSG_TIMEOUT || x == HASHKEY6('t','i','m','e','o','u'))
-	{
-		if (buf)
-		{
-			n = sfsprintf(buf, 0, "- /#%s/timeout=%d ", fs->special, msg_info.timeout);
-			buf += n;
-		}
-		else n = fs->specialsize + 20;
-		sum += n;
-	}
-
-#endif
-
-	return(sum);
-}
-
-#if DEBUG && FS
-
-#define DUMP_call	(1<<0)
-#define DUMP_file	(1<<1)
-#define DUMP_fs		(1<<2)
-#define DUMP_map	(1<<3)
-#define DUMP_mount	(1<<4)
-#define DUMP_safe	(1<<5)
-#define DUMP_state	(1<<6)
-#define DUMP_view	(1<<7)
-
-/*
- * dump Table_t
- */
-
-static void
-dumptable(char** b, char* e, Table_t* tab, const char* name)
-{
-	register Map_t*	cp;
-	register Map_t*	ep;
-	register int	n;
-
-	if (tab->size)
-	{
-		bprintf(b, e, "\n%s table\n\n", name);
-		for (ep = (cp = tab->table) + tab->size; cp < ep; cp++)
-		{
-			bprintf(b, e, "  [%d]  %-*s", cp - tab->table, cp->keysize, cp->key);
-			if ((n = 32 - cp->keysize) > 0)
-				bprintf(b, e, "%*s", n, state.null);
-			bprintf(b, e, " %-*s\n", T_VALSIZE(cp), cp->val);
-		}
-	}
-}
-
-/*
- * dump internal state to option output
- */
-
-static void
-dump(const char* op, const char* oe)
-{
-	register char*		e;
-	register File_t*	fp;
-	register Fs_t*		fs;
-	register Mount_t*	mp;
-	register int		list;
-	register int		n;
-	int			on;
-	char*			b;
-
-	if ((on = fsfd(&state.fs[FS_option])) <= 0) return;
-	if (op == (char*)state.one) list = ~DUMP_call;
-	else
-	{
-		list = 0;
-		e = state.key.next;
-		state.key.next = (char*)op;
-		for (;;)
-		{
-			switch (getkey(state.key.next, oe, ','))
-			{
-			case 0:
-				break;
-			case HASHKEY4('c','a','l','l'):
-				list |= DUMP_call;
-				continue;
-			case HASHKEY4('f','i','l','e'):
-				list |= DUMP_file;
-				continue;
-			case HASHKEY2('f','s'):
-				list |= DUMP_fs;
-				continue;
-			case HASHKEY3('m','a','p'):
-				list |= DUMP_map;
-				continue;
-			case HASHKEY5('m','o','u','n','t'):
-				list |= DUMP_mount;
-				continue;
-			case HASHKEY4('s','a','f','e'):
-				list |= DUMP_safe;
-				continue;
-			case HASHKEY5('s','t','a','t','e'):
-				list |= DUMP_state;
-				continue;
-			case HASHKEY4('v','i','e','w'):
-				list |= DUMP_view;
-				continue;
-			}
-			break;
-		}
-		state.key.next = e;
-		if (!list) return;
-	}
-	e = (b = state.path.name) + sizeof(state.path.name) - 1;
-	if (list & DUMP_state)
-	{
-		bprintf(&b, e, "\nstate %s\n\n", id + 10);
-		if (state.limit == TABSIZE) bprintf(&b, e, "           %cd  on\n", state.in_2d ? '2' : '3');
-		else bprintf(&b, e, "           2d  %d\n", state.limit);
-		bprintf(&b, e, "     boundary  %s\n", state.boundary ? "on" : "off");
-		bprintf(&b, e, "        cache  %u\n", state.cache);
-		bprintf(&b, e, "         call  %u.%u", state.call.monitor, state.call.name);
-		if (state.trace.call != ~0)
-		{
-			bprintf(&b, e, " ");
-			b += msggetmask(b, e - b, state.trace.call);
-		}
-		bprintf(&b, e, "\n        count  %u\n", state.trace.count);
-#if DEBUG
-		bprintf(&b, e, "        debug  %d\n", -error_info.trace);
-#endif
-		bprintf(&b, e, "        level  %d\n", state.level);
-#if LICENSED
-		bprintf(&b, e, "      license  %s\n", state.license);
-#endif
-		bprintf(&b, e, "          pid  %u\n", state.pid);
-		bprintf(&b, e, "          pwd  %s\n", state.pwd);
-		bprintf(&b, e, "        table  %d\n", state.table.fd);
-		bprintf(&b, e, "         test  %08o\n", state.test);
-		bprintf(&b, e, "        trace  %u\n", state.trace.pid);
-		bprintf(&b, e, "      version  %u\n", TABLE_VERSION);
-	}
-	if (list & DUMP_fs)
-	{
-		bprintf(&b, e, "\nfs table\n\n");
-		for (fs = state.fs; fs < state.fs + elementsof(state.fs); fs++)
-			if (fs->flags)
-			{
-				if ((n = fs - state.fs) < 10) n += '0';
-				else n -= 10 - 'a';
-				bprintf(&b, e, "  [%c]  %-*s", n, sizeof(fs->special), fs->special);
-				if (fs->flags & FS_BOUND) bprintf(&b, e, " service=%-*s", fs->servicesize ? fs->servicesize : strlen(fs->service), fs->service);
-				if (fs->flags & FS_ACTIVE) bprintf(&b, e, " active");
-				if (fs->flags & FS_CLOSE) bprintf(&b, e, " close");
-				if (fs->flags & FS_ERROR) bprintf(&b, e, " error");
-				if (fs->flags & FS_FLUSH) bprintf(&b, e, " flush");
-				if (fs->flags & FS_FORK) bprintf(&b, e, " fork");
-				if (fs->flags & FS_FS) bprintf(&b, e, " fs");
-				if (fs->flags & FS_GLOBAL) bprintf(&b, e, " global");
-				if (fs->flags & FS_INIT) bprintf(&b, e, " init");
-				if (fs->flags & FS_INTERACTIVE) bprintf(&b, e, " interactive");
-				if (fs->flags & FS_INTERNAL) bprintf(&b, e, " internal");
-#if LICENSED
-				if (fs->flags & FS_LICENSED) bprintf(&b, e, " licensed");
-#endif
-				if (fs->flags & FS_LOAD) bprintf(&b, e, " load");
-				if (fs->flags & FS_LOCK) bprintf(&b, e, " lock");
-				if (fs->flags & FS_MAGIC) bprintf(&b, e, " magic");
-				if (fs->flags & FS_MONITOR) bprintf(&b, e, " monitor");
-				if (fs->flags & FS_NAME) bprintf(&b, e, " name");
-				if (!(fs->flags & FS_ON)) bprintf(&b, e, " off");
-				if (fs->flags & FS_OPEN) bprintf(&b, e, " open=%d", fs->fd);
-				if (fs->flags & FS_RAW) bprintf(&b, e, " raw");
-				if (fs->flags & FS_RECEIVE) bprintf(&b, e, " receive");
-				if (fs->flags & FS_REFERENCED) bprintf(&b, e, " referenced");
-				if (fs->flags & FS_REGULAR) bprintf(&b, e, " regular");
-				if (fs->flags & FS_UNIQUE) bprintf(&b, e, " unique");
-				if (fs->flags & FS_VALIDATED) bprintf(&b, e, " validated");
-				if (fs->flags & FS_WRITE) bprintf(&b, e, " write");
-				if (fs->call != ~0)
-				{
-					bprintf(&b, e, " call=");
-					b += msggetmask(b, e - b, fs->call);
-				}
-				if (fs->ack)
-				{
-					bprintf(&b, e, " ack=");
-					b += msggetmask(b, e - b, fs->ack);
-				}
-				if (fs->terse)
-				{
-					bprintf(&b, e, " terse=");
-					b += msggetmask(b, e - b, fs->terse);
-				}
-				bprintf(&b, e, "%s", fs->attr);
-				bprintf(&b, e, "\n");
-			}
-	}
-	if (list & DUMP_mount)
-	{
-		bprintf(&b, e, "\nmount table\n\n");
-		for (mp = state.mount; mp < state.mount + elementsof(state.mount); mp++)
-			if (mp->fs)
-			{
-				if ((n = mp - state.mount) < 10) n += '0';
-				else n -= 10 - 'a';
-				bprintf(&b, e, "  [%c]  %-*s", n, sizeof(mp->fs->special), mp->fs->special);
-				if (mp->logical) bprintf(&b, e, " logical=%-*s", mp->logicalsize ? mp->logicalsize : strlen(mp->logical), mp->logical);
-				else if (mp->fs->flags & FS_GLOBAL) bprintf(&b, e, " global");
-				if (mp->physical) bprintf(&b, e, " physical=%-*s", mp->physicalsize ? mp->physicalsize : strlen(mp->physical), mp->physical);
-				if (mp->channel) bprintf(&b, e, " channel=%u", MSG_CHANNEL_SYS(mp->channel));
-				bprintf(&b, e, "%s", mp->attr);
-				bprintf(&b, e, "\n");
-			}
-	}
-	if (list & DUMP_file)
-	{
-		bprintf(&b, e, "\nfile table\n\n");
-		for (fp = state.file; fp < state.file + elementsof(state.file); fp++)
-			if ((mp = fp->mount) || (fp->flags & (FILE_ERROR|FILE_OPEN)) || fp->reserved)
-			{
-				bprintf(&b, e, "  [%02d]", fp - state.file);
-				if (mp)
-				{
-					if ((n = mp - state.mount) < 10) n += '0';
-					else n -= 10 - 'a';
-					bprintf(&b, e, " mount=%s[%c]", mp->fs->special, n);
-				}
-				if (fp->flags & FILE_CLOEXEC) bprintf(&b, e, " cloexec");
-				if (fp->flags & FILE_ERROR) bprintf(&b, e, " error");
-				if (fp->flags & FILE_LOCK) bprintf(&b, e, " lock");
-				if (fp->id.fid[0] || fp->id.fid[1]) bprintf(&b, e, " fid=%ld%s%ld", fp->id.fid[0], fp->id.fid[1] >= 0 ? "+" : state.null, fp->id.fid[1]);
-				if (fp->flags & FILE_OPEN) bprintf(&b, e, " open");
-				if (fp->flags & FILE_REGULAR) bprintf(&b, e, " regular");
-				if (fp->reserved) bprintf(&b, e, " reserved");
-				if (fp->flags & FILE_VIRTUAL) bprintf(&b, e, " virtual");
-				if (fp->flags & FILE_WRITE) bprintf(&b, e, " write");
-				if (n = fp->flags & ~(FILE_LOCAL - 1)) bprintf(&b, e, " local=%08o", n);
-				bprintf(&b, e, "\n");
-			}
-	}
-	if (list & DUMP_view) dumptable(&b, e, &state.vpath, "view");
-	if (list & DUMP_map) dumptable(&b, e, &state.vmap, "map");
-	if (list & DUMP_safe) dumptable(&b, e, &state.vsafe, "safe");
-	if (list & DUMP_call) calldump(&b, e);
-	bprintf(&b, e + 1, "\n");
-	WRITE(on, state.path.name, b - state.path.name);
-}
-
-#endif
-
-static int
-set_option(Fs_t* fs, const char* arg, int argsize, const char* op, int opsize)
-{
-	register int		c;
-	register const char*	oe;
-	register char*		s;
-	int			i;
-	int			m;
-	long			n;
-#if FS
-	Mount_t*		mp;
-#endif
-
-	NoP(argsize);
-	oe = op + (opsize ? opsize : strlen(op));
-	do switch (n = getkey(op, oe, 0))
-	{
-	case HASHKEY2(HASHKEYN('2'),'d'):
-		state.limit = state.key.value == state.one ? 0 : strtol(state.key.value, NiL, 0);
-		if (state.limit > 0) state.in_2d = 0;
-		else
-		{
-			if (state.limit < 0)
-				cancel(&state.table.fd);
-			state.limit = TABSIZE;
-			state.in_2d = 1;
-		}
-		break;
-	case HASHKEY2(HASHKEYN('3'),'d'):
-		state.in_2d = strtol(state.key.value, NiL, 0) <= 0;
-		state.limit = TABSIZE;
-		break;
-	case HASHKEY6('b','o','u','n','d','a'):
-		state.boundary = strtol(state.key.value, NiL, 0) > 0;
-		break;
-	case HASHKEY4('c','a','l','l'):
-		state.trace.call = getmsgmask(oe);
-		if (state.trace.count)
-			state.trace.call |= MSG_MASK(MSG_exit);
-		break;
-	case HASHKEY5('c','o','u','n','t'):
-		if (state.trace.count = strtol(state.key.value, NiL, 0))
-		{
-			state.trace.call |= MSG_MASK(MSG_exit);
-			if (!state.trace.pid)
-			{
-				state.trace.pid = 1;
-				goto setout;
-			}
-		}
-		break;
-
-#if DEBUG
-	case HASHKEY5('d','e','b','u','g'):
-		c = error_info.trace;
-		if (error_info.trace = -strtol(state.key.value, NiL, 0));
-		{
-			if (!c)
-			{
-				errno = 0;
-				message((error_info.trace, "%s [%d]", state.id, state.pid));
-			}
-			goto setout;
-		}
-		break;
-#endif
-
-#if DEBUG && FS
-	case HASHKEY4('d','u','m','p'):
-		dump(state.key.value, oe);
-		break;
-#endif
-
-#if FS
-	case HASHKEY4('f','i','l','e'):
-		s = state.key.value;
-		n = -1;
-		m = 0;
-		while (s < oe)
-		{
-			long	fid[2];
-			long	off;
-
-			if ((c = *s++) >= '0' && c < '0' + 8)
-			{
-				i = c - '0';
-				while (s < oe && (c = *s++) >= '0' && c < '0' + 8)
-					i = (i << 3) + c - '0';
-				if (s >= oe) break;
-				n += i;
-			}
-			else n++;
-			fid[0] = 0;
-			while (c >= 'a' && c < 'a' + 16)
-			{
-				fid[0] = (fid[0] << 4) + c - 'a';
-				if (s >= oe) break;
-				c = *s++;
-			}
-			fid[1] = 0;
-			while (c >= 'A' && c < 'A' + 16)
-			{
-				fid[1] = (fid[1] << 4) + c - 'A';
-				if (s >= oe) break;
-				c = *s++;
-			}
-			off = 0;
-			while (c >= 'a' && c < 'a' + 16)
-			{
-				off = (off << 4) + c - 'a';
-				if (s >= oe) break;
-				c = *s++;
-			}
-			i = 0;
-			for (;;)
-			{
-				if (c >= 'Q' && c < 'Q' + 8)
-					i = (i << 4) + c - 'Q';
-				else if (c >= 'q' && c < 'q' + 8)
-					i = (i << 4) + c - 'q' + 8;
-				else break;
-				if (s >= oe) break;
-				c = *s++;
-			}
-			if (i) m = i;
-			if (m >= 0 && m < elementsof(state.mount) && !fileinit(n, NiL, state.mount + m, 0))
-			{
-				state.file[n].id.fid[0] = fid[0];
-				state.file[n].id.fid[1] = fid[1];
-			}
-		}
-		break;
-#endif
-
-	case HASHKEY4('f','o','r','k'):
-		if (state.trace.pid > 2)
-			state.trace.pid = state.pid;
-		break;
-	case HASHKEY4('i','n','i','t'):
-		if (!(fs->flags & FS_OPEN) && !FSTAT(2, &fs->st))
-		{
-			fs->flags |= FS_OPEN;
-			fs->fd = 2;
-		}
-		state.trace.call = ~0;
-		break;
-	case HASHKEY6('l','i','c','e','n','s'):
-		if ((char*)op >= state.table.buf && (char*)oe < state.table.buf + sizeof(state.table.buf))
-		{
-			if (state.key.valsize >= sizeof(state.license))
-				state.key.valsize = sizeof(state.license) - 1;
-			memcpy(state.license, state.key.value, state.key.valsize);
-			state.license[state.key.valsize] = 0;
-		}
-		break;
-
-#if DEBUG && FS
-	case HASHKEY5('m','o','u','n','t'):
-		if (pathreal(arg, P_PATHONLY|P_ABSOLUTE|P_NOSLASH, NiL) && (mp = getmount(state.path.name, &arg)))
-			error(0, "getmount: %s: %s + %s", state.path.name, mp->fs->special, *arg ? arg : state.dot);
-		break;
-#endif
-
-	case HASHKEY5('t','a','b','l','e'):
-		if (state.table.fd == TABLE_FD && (i = strtol(state.key.value, NiL, 0)) > 0 && i != TABLE_FD)
-		{
-			CLOSE(state.table.fd);
-			state.table.fd = FCNTL(i, F_DUPFD, TABLE_FD);
-			CLOSE(i);
-		}
-		break;
-	case HASHKEY4('t','e','s','t'):
-		if (state.key.invert)
-		{
-			if (*state.key.invert >= '0' && *state.key.invert <= '9') state.key.value = state.key.invert;
-			if ((n = strtol(state.key.value, NiL, 0)) <= 0) state.test = 0;
-			else state.test &= ~n;
-		}
-		else state.test |= strtol(state.key.value, NiL, 0);
-		break;
-
-#if FS
-	case HASHKEY6('t','i','m','e','o','u'):
-		msg_info.timeout = strtol(state.key.value, NiL, 0);
-		break;
-	case HASHKEY6('t','i','m','e','s','t'):
-		msg_info.timestamp = !state.key.invert;
-		break;
-#endif
-
-	case HASHKEY5('t','r','a','c','e'):
-		if (state.trace.pid = strtol(state.key.value, NiL, 0))
-		{
-			if (state.trace.pid > 2)
-				state.trace.pid = state.pid;
-		setout:
-			if (state.fs[FS_option].fd == 2 && (i = FCNTL(2, F_DUPFD, RESERVED_FD)) >= 0)
-			{
-				state.fs[FS_option].fd = i;
-				reserve(&state.fs[FS_option].fd);
-			}
-		}
-		break;
-	case HASHKEY6('v','e','r','s','i','o'):
-		if ((state.table.version = strtol(state.key.value, NiL, 0)) != TABLE_VERSION)
-			return(-1);
-		break;
-	} while (op = (const char*)state.key.next);
-	return(0);
-}
-
-static int
-get_pwd(register Fs_t* fs, register char* buf, const char* op, int flags)
-{
-	register int	n = 0;
-
-	NoP(flags);
-	if (op) return(-1);
-	if (state.pwd)
-	{
-		if (buf) n = sfsprintf(buf, 0, "%s /#%s ", state.pwd, fs->special);
-		else n = state.pwdsize + fs->specialsize + 4;
-	}
-	return(n);
-}
-
-/*
- * set state.pwd from s
- */
-
-static int
-setpwd(register const char* s)
-{
-	int		osiz;
-	int		olev;
-	struct stat	dot;
-	struct stat	pwd;
-
-	if (*s != '/' || *state.pwd == '/')
-		return(-1);
-	if (STAT(state.dot, &dot))
-	{
-		message((-1, "%s: cannot stat", state.dot));
-		return(-1);
-	}
-	osiz = state.pwdsize;
-	if ((state.pwdsize = strlen(s)) >= sizeof(state.pwdbuf))
-		state.pwdsize = sizeof(state.pwdbuf) - 1;
-	strncpy(state.pwd, s, state.pwdsize);
-	state.pwd[state.pwdsize] = 0;
-	state.pwdsize = pathcanon(state.pwd, sizeof(state.pwdbuf), 0) - state.pwd;
-	olev = state.level;
-	state.level = -1;
-	state.path.linkname = 0;
-	if ((s = pathreal(state.pwd, 0, &pwd)) && (dot.st_ino == pwd.st_ino && dot.st_dev == pwd.st_dev || state.path.linkname && !STAT(state.path.name, &pwd) && dot.st_ino == pwd.st_ino && dot.st_dev == pwd.st_dev))
-	{
-		state.level = state.path.level;
-		memcpy(state.envpwd + sizeof(var_pwd) - 1, state.pwd, state.pwdsize);
-		message((-1, "setpwd: state.pwd=%s state.level=%d state.path.level=%d", state.pwd, state.level, state.path.level));
-		return(0);
-	}
-	message((-1, "%s: cannot set PWD", state.pwd));
-	*state.pwd = '.';
-	*(state.pwd + 1) = 0;
-	state.pwdsize = osiz;
-	state.level = olev;
-	return(-1);
-}
-
-static int
-set_pwd(Fs_t* fs, const char* arg, int argsize, const char* op, int opsize)
-{
-	int	c;
-	int	r;
-
-	NoP(fs);
-	NoP(op);
-	NoP(opsize);
-	if (!*arg || *state.pwd == '/')
-		return(0);
-	if (argsize)
-	{
-		c = *((char*)arg + argsize);
-		*((char*)arg + argsize) = 0;
-	}
-	else c = 0;
-	if (op) message((-1, "set_pwd arg=%s op=%-*s", arg, opsize ? opsize : strlen(op), op));
-	r = setpwd(arg);
-	if (c) *((char*)arg + argsize) = c;
-	return(r);
-}
-
-static int
-get_view(Fs_t* fs, register char* buf, const char* op, int flags)
-{
-	NoP(fs);
-	if (op) return(-1);
-	return(iterate(&state.vpath, mapget, buf, flags));
-}
-
-static int
-set_view(Fs_t* fs, const char* arg, int argsize, const char* op, int opsize)
-{
-	NoP(fs);
-	return(mapset(&state.vpath, arg, argsize, op, opsize));
-}
-
-/*
- * set state.shell from s
- */
-
-static int
-setshell(register const char* s)
-{
-	if (ACCESS(s, 1))
-	{
-		message((-1, "%s: cannot access SHELL", s));
-		return(-1);
-	}
-	strncpy(state.shell, s, PATH_MAX);
-	return(0);
-}
-
-/*
- * static data initialization
- */
-
-#define FSINIT(n,g,s,f,k)	{FS_INTERNAL|f,0,0,sizeof(n)-1,g,s,k,0,~0,0,n}
-
-State_t	state =
-{
-	id + 10,			/* id			*/
-	IDNAME,				/* cmd			*/
-	".",				/* dot			*/
-	"",				/* null			*/
-	"1",				/* one			*/
-	"/bin/sh",			/* binsh		*/
-	var_3d,				/* env3d		*/
-	var_pwd,			/* envpwd		*/
-	var_shell,			/* envshell		*/
-	var_view,			/* envview		*/
-	{
-	FSINIT("null",	0,		0,		FS_LICENSED,
-		HASHKEY4('n','u','l','l')),
-	FSINIT("option",get_option,	set_option,	FS_FORK|FS_LICENSED,
-		HASHKEY6('o','p','t','i','o','n')),
-	FSINIT("view",	get_view,	set_view,	0,
-		HASHKEY4('v','i','e','w')),
-	FSINIT("pwd",	get_pwd,	set_pwd,	FS_LICENSED,
-		HASHKEY3('p','w','d')),
-	FSINIT("fs",	get_fs,		set_fs,		0,
-		HASHKEY2('f','s')),
-	FSINIT("map",	get_map,	set_map,	0,
-		HASHKEY3('m','a','p')),
-	FSINIT("safe",	get_safe,	set_safe,	0,
-		HASHKEY4('s','a','f','e')),
-#if FS
-	FSINIT("fd",	0,		0,		FS_FS|FS_NAME,
-		HASHKEY2('f','d')),
-#endif
-	FSINIT("intercept",	get_intercept,	set_intercept,	FS_RAW,
-		HASHKEY6('i','n','t','e','r','c')),
-
-	/* NOTE: add internal mounts here */
-
-#if VCS && defined(VCS_FS)
-	VCS_FS,
-#endif
-	},
-	"default",			/* default instance name*/
-	".../...",			/* opaque		*/
-	TABSIZE,			/* limit		*/
-};
-
-/*
- * note external control interrupt
- */
-
-static void
-note(int sig)
-{
-	state.control.note++;
-	signal(sig, note);
-}
-
-/*
- * handle external control interrupt
- */
-
-void
-control(void)
-{
-	char*	s;
-	int	fd;
-	ssize_t	n;
-	char	buf[PATH_MAX];
-
-	if (state.control.note)
-	{
-		message((-2, "external control interrupt"));
-		if (s = state.control.path) n = state.control.pathsize;
-		else
-		{
-			s = "/tmp/3d";
-			n = 0;
-		}
-		if (!n) n = strlen(s);
-		sfsprintf(buf, sizeof(buf), "%-*s#%d", n, s, state.pid);
-		if ((fd = OPEN(buf, O_RDONLY, 0)) >= 0)
-		{
-			if ((n = READ(fd, buf, sizeof(buf) - 1)) > 0)
-			{
-				buf[n] = 0;
-				mapinit(buf, 0);
-			}
-			CLOSE(fd);
-			if ((fd = OPEN(buf, O_RDWR|O_TRUNC, 0)) >= 0)
-				CLOSE(fd);
-		}
-		state.control.note = 0;
-	}
-}
-
-/*
- * push system call intercept
- */
-
-int
-intercept(Intercept_f call, unsigned long mask)
-{
-	register int	i;
-
-	for (i = 0;; i++)
-		if (i >= state.trap.size)
-		{
-			if (i >= elementsof(state.trap.intercept))
-				return(-1);
-			state.trap.size++;
-			break;
-		}
-		else if (state.trap.intercept[i].call == call)
-			break;
-	state.trap.intercept[i].call = call;
-	state.trap.intercept[i].mask = mask;
-	return(0);
-}
-
-/*
- * 3d initialization
- */
-
-#define env_2d		(1<<0)
-#define env_3d		(1<<1)
-#define env_cmd		(1<<2)
-#define env_path	(1<<3)
-#define env_pwd		(1<<4)
-#define env_shell	(1<<5)
-#define env_view	(1<<6)
-#define env_must	(env_2d|env_3d|env_cmd|env_path|env_pwd|env_shell|env_view)
-#define env_home	(1<<7)
-
-#define var_cmd		"_="
-#define var_disable	"_3D_DISABLE_="
-#define var_home	"HOME="
-#define var_path	"PATH="
-
-int
-init(int force, const char* opt, int opsize)
-{
-	register char**	ep = environ;
-	register char*	cp;
-	register int	i;
-	Fs_t*		fs;
-	char*		home = 0;
-	Handler_t	handler;
-	int		n;
-	int		oerrno;
-
-	/*
-	 * initialize the 3d state
-	 */
-
-	if (!force && state.pid) return(0);
-	oerrno = errno;
-#if DEBUG
-	error_info.id = state.cmd;
-#endif
-#if defined(SIGIO) || defined(SIGPWR)
-#if defined(SIGIO)
-	n = SIGIO;
-#else
-	n = SIGPWR;
-#endif
-	if ((handler = signal(n, note)) != SIG_DFL)
-		signal(n, handler);
-#endif
-	state.pid = getpid();
-	state.uid = geteuid();
-	state.gid = getegid();
-	state.pwd = state.pwdbuf;
-	*state.pwd = '.';
-	state.pwdsize = 1;
-	state.shell = state.envshell + sizeof(var_shell) - 1;
-	callinit();
-	state.fs[FS_safe].flags |= FS_INIT;
-	for (fs = state.fs; fs < state.fs + elementsof(state.fs) && fs->specialsize; fs++)
-	{
-		fs->flags |= FS_ON;
-		if (fs->set) (*fs->set)(fs, state.null, 0, "init", 4);
-	}
-
-	/*
-	 * extract the 3d tables from table.fd or the top of the environment
-	 */
-
-	cp = *(state.env = ep);
-	i = 0;
-	if ((n = peek(TABLE_FD, state.table.buf, sizeof(state.table.buf) - 1)) > 0 && !mapinit(state.table.buf, 1))
-	{
-		state.table.size = n + 1;
-		state.table.fd = TABLE_FD;
-		reserve(&state.table.fd);
-		i |= env_view|env_3d;
-	}
-	else
-	{
-		state.table.version = TABLE_VERSION;
-		if (cp && strneq(cp, state.env3d, sizeof(var_3d) - 1))
-		{
-			mapinit(cp + sizeof(var_3d) - 1, 1);
-			ep++;
-			environ++;
-			i |= env_view|env_3d;
-		}
-	}
-	if (_3d_2d) n = strlen(_3d_2d);
-	else i |= env_2d;
-
-	/*
-	 * look for remaining var_* not in env_* mask i
-	 */
-
-	while (cp = *ep)
-	{
-		if (strneq(cp, var_disable, sizeof(var_disable) - 1))
-		{
-			state.pid = 0;
-			errno = oerrno;
-			return(0);
-		}
-		else if (!(i & env_cmd) && strneq(cp, var_cmd, sizeof(var_cmd) - 1))
-		{
-			state.cmd = cp + sizeof(var_cmd) - 1;
-			if ((i |= env_cmd) == env_must) break;
-		}
-		else if (!(i & env_home) && strneq(cp, var_home, sizeof(var_home) - 1))
-		{
-			home = cp + sizeof(var_home) - 1;
-			if ((i |= env_home) == env_must) break;
-		}
-		else if (!(i & env_path) && strneq(cp, var_path, sizeof(var_path) - 1))
-		{
-			state.envpath = cp + sizeof(var_path) - 1;
-			if ((i |= env_path) == env_must) break;
-		}
-		else if (!(i & env_pwd) && strneq(cp, state.envpwd, sizeof(var_pwd) - 1))
-		{
-			if (geteuid())
-				*ep = state.envpwd;
-			cp += sizeof(var_pwd) - 1;
-			if (!setpwd(cp) && ((i |= env_pwd) == env_must)) break;
-		}
-		else if (!(i & env_shell) && strneq(cp, state.envshell, sizeof(var_shell) - 1))
-		{
-			*ep = state.envshell;
-			cp += sizeof(var_shell) - 1;
-			if (!setshell(cp) && ((i |= env_shell) == env_must)) break;
-		}
-		else if (!(i & env_view) && strneq(cp, state.envview, sizeof(var_view) - 1))
-		{
-			char*	mp;
-			char*	zp;
-
-			cp += sizeof(var_view) - 1;
-			if (mp = strchr(cp, ':')) do
-			{
-				if (!(zp = strchr(++mp, ':'))) zp = mp + strlen(mp);
-				mapset(&state.vpath, cp, mp - cp - 1, mp, zp - mp);
-				cp = mp;
-			} while (*(mp = zp));
-			if ((i |= env_view) == env_must) break;
-		}
-		else if (!(i & env_3d) && strneq(cp, state.env3d, sizeof(var_3d) - 1))
-		{
-			mapinit(cp + sizeof(var_3d) - 1, 1);
-			if ((i |= env_3d) == env_must) break;
-		}
-		else if (!(i & env_2d) && strneq(cp, _3d_2d, n) && cp[n] == '=')
-		{
-			if ((i |= env_2d) == env_must) break;
-		}
-		ep++;
-	}
-	if (!(i & env_2d)) state.in_2d = 1;
-	if (!(i & env_pwd) && *state.pwd != '/' && setpwd("/") && (!home || setpwd(home)))
-	{
-
-		n = state.in_2d;
-		state.in_2d = 2;
-		if (!getcwd(state.path.name, sizeof(state.path.name)) || setpwd(state.path.name))
-		{
-			state.pwd = 0;
-			if (!n)
-			{
-				static char	msg[] = "3d: invalid PWD -- falling back to 2d\n";
-
-				write(2, msg, sizeof(msg) - 1);
-			}
-		}
-		else state.in_2d = n;
-	}
-	if (!(i & env_shell)) strcpy(state.shell, state.binsh);
-	if (state.table.fd <= 0 && mapdump(NiL, NiL, MAP_INIT) < sizeof(state.table.buf))
-	{
-		n = mapdump(NiL, state.table.buf, MAP_INIT);
-		keep(state.table.buf, n, 0);
-	}
-	if (state.table.fd <= 0 && (state.channel.fd = open("/dev/null", O_RDONLY)) >= 0)
-		reserve(&state.channel.fd);
-	if (state.fs[FS_safe].flags & FS_BOUND)
-	{
-		state.safe = &state.fs[FS_safe];
-		if (!state.pwd || !pathreal(state.pwd, P_PATHONLY, NiL))
-		{
-#if DEBUG
-			error(4, ". is not safe");
-#else
-			static char	msg[] = "3d: . is not safe\n";
-
-			write(2, msg, sizeof(msg) - 1);
-			_exit(2);
-#endif
-		}
-	}
-	state.fs[FS_safe].flags &= ~FS_INIT;
-	errno = oerrno;
-	return(0);
-}

+ 0 - 49
src/cmd/3d/kill3d.c

@@ -1,49 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef	kill3d
-
-int
-kill3d(pid_t pid, int sig)
-{
-#if FS
-	Mount_t*	mp;
-
-#endif
-	if (KILL(pid, sig))
-		return(-1);
-#if FS
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_kill))
-			fscall(mp, MSG_kill, 0, pid, sig);
-#endif
-	return(0);
-}
-
-#else
-
-NoN(kill)
-
-#endif

+ 0 - 515
src/cmd/3d/lib.c

@@ -1,515 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * 3d file system library implementation
- *
- * debug trace levels are controlled by /#option/debug
- * debug level n enables tracing for all levels less than or equal to n
- *
- *	level	trace
- *	  0	no trace
- *	  1	basic calls
- *	  2	mounted fs
- *	  3	fs control
- *	  4	pathcanon
- *	  5	pathreal
- *	  6	pathnext
- *	  7	*unused*
- *	  8	*unused*
- *	  9	*unused*
- *	 10	getkey
- */
-
-#include "3d.h"
-
-#include <cs.h>
-
-/*
- * keep 3d tables from buf,siz in state.table.fd
- * if force!=0 then state.table.fd set to TABLE_FD
- * 0 returned if state.table.fd is ok
- */
-
-int
-keep(const char* buf, size_t siz, int force)
-{
-	int	n;
-
-	if (force && state.in_2d || siz > sizeof(state.table.buf))
-	{
-		if (state.table.fd > 0)
-			cancel(&state.table.fd);
-		return(-1);
-	}
-	if (state.table.fd > 0)
-	{
-		char	tmp[sizeof(state.table.buf)];
-
-		if (peek(state.table.fd, tmp, sizeof(tmp) - 1) == siz && !memcmp(tmp, buf, siz))
-			return(0);
-		cancel(&state.table.fd);
-	}
-#if _stream_peek || _socket_peek
-	{
-		int	fds[2];
-
-		state.in_2d++;
-#if _socket_peek
-		n = cspipe(&cs, fds);
-#else
-		n = pipe(fds);
-#endif
-		state.in_2d--;
-		if (!n && fds[1] == TABLE_FD)
-		{
-#if _pipe_rw || _lib_socketpair
-			fds[1] = fds[0];
-			fds[0] = TABLE_FD;
-#else
-			CLOSE(fds[0]);
-			state.in_2d++;
-			n = pipe(fds);
-			state.in_2d--;
-			CLOSE(TABLE_FD);
-#endif
-		}
-		if (!n)
-		{
-			if (fds[0] == TABLE_FD) state.table.fd = fds[0];
-			else
-			{
-				if (force) CLOSE(TABLE_FD);
-				state.table.fd = FCNTL(fds[0], F_DUPFD, TABLE_FD);
-				CLOSE(fds[0]);
-			}
-			n = WRITE(fds[1], buf, siz) == siz;
-			CLOSE(fds[1]);
-			if (n)
-			{
-				state.table.size = siz;
-				reserve(&state.table.fd);
-				return(0);
-			}
-		}
-	}
-#else
-	sfsprintf(state.path.name, sizeof(state.path.name), "/tmp/3D#%d", state.pid);
-	if ((n = OPEN(state.path.name, O_CREAT, S_IRUSR|S_IRGRP|S_IROTH)) >= 0)
-	{
-		UNLINK(state.path.name);
-		if (force) CLOSE(TABLE_FD);
-		if (n == TABLE_FD) state.table.fd = TABLE_FD;
-		else
-		{
-			state.table.fd = FCNTL(n, F_DUPFD, TABLE_FD);
-			CLOSE(n);
-		}
-		if (WRITE(state.table.fd, buf, siz) == siz && !LSEEK(state.table.fd, 0L, 0))
-		{
-			state.table.size = siz;
-			reserve(&state.table.fd);
-			return(0);
-		}
-	}
-#endif
-	if (state.table.fd > 0)
-		cancel(&state.table.fd);
-	return(-1);
-}
-
-/*
- * enable/disable/test 3d/anno state
- * allows state transitions without changing the tables
- */
-
-int
-fs3d(register int op)
-{
-	register int	po;
-	register int	n;
-
-	if ((n = FS3D_op(op)) == FS3D_OP_INIT || !state.pid)
-		init(1, 0, 0);
-	if (!state.in_2d)
-		po = FS3D_ON;
-	else if (state.limit != TABSIZE)
-		po = FS3D_LIMIT(state.limit);
-	else
-		po = FS3D_OFF;
-	switch (n)
-	{
-	case FS3D_OP_INIT:
-	case FS3D_OP_TEST:
-		break;
-	case FS3D_OP_LIMIT:
-		if ((n = FS3D_arg(op)) <= 0 || n > TABSIZE)
-			n = TABSIZE;
-		state.limit = n;
-		state.in_2d = 0;
-		break;
-	case FS3D_OP_OFF:
-		if (state.level > 0)
-			po = -1;
-		else
-		{
-			state.limit = TABSIZE;
-			state.in_2d = 1;
-		}
-		break;
-	case FS3D_OP_ON:
-		state.limit = TABSIZE;
-		state.in_2d = 0;
-		break;
-	default:
-		po = -1;
-		break;
-	}
-	message((-1, "fs3d(%d)=%d", op, po));
-	return po;
-}
-
-/*
- * for code that includes <fs3d.h>
- */
-
-int
-fs3d_mount(const char* source, char* target, int flags, void* data)
-{
-	return mount(source, target, flags, data, 0, 0);
-}
-
-/*
- * return 6 char lower case hash of key
- * end is end of key string
- * 0 returned at end of keys
- * state.key.value is set to key value
- * if `no<key>' then state.key.invert gets value and state.key.value=""
- * otherwise state.key.invert=0
- * state.key.next is set to next key if any
- */
-
-unsigned long
-getkey(register const char* key, register const char* end, int alt)
-{
-	register const char*	val;
-	register unsigned long	x = 0;
-	register int		invert;
-	register int		c;
-#if DEBUG
-	const char*		beg;
-#endif
-
-	if (key)
-	{
-#if DEBUG
-		beg = key;
-#endif
-		if (key < end - 1 && *key == 'n' && *(key + 1) == 'o')
-		{
-			key += 2;
-			invert = 1;
-		}
-		else invert = 0;
-		if (key < end)
-		{
-			val = ((end - key) > HASHKEYMAX) ? key + HASHKEYMAX : end;
-			while (key < end && (c = *key) != '=' && c != '/' && c != alt)
-			{
-				if (key < val)
-					x = (c >= '0' && c <= '9') ? HASHKEYPART(x, HASHKEYN(c)) : HASHKEYPART(x, c);
-				key++;
-			}
-			if (key < end && c == '=')
-				key++;
-		}
-		if (key >= end || *key == '/' || *key == alt)
-		{
-			state.key.value = state.one;
-			state.key.valsize = 1;
-		}
-		else
-		{
-			state.key.value = (char*)key;
-			while (key < end && *key != '/' && *key != alt)
-				key++;
-			state.key.valsize = (char*)key - state.key.value;
-		}
-		while (key < end && (*key == '/' || *key == alt))
-			key++;
-		if (key < end && *key == '#' && *(key - 1) == '/')
-			key++;
-		if (invert)
-		{
-			state.key.invert = state.key.value;
-			state.key.invertsize = state.key.valsize;
-			state.key.value = state.null;
-			state.key.valsize = 0;
-		}
-		else state.key.invert = 0;
-		state.key.next = (key < end) ? (char*)key : (char*)0;
-		message((-10, "getkey: key=%-*s hash=%x value=%-*s next=%-*s", end - beg, beg, x, state.key.valsize, state.key.value, state.key.next ? end - state.key.next : 6, state.key.next));
-	}
-	else state.key.next = 0;
-	return(x);
-}
-
-#if FS
-
-/*
- * return mount pointer for path
- * under is set to the part of the path under the mount
- */
-
-Mount_t*
-getmount(register const char* path, const char** under)
-{
-	register Map_t*	map;
-	int		n;
-	int		oerrno;
-	struct stat	st;
-
-	if (!(map = search(&state.vmount, path, strlen(path), NiL, T_PREFIX)) || ((Mount_t*)map->val)->fs == state.fs)
-		return(0);
-	if (under)
-	{
-		if (*(path += map->keysize)) path++;
-		else
-		{
-			oerrno = errno;
-			n = !STAT(path - map->keysize, &st) && !S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode);
-			errno = oerrno;
-			if (n) return(0);
-			else path = (const char*)state.dot;
-		}
-		*under = path;
-	}
-	return((Mount_t*)map->val);
-}
-
-#endif
-
-int
-nosys(void)
-{
-	errno = EINVAL;
-	return(-1);
-}
-
-/*
- * copy t into s, return a pointer to the end of s ('\0')
- */
-
-char*
-strcopy(register char* s, register const char* t)
-{
-	if (!t) return(s);
-	while (*s++ = *t++);
-	return(--s);
-}
-
-/*
- * return map for <key,keysize> in tab
- * if val!=0 then key=val inserted if not already entered
- * valsize==0 causes string val to be malloc'd on insertion
- * key is malloc'd on insertion if (valsize|T_ALLOCATE) 
- * valsize==T_DELETE for deletion
- * valsize==T_PREFIX for longest path prefix search and val==visit_mask
- */
-
-Map_t*
-search(Table_t* tab, const char* key, int keysize, const char* val, int valsize)
-{
-	register Map_t*		lo;
-	register Map_t*		mid;
-	register Map_t*		hi;
-	register const char*	sp;
-	register const char*	se;
-	register const char*	tp;
-	register const char*	te;
-	int			n;
-	Map_t*			end;
-
-	se = key + keysize;
-	lo = tab->table;
-	end = lo + tab->size;
-	if (valsize == T_PREFIX)
-	{
-		mid = 0;
-		hi = end;
-		while (lo < hi)
-		{
-			sp = key;
-			tp = lo->key;
-			te = tp + lo->keysize;
-message((-12, "T_PREFIX: %-*s: key=%-*s mid=%-*s", keysize, key, lo->keysize, lo->key, mid ? mid->keysize : 1, mid ? mid->key : "-"));
-			for (;;)
-			{
-				if (tp >= te)
-				{
-					if ((sp >= se || *sp == '/') && (!val || !(*((long*)val) & (1 << (lo - tab->table)))))
-					{
-						mid = lo;
-						if (sp >= se)
-							goto prefix;
-					}
-					break;
-				}
-				if (sp >= se || (n = *((unsigned char*)sp++) - *((unsigned char*)tp++)) < 0)
-					goto prefix;
-				if (n > 0)
-				{
-					if (mid && mid->keysize >= (sp - key))
-						goto prefix;
-					break;
-				}
-			}
-			lo++;
-		}
-	prefix:
-		if (mid && val) *((long*)val) |= (1 << (mid - tab->table));
-		return(mid);
-	}
-	if (end > lo)
-	{
-		hi = end - 1;
-		while (lo <= hi)
-		{
-			mid = lo + (hi - lo) / 2;
-			sp = key;
-			tp = mid->key;
-			te = tp + mid->keysize;
-			for (;;)
-			{
-				if (tp >= te)
-				{
-					if (sp >= se)
-					{
-						if (valsize != T_DELETE)
-							return(mid);
-						if (mid->valsize & T_ALLOCATE)
-							free(mid->key);
-#if FS
-						if ((mid->valsize & T_SIZE) == T_MOUNT)
-							((Mount_t*)mid->val)->fs = 0;
-						else
-#endif
-						if (!(mid->valsize & T_SIZE))
-							free(mid->val);
-						for (; mid < end; mid++)
-							*mid = *(mid + 1);
-						tab->size--;
-						return(0);
-					}
-					lo = mid + 1;
-					break;
-				}
-				if (sp >= se || (n = *((unsigned char*)sp++) - *((unsigned char*)tp++)) < 0)
-				{
-					hi = mid - 1;
-					break;
-				}
-				if (n > 0)
-				{
-					lo = mid + 1;
-					break;
-				}
-			}
-		}
-	}
-	if (!val || valsize == T_DELETE || tab->size >= elementsof(tab->table))
-		return(0);
-	tab->size++;
-	for (hi = end; hi > lo; hi--)
-		*hi = *(hi - 1);
-	lo->keysize = keysize;
-	if (valsize & T_ALLOCATE) lo->key = strcpy(newof(0, char, keysize, 1), key);
-	else lo->key = (char*)key;
-	if ((lo->valsize = valsize) & T_SIZE) lo->val = (char*)val;
-	else lo->val = strcpy(newof(0, char, strlen(val), 1), val);
-	return(lo);
-}
-
-/*
- * iterate fun over tab
- * terminates on first negative return from fun
- */
-
-int
-iterate(register Table_t* tab, int (*fun)(Map_t*, char*, int), register char* buf, int flags)
-{
-	register Map_t*	cp;
-	register Map_t*	ep;
-	register int	n;
-	register int	sum;
-
-	sum = 0;
-	for (ep = (cp = tab->table) + tab->size; cp < ep; cp++)
-	{
-		if ((n = (*fun)(cp, buf, flags)) < 0)
-			return(0);
-		if (buf) buf += n;
-		sum += n;
-	}
-	return(sum);
-}
-
-#if FS
-
-/*
- * initialize open file info
- */
-
-int
-fileinit(int fd, struct stat* st, Mount_t* mp, int force)
-{
-	register File_t*	f;
-	int			ffd;
-	int			ffl;
-	struct stat		sb;
-
-	f = state.file + fd;
-	if (!force && (f->flags & FILE_ERROR) || !st && FSTAT(fd, st = &sb) || (ffd = FCNTL(fd, F_GETFD, NiL)) == -1 || (ffl = FCNTL(fd, F_GETFL, NiL)) == -1)
-	{
-		f->flags = FILE_ERROR;
-		return -1;
-	}
-	f->oflag = ffl;
-	f->open = 0;
-	f->flags = FILE_OPEN;
-	if (S_ISREG(st->st_mode))
-		f->flags |= FILE_REGULAR;
-	if (ffd & FD_CLOEXEC)
-		f->flags |= FILE_CLOEXEC;
-	if ((ffl & O_ACCMODE) != O_RDONLY)
-		f->flags |= FILE_WRITE;
-	f->id.fid[0] = st->st_ino;
-	f->id.fid[1] = st->st_dev;
-	if ((f->mount = mp) && fd > state.cache)
-		state.cache = fd;
-	if (fd > state.open)
-		state.open = fd;
-	return 0;
-}
-
-#endif

+ 0 - 90
src/cmd/3d/lib_3d.h

@@ -1,90 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-/*
- * 3d symbol mappings to minimize pollution
- */
-
-#ifndef _NAME3D_H
-#define _NAME3D_H
-
-#include "ast_3d.h"
-#include "cs_3d.h"
-#include "dll_3d.h"
-#include "std_3d.h"
-
-#define bprintf		_3d_printf
-#define bvprintf	_3d_vprintf
-#define calldump	_3d_calldump
-#define callinit	_3d_callinit
-#define checklink	_3d_checklink
-#define control		_3d_control
-#define error		_3d_error
-#define _error_data_	_3d_error_data /*AHA*/
-#define _error_info_	_3d_error_info
-#define _error_infop_	_3d_error_infop
-#define errorf		_3d_errorf
-#define errormsg	_3d_errormsg
-#define errorv		_3d_errorv
-#define fileinit	_3d_fileinit
-#define fix		_3d_fix
-#define forked		_3d_forked
-#define fs3d_copy	_3d_copy
-#define fs3d_dup	_3d_dup
-#define fs3d_mkdir	_3d_mkdir
-#define fs3d_open	_3d_open
-#define fscall		_3d_fscall
-#define fschannel	_3d_fschannel
-#define fsdrop		_3d_fsdrop
-#define fsinit		_3d_fsinit
-#define fsreal		_3d_fsreal
-#define getattr		_3d_getattr
-#define getkey		_3d_getkey
-#define getmount	_3d_getmount
-#define init		_3d_init
-#define instance	_3d_instance
-#define intercept	_3d_intercept
-#define iterate		_3d_iterate
-#define keep		_3d_keep
-#define mapdump		_3d_mapdump
-#define mapget		_3d_mapget
-#define mapinit		_3d_mapinit
-#define mapset		_3d_mapset
-#define nosys		_3d_nosys
-#define pathreal	_3d_pathreal
-#define peek		_3d_peek
-#define search		_3d_search
-#define setattr		_3d_setattr
-#define state		_3d_state
-#define strcopy		_3d_strcopy
-#define stub		_3d_stub
-#define syscall3d	_3d_syscall
-#define sysfunc		_3d_sysfunc
-
-#include <ast.h>
-
-#undef	pathcanon
-#define pathcanon	_3d_pathcanon
-#undef	pathcat
-#define pathcat		_3d_pathcat
-
-#endif

+ 0 - 95
src/cmd/3d/license.c

@@ -1,95 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * 3d license via agent to license server
- */
-
-#include "3d.h"
-
-#if LICENSED
-
-#define LICENSE_OPEN(s,m,l)	licopen(s,m,l)
-#define LICENSE_CLOSE(f)	close(f)
-
-static int
-licopen(const char* svc, const char* msg, int len)
-{
-	char*	service;
-	char*	env;
-	int	n;
-	int	fd;
-	int	lic;
-	char	buf[64];
-
-	if (state.in_2d) return(-1);
-	service = "/dev/fdp/local/nam/user";
-	env = *environ;
-	*environ = "_3D_DISABLE=1";
-	if ((fd = cslocal(&cs, service)) < 0)
-	{
-		error(ERROR_SYSTEM|2, "%s: cannot connect to server", service);
-		return(-1);
-	}
-	*environ = env;
-	n = strlen(svc) + 1;
-	if (cswrite(&cs, fd, svc, n) != n)
-	{
-		error(ERROR_SYSTEM|2, "%s: cannot write to server", service);
-		close(fd);
-		return(-1);
-	}
-	if (read(fd, buf, sizeof(buf)) <= 0)
-	{
-		error(ERROR_SYSTEM|2, "%s: cannot read from server", service);
-		close(fd);
-		return(-1);
-	}
-	if (csrecv(&cs, fd, NiL, &lic, 1) != 1)
-	{
-		error(ERROR_SYSTEM|2, "%s: cannot connect to %s", service, svc);
-		close(fd);
-		return(-1);
-	}
-	close(fd);
-	if (cswrite(&cs, lic, msg, len) != len)
-	{
-		error(ERROR_SYSTEM|2, "%s: cannot write to service", svc);
-		close(lic);
-		return(-1);
-	}
-	fcntl(lic, F_SETFD, FD_CLOEXEC);
-	state.in_2d = 0;
-	return(lic);
-}
-
-#define tokscan		_3d_tokscan
-
-#include "tokscan.c"
-#include "../license/service.c"
-
-#else
-
-NoN(license)
-
-#endif

+ 0 - 99
src/cmd/3d/link3d.c

@@ -1,99 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef link3d
-
-int
-link3d(const char* path, const char* target)
-{
-	register char*	sp;
-	register char*	tp;
-	register int	r;
-	char*		t;
-	int		oerrno;
-	char		buf[PATH_MAX+1];
-#if FS
-	char		tmp[PATH_MAX+1];
-	Mount_t*	mp;
-#endif
-
-	if (state.in_2d)
-		return(LINK(path, target));
-#if FS
-	if (!fscall(NiL, MSG_link, 0, path, target))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, state.safe ? (P_SAFE|P_TOP) : P_TOP, NiL)))
-		return(-1);
-	sp = strncpy(buf, sp, PATH_MAX);
-	if (!(tp = pathreal(target, P_PATHONLY|P_NOOPAQUE|P_SAFE, NiL)))
-		return(-1);
-	oerrno = errno;
-	if ((r = LINK(sp, tp)) && errno == ENOENT && (t = strrchr(tp, '/')))
-	{
-		*t = 0;
-		r = fs3d_mkdir(tp, S_IRWXU|S_IRWXG|S_IRWXO);
-		*t = '/';
-		if (!r)
-		{
-			errno = oerrno;
-			r = LINK(sp, tp);
-		}
-	}
-#if FS
-	if (!r)
-	{
-		if (mp && !LSTAT(tp, &state.path.st))
-		{
-			if (tp != tmp)
-			{
-				if (!(tp = pathreal(target, P_PATHONLY|P_NOOPAQUE|P_ABSOLUTE, NiL)))
-					return(r);
-				tp = strncpy(tmp, tp, PATH_MAX);
-			}
-			fscall(mp, MSG_link, 0, sp, tp);
-		}
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_link))
-			{
-				if (tp != tmp)
-				{
-					if (!(tp = pathreal(target, P_PATHONLY|P_NOOPAQUE|P_ABSOLUTE, NiL)))
-						return(r);
-					tp = strncpy(tmp, tp, PATH_MAX);
-				}
-				fscall(mp, MSG_link, 0, sp, tp);
-			}
-	}
-#endif
-	return(r);
-}
-
-#else
-
-NoN(link)
-
-#endif

+ 0 - 134
src/cmd/3d/lseek3d.c

@@ -1,134 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide lseek
-#else
-#define lseek        ______lseek
-#endif
-#define _def_syscall_3d	1
-#define _LS_H		1
-
-#include "3d.h"
-
-#undef	_def_syscall_3d
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide lseek
-#else
-#undef  lseek
-#endif
-
-#include "FEATURE/syscall"
-
-#ifdef	lseek3d
-
-#if !_nosys_lseek64 && _typ_off64_t
-
-typedef off64_t (*Seek64_f)(int, off64_t, int);
-
-#undef	off_t
-#undef	lseek
-
-off64_t
-lseek64(int fd, off64_t off, int op)
-{
-	off64_t		r;
-	int		n;
-	int		m;
-
-	static Seek64_f	seekf;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_seek, 0, fd, off, op))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!seekf)
-		seekf = (Seek64_f)sysfunc(SYS3D_lseek64);
-	for (m = state.trap.size - 1; m >= 0; m--)
-		if (MSG_MASK(MSG_seek) & state.trap.intercept[m].mask)
-			break;
-	if (m >= 0)
-	{
-		n = state.trap.size;
-		state.trap.size = m;
-		r = (*state.trap.intercept[m].call)(&state.trap.intercept[m], MSG_seek, SYS3D_lseek64, (void*)fd, (void*)&off, (void*)op, NiL, NiL, NiL) ? -1 : off;
-		state.trap.size = n;
-	}
-	else
-		r = (*seekf)(fd, off, op);
-#if FS
-	if (r != (off64_t)(-1))
-	{
-		if (mp)
-			fscall(mp, MSG_seek, r, fd, off, op);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_seek))
-				fscall(mp, MSG_seek, r, fd, off, op);
-	}
-#endif
-	return r;
-}
-
-#endif
-
-typedef off_t (*Seek_f)(int, off_t, int);
-
-off_t
-lseek3d(int fd, off_t off, int op)
-{
-	off_t		r;
-
-	static Seek_f	seekf;
-
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_seek, 0, fd, off, op))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (sizeof(off_t) > sizeof(long))
-	{
-		if (!seekf)
-			seekf = (Seek_f)sysfunc(SYS3D_lseek);
-		r = (*seekf)(fd, off, op);
-	}
-	else if ((r = LSEEK(fd, off, op)) == -1)
-		return -1;
-#if FS
-	if (mp)
-		fscall(mp, MSG_seek, r, fd, off, op);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_seek))
-			fscall(mp, MSG_seek, r, fd, off, op);
-#endif
-	return r;
-}
-
-#else
-
-NoN(lseek)
-
-#endif

+ 0 - 128
src/cmd/3d/lstat3d.c

@@ -1,128 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma noprototyped
-
-#include "3d.h"
-
-#if defined(lstat3d)
-
-/* the 3 arg _lxstat() disrupts our proto game -- every party needs one */
-#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
-int lstat3d(const char* path, struct stat* st)
-#else
-#if defined(_LSTAT)
-int _lstat(path, st) char* path; struct stat* st; { return lstat(path, st); }
-#endif
-int lstat(path, st) char* path; struct stat* st;
-#endif
-{
-	register char*	sp;
-#if FS
-	Mount_t*	mp;
-#endif
-#ifdef _3D_STAT_VER
-	struct stat*	so;
-	struct stat	sc;
-#endif
-
-#ifdef _3D_STAT_VER
-	if (_3d_ver != _3D_STAT_VER)
-	{
-		so = st;
-		st = &sc;
-	}
-#endif
-#if FS
-	if (!fscall(NiL, MSG_lstat, 0, path, st))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_LSTAT, st)))
-		return -1;
-#if FS
-	if (mp)
-		fscall(mp, MSG_lstat, 0, state.path.name, st);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_lstat))
-			fscall(mp, MSG_lstat, 0, state.path.name, st);
-#endif
-#ifdef _3D_STAT_VER
-	if (st == &sc)
-	{
-		st = so;
-		if (LXSTAT(_3d_ver, sp, st))
-			return -1;
-#ifdef _3D_STAT64_VER
-		if (_3d_ver == _3D_STAT64_VER)
-			IVIEW(((struct stat64*)st), state.path.level);
-		else
-#endif
-		IVIEW(st, state.path.level);
-	}
-#endif
-#if _mem_d_type_dirent
-	if (S_ISDIR(st->st_mode))
-		st->st_nlink = _3D_LINK_MAX;
-#endif
-	return 0;
-}
-
-#if defined(_LARGEFILE64_SOURCE) && defined(STAT643D) && !defined(_3D_STAT64_VER)
-
-int
-lstat643d(const char* path, struct stat64* st)
-{
-	register char*	sp;
-	struct stat	ss;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_lstat, 0, path, &ss))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_LSTAT, &ss)))
-		return -1;
-	if (LSTAT64(sp, st))
-		return -1;
-	IVIEW(st, state.path.level);
-#if FS
-	if (mp)
-		fscall(mp, MSG_lstat, 0, state.path.name, &ss);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_lstat))
-			fscall(mp, MSG_lstat, 0, state.path.name, &ss);
-#endif
-#if _mem_d_type_dirent
-	if (S_ISDIR(st->st_mode))
-		st->st_nlink = _3D_LINK_MAX;
-#endif
-	return 0;
-}
-
-#endif
-
-#else
-
-NoN(lstat)
-
-#endif

+ 0 - 670
src/cmd/3d/map.c

@@ -1,670 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * 3d mount map support
- */
-
-#include "3d.h"
-
-/*
- * visit a mapping and compute its size or copy mapping
- */
-
-int
-mapget(Map_t* map, char* buf, int flags)
-{
-	register char*	p;
-	register int	z;
-	register char*	v;
-	register int	n;
-#if FS
-	Mount_t*	mp = 0;
-#endif
-
-	NoP(flags);
-	if (!(n = map->keysize))
-		n = strlen(map->key);
-	switch (z = map->valsize & T_SIZE)
-	{
-#if FS
-	case T_MOUNT:
-		mp = (Mount_t*)map->val;
-		if (state.visit.fs && state.visit.fs != mp->fs)
-			return 0;
-		v = mp->fs->special;
-		z = mp->fs->specialsize;
-		break;
-#endif
-	case 0:
-		z = strlen(map->val);
-		/*FALLTHROUGH*/
-	default:
-		v = map->val;
-		break;
-	}
-	if (p = buf)
-	{
-		strncpy(p, map->key, n);
-		p += n;
-		*p++ = ' ';
-		if (
-#if FS
-			mp ||
-#endif
-			state.visit.prefix)
-		{
-			*p++ = '/';
-			*p++ = '#';
-#if FS
-			if (!mp)
-#endif
-			{
-				p = strcopy(p, state.visit.prefix);
-				*p++ = '/';
-				if (*v == '/')
-					*p++ = '#';
-			}
-		}
-		strncpy(p, v, z);
-		p += z;
-#if FS
-		if (mp)
-		{
-			if (mp->channel)
-				p += sfsprintf(p, 0, "/channel=%d", MSG_CHANNEL_SYS(mp->channel));
-			p += getattr(mp->attr, p);
-			if (mp->physical)
-				p += sfsprintf(p, 0, "%-*s", mp->physicalsize ? mp->physicalsize : strlen(mp->physical), mp->physical);
-		}
-#endif
-		*p++ = ' ';
-		n = p - buf;
-	}
-	else
-		n += z + state.visit.prelen
-#if FS
-		+ (mp ? ((mp->channel ? 16 : 0) + (mp->physical ? (mp->physicalsize ? mp->physicalsize : strlen(mp->physical)) : 0) + getattr(mp->attr, NiL)) : 0)
-#endif
-		+ 6;
-	return n;
-}
-
-/*
- * dump table mappings into buf
- * the mapping size is returned
- * if tab==0 then all 3d mappings are processed
- * if buf==0 then the size is just computed
- */
-
-int
-mapdump(Table_t* tab, char* buf, int flags)
-{
-	register Fs_t*		fs;
-	register int		n;
-	register int		sum = 0;
-	register char*		p = buf;
-
-	if (flags & (MAP_EXEC|MAP_INIT))
-	{
-		if (state.kernel)
-		{
-			if (p)
-				*p = 0;
-			return 1;
-		}
-		if (p)
-		{
-			n = sfsprintf(p, 0, "%s", TABLE_PREFIX);
-			p += n;
-		}
-		else
-			n = sizeof(TABLE_PREFIX) - 1;
-		sum += n;
-	}
-	if (!tab)
-	{
-		for (fs = state.fs; fs < state.fs + elementsof(state.fs); fs++)
-			if (fs->get)
-			{
-				n = (*fs->get)(fs, p, NiL, flags);
-				if (p)
-					p += n;
-				sum += n;
-			}
-	}
-	else
-	{
-		n = iterate(tab, mapget, p, flags);
-		if (p)
-			p += n;
-		sum += n;
-	}
-	if (p)
-	{
-		if (p > buf)
-		{
-			if (!(flags & MAP_INIT))
-				p--;
-			else if ((p - buf) == (sizeof(TABLE_PREFIX) - 1))
-				p = buf;
-			else
-				*(p - 1) = '\n';
-		}
-		*p = 0;
-		sum = p - buf;
-	}
-	return sum;
-}
-
-#if LICENSED
-
-/*
- * check fs license
- */
-
-static int
-licensed(register Fs_t* fs)
-{
-	if ((fs->flags & (FS_INTERNAL|FS_LICENSED)) == FS_INTERNAL)
-	{
-		if (!(fs->flags & FS_VALIDATED))
-		{
-			fs->flags |= FS_VALIDATED;
-			if (!*state.license)
-			{
-				Pathcheck_t	pc;
-
-				if (pathcheck(PATHCHECK, error_info.id, &pc))
-					*state.license = LICENSE_NONE;
-				else if (!pc.feature)
-					*state.license = LICENSE_ALL;
-				else
-					sfsprintf(state.license, sizeof(state.license), "%c%s%c", LICENSE_SEP, pc.feature, LICENSE_SEP);
-				message((-2, "license: feature=%s", state.license));
-			}
-			if (*state.license == LICENSE_ALL)
-				fs->flags |= FS_LICENSED;
-			else
-			{
-				char	buf[sizeof(fs->special) + 4];
-
-				sfsprintf(buf, sizeof(buf), "*%c%s%c*", LICENSE_SEP, fs->special, LICENSE_SEP);
-				message((-1, "mount: license=%s pattern=%s", state.license, buf));
-				if (strmatch(state.license, buf))
-					fs->flags |= FS_LICENSED;
-			}
-			if (!(fs->flags & FS_LICENSED))
-				error(2, "%s service not licensed", fs->special);
-		}
-		if (!(fs->flags & FS_LICENSED))
-			return 0;
-	}
-	return 1;
-}
-
-#else
-
-#define licensed(p)	(1)
-
-#endif
-
-#if FS
-
-/*
- * copy attributes into table buf
- */
-
-int
-getattr(const char* attr, char* buf)
-{
-	register char*	a = (char*)attr;
-	register char*	b = buf;
-	register int	c;
-
-	if (b)
-	{
-		while (c = *b++ = *a++)
-			if (c == ' ')
-				*(b - 1) = '/';
-		return b - buf - 1;
-	}
-	return strlen(a);
-}
-
-/*
- * add/delete attributes
- * attributes stored as
- *
- *	(<space>name=value)*
- */
-
-const char*
-setattr(char* attr, const char* op, register const char* oe)
-{
-	register const char*	s;
-	register const char*	v;
-	register char*		a;
-	register char*		x;
-	register int		n;
-	int			k;
-	int			m;
-
-	if (s = op)
-	{
-		for (;;)
-		{
-			if (s >= oe || *s == '/')
-				return op;
-			if (*s++ == '=')
-			{
-				v = s - 1;
-				n = v - op;
-				while (s < oe && *s != '/')
-					s++;
-				k = s - v - 1;
-				m = s - op;
-				a = attr;
-				while (*a)
-				{
-					a++;
-					if (strneq(op, a, n) && a[n] == '=')
-					{
-						if (!k || strncmp(op, a, m) || a[m] && a[m] != ' ')
-						{
-							if (!(x = strchr(a, ' ')))
-							{
-								if (a > attr)
-									a--;
-								*a = 0;
-							}
-							else
-								while (*a++ = *++x);
-						}
-						else
-							k = 0;
-						break;
-					}
-					if (!(a = strchr(a, ' ')))
-						break;
-				}
-				if (k && ((k = strlen(attr)) + m) < (ATTR_MAX - 1))
-				{
-					a = attr + k;
-					*a++ = ' ';
-					strncpy(a, op, m);
-					a[m] = 0;
-				}
-				if (s++ >= oe)
-					return 0;
-				op = s;
-			}
-		}
-	}
-	return op;
-}
-
-#endif
-
-/*
- * handle `arg /#<op>'
- */
-
-static int
-special(register const char* op, int opsize, const char* arg, int argsize)
-{
-	register const char*	oe;
-	register Fs_t*		fs;
-	const char*		ov;
-	const char*		org;
-	Map_t*			map;
-	int			arglen;
-	unsigned long		x;
-#if FS
-	register Mount_t*	mp;
-#endif
-
-	if (!(arglen = argsize))
-		arglen = strlen(arg);
-	oe = op + (opsize ? opsize : strlen(op));
-	if (!(x = getkey(op, oe, 0)))
-	{
-		if (arglen)
-		{
-			errno = ENODEV;
-			return -1;
-		}
-		for (fs = state.fs; fs < state.fs + elementsof(state.fs); fs++)
-			if (fs->set)
-				(*fs->set)(fs, state.null, 0, state.null, 0);
-		return 0;
-	}
-	if (state.key.invert)
-	{
-		errno = ENODEV;
-		return -1;
-	}
-	org = arg;
-	if (!argsize && *arg)
-	{
-		if (!pathreal(arg, P_PATHONLY|P_ABSOLUTE|P_NOSLASH, NiL))
-			return -1;
-		arg = (const char*)state.path.name;
-	}
-	ov = (char*)state.key.next;
-	for (fs = state.fs; fs < state.fs + elementsof(state.fs); fs++)
-		if (!x || x == fs->key)
-	{
-		if (!licensed(fs))
-			return 0;
-#if FS
-		if (fs->flags & FS_FS)
-		{
-			if (map = search(&state.vmount, arg, arglen, NiL, op < oe ? 0 : T_DELETE))
-			{
-				mp = (Mount_t*)map->val;
-				if (mp->fs != fs)
-				{
-					errno = EEXIST;
-					return -1;
-				}
-				message((-2, "mount: old fs=%s map=%-*s arg=%-*s op=%-*s", fs->special, map->keysize, map->key, arglen, arg, ov ? (oe - ov) : 6, ov));
-				if (setattr(mp->attr, ov, oe))
-				{
-					errno = EEXIST;
-					return -1;
-				}
-			}
-			else if (op < oe)
-			{
-				if (arglen)
-				{
-					for (mp = state.mount;; mp++)
-					{
-						if (mp >= state.mount + elementsof(state.mount))
-							return -1;
-						if (!mp->fs)
-							break;
-					}
-					if (map = search(&state.vmount, arg, arglen, (char*)mp, argsize ? T_MOUNT : (T_MOUNT|T_ALLOCATE)))
-					{
-						message((-2, "mount: new fs=%s map=%-*s arg=%-*s op=%-*s", fs->special, map->keysize, map->key, arglen, arg, ov ? (oe - ov) : 6, ov));
-						fs->flags |= FS_REFERENCED;
-						if (!(fs->flags & FS_NAME) && !state.cache)
-							state.cache = 1;
-						mp->fs = fs;
-						mp->logical = map->key;
-						mp->logicalsize = map->keysize;
-						if (ov)
-						{
-							if ((oe - ov) > 8 && strneq(ov, "channel=", 8))
-							{
-								mp->channel = strtol(ov + 8, (char**)&ov, 0);
-								if (++ov >= oe)
-									ov = 0;
-							}
-							if (ov = setattr(mp->attr, ov, oe))
-							{
-								if (opsize)
-								{
-									mp->physical = (char*)ov - 1;
-									mp->physicalsize = oe - mp->physical;
-								}
-								else
-								{
-									mp->physical = strcpy(newof(0, char, strlen(ov), 2), ov - 1);
-									mp->physicalsize = 0;
-								}
-							}
-						}
-					}
-				}
-				else if (setattr(fs->attr, ov, oe))
-				{
-					errno = EEXIST;
-					return -1;
-				}
-			}
-		}
-		else
-#endif
-		if (fs->set)
-		{
-			if (ov)
-			{
-				if ((*fs->set)(fs, (fs->flags & FS_RAW) ? org : arg, argsize, ov, oe - ov))
-					return -1;
-			}
-			else if (arglen)
-			{
-				if ((*fs->set)(fs, (fs->flags & FS_RAW) ? org : arg, argsize, state.null, 0))
-					return -1;
-			}
-			else if ((*fs->set)(fs, state.null, 0, state.null, 0))
-				return -1;
-		}
-		if (op < oe)
-			break;
-	}
-	if (op < oe && fs >= state.fs + elementsof(state.fs))
-	{
-		errno = ENODEV;
-		return -1;
-	}
-	return 0;
-}
-
-/*
- * set a single 3d table mapping
- * size==0 for volatile args
- * from="-" maps to from=""
- * to="-" maps to to=""
- */
-
-int
-mapset(Table_t* tab, const char* from, int fromsize, register const char* to, int tosize)
-{
-	register Map_t*	old;
-	register int	n;
-	int		x;
-	char		buf[PATH_MAX + 1];
-
-	if (state.safe && !(state.test & 0100))
-	{
-		errno = EPERM;
-		return -1;
-	}
-	if (!fromsize && (!from || !from[0] || from[0] == '-' && !from[1]) || fromsize == 1 && from[0] == '-')
-	{
-		from = state.null;
-		fromsize = 0;
-	}
-	if (!tosize && (!to || !to[0] || to[0] == '-' && !to[1]) || tosize == 1 && to[0] == '-')
-	{
-		to = state.null;
-		tosize = 0;
-	}
-	message((-2, "mount: %-*s %-*s", from == state.null ? 1 : fromsize ? fromsize : strlen(from), from == state.null ? "-" : from, to == state.null ? 1 : tosize ? tosize : strlen(to), to == state.null ? "-" : to));
-	if ((!tosize || tosize >= 2) && to[0] == '/' && to[1] == '#')
-	{
-		to += 2;
-		if (tosize)
-			tosize -= 2;
-		return special(to, tosize, from, fromsize);
-	}
-	if (!*from)
-	{
-		if (!*to)
-			while (tab->table->key)
-				search(tab, tab->table->key, tab->table->keysize, NiL, T_DELETE);
-		return 0;
-	}
-	if (fromsize)
-	{
-		if (tosize || !to[0])
-		{
-			/*
-			 * no malloc during initialization
-			 * so we have to believe from and to here
-			 */
-
-			return search(tab, from, fromsize, to, tosize) ? 0 : -1;
-		}
-		n = *(from + fromsize);
-		*((char*)from + fromsize) = 0;
-	}
-	if (!licensed(&state.fs[tab == &state.vpath ? FS_view : tab == &state.vmap ? FS_map : FS_safe]))
-		return 0;
-	if (x = tab != &state.vintercept)
-	{
-		if (!pathreal(from, P_PATHONLY|P_ABSOLUTE|P_NOSLASH, NiL))
-			return -1;
-		if (fromsize)
-		{
-			*((char*)from + fromsize) = n;
-			fromsize = 0;
-		}
-		from = (const char*)state.path.name;
-	}
-	if (!fromsize)
-		fromsize = strlen(from);
-	old = search(tab, from, fromsize, NiL, *to ? 0 : T_DELETE);
-	if (!*to)
-	{
-		search(&state.vmount, from, fromsize, NiL, T_DELETE);
-		return 0;
-	}
-	if (tab == &state.vmap)
-	{
-		if (old)
-		{
-			if (!(old->valsize & T_SIZE))
-				free(old->val);
-			if ((old->valsize = tosize) & T_SIZE)
-				old->val = (char*)to;
-			else
-				old->val = strcpy(newof(0, char, strlen(to), 1), to);
-		}
-		else
-			search(tab, from, fromsize, to, tosize|T_ALLOCATE);
-	}
-	else if (old)
-	{
-		/*
-		 * ok if previous mapping matched
-		 */
-
-		if (x && !(to = pathreal(to, P_PATHONLY|P_ABSOLUTE|P_NOSLASH, NiL)))
-			return -1;
-		if ((n = T_VALSIZE(old)) == (tosize ? tosize : strlen(to)) && strneq(old->val, to, n))
-			return 0;
-
-		/*
-		 * already have different mapping
-		 */
-
-		errno = EEXIST;
-		return -1;
-	}
-	else
-	{
-		strncpy(buf, from, PATH_MAX);
-		buf[PATH_MAX] = 0;
-		if (x)
-		{
-			if (!pathreal(to, P_PATHONLY|P_ABSOLUTE|P_NOSLASH, NiL))
-				return -1;
-			to = (const char*)state.path.name;
-		}
-		if (tab == &state.vsafe || !streq(buf, to))
-			search(tab, buf, fromsize, to, T_ALLOCATE);
-	}
-	return 0;
-}
-
-/*
- * initialize mappings from space separated pairs in buf
- * if readonly!=0 then buf must not be changed after this call
- */
-
-int
-mapinit(const char* buf, int readonly)
-{
-	register char*	bp = (char*)buf;
-	register char*	from;
-	register char*	to;
-	int		fromsize;
-	int		tosize;
-
-#if DEBUG_TABLE
-	if (!error_info.trace)
-		error_info.trace = -3;
-	message((-1, "TABLE `%s'", bp));
-#endif
-	if (strneq(bp, TABLE_PREFIX, sizeof(TABLE_PREFIX) - 1))
-		bp += sizeof(TABLE_PREFIX) - 1;
-#if DEBUG_TABLE
-	if (bp != buf)
-		message((-1, "TABLE `%s'", bp));
-#endif
-	if (!readonly)
-		fromsize = tosize = 0;
-	while (*bp)
-	{
-		for (from = bp; *bp && *bp != ' '; bp++);
-		if (readonly)
-		{
-			fromsize = bp - from;
-			if (*bp)
-				bp++;
-		}
-		else if (*bp)
-			*bp++ = 0;
-		for (to = bp; *bp && *bp != ' ' && *bp != '\n'; bp++);
-		if (readonly)
-			tosize = bp - to;
-		else if (*bp)
-			*bp++ = 0;
-#if DEBUG_TABLE
-		if (mapset(&state.vpath, from, fromsize, to, tosize))
-		{
-			if (readonly)
-				message((-1, "TABLE %-*s -> %-*s FAILED", fromsize, from, tosize, to));
-			else
-				message((-1, "TABLE %s -> %s FAILED", from, to));
-			return -1;
-		}
-		if (state.table.version != TABLE_VERSION)
-		{
-			message((-1, "TABLE state.table.version=%d != TABLE_VERSION=%d", state.table.version, TABLE_VERSION));
-			return -1;
-		}
-#else
-		if (mapset(&state.vpath, from, fromsize, to, tosize) || state.table.version != TABLE_VERSION)
-			return -1;
-#endif
-		if (*bp)
-			bp++;
-	}
-	return 0;
-}

+ 0 - 179
src/cmd/3d/mkdir3d.c

@@ -1,179 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide mkdir
-#else
-#define mkdir        ______mkdir
-#endif
-#define _def_syscall_3d	1
-#define _LS_H		1
-
-#include "3d.h"
-
-#undef	_def_syscall_3d
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide mkdir
-#else
-#undef  mkdir
-#endif
-
-#include "FEATURE/syscall"
-
-/*
- * mkdir() will always create a directory on the highest layer
- * mkdir() will create intermediate directories if they virtually exist
- * mkdir() will do a chdir() if a virtual dot directory is created
- */
-
-int
-mkdir3d(const char* path, mode_t mode)
-{
-	register char*	sp;
-	register char*	cp;
-	register int	r;
-	char		buf[PATH_MAX + 1];
-	char		tmp[PATH_MAX + 1];
-#if FS
-	Mount_t*	mp;
-#endif
-
-	if (state.real)
-	{
-#if FS
-		mp = 0;
-#endif
-		sp = (char*)path;
-	}
-#if FS
-	else if (!fscall(NiL, MSG_mkdir, 0, path, mode))
-		return(state.ret);
-#endif
-	else
-	{
-#if FS
-		mp = monitored();
-#endif
-		if (!(sp = pathreal(path, P_PATHONLY|P_NOOPAQUE, NiL)))
-			return(-1);
-	}
-	if (state.path.level || state.level && (sp == state.pwd || streq(sp, state.pwd)) || (r = MKDIR(sp, mode)) && errno == ENOENT)
-	{
-		/*
-		 * copy canonicalized pathname into buf
-		 */
-
-		if (*sp != '/')
-			sp = state.path.name;
-		for (cp = buf; *cp = *sp++; cp++);
-		if (!state.real)
-		{
-			/*
-			 * create intermediate dirs if they exist in lower view
-			 */
-
-			char*	a;
-			char*	b;
-			Path_t	save;
-			int	oerrno;
-
-			a = tmp;
-			b = buf;
-			while (*a++ = *b++);
-			if (b = strrchr(tmp, '/'))
-				*b = 0;
-			oerrno = errno;
-			save = state.path;
-			for (;;)
-				if (!pathnext(tmp, NiL, NiL) || ACCESS(tmp, F_OK))
-				{
-					state.path = save;
-					errno = oerrno;
-					return -1;
-				}
-			state.path = save;
-			errno = oerrno;
-		}
-
-		/*
-		 * ok to create intermediate dirs
-		 */
-
-		do
-		{
-			while (*--cp != '/');
-			if (cp <= buf) return(-1);
-			*cp = 0;
-			r = !pathreal(buf, 0, NiL) || !streq(buf, state.path.name);
-			*cp = '/';
-		} while (r);
-		*cp = '/';
-		do
-		{
-			r = *++cp;
-			if (r == 0 || r == '/')
-			{
-				*cp = 0;
-				sp = pathreal(buf, P_PATHONLY, NiL);
-				*cp = r;
-				if (!sp) return(-1);
-				if (sp == state.dot) sp = state.pwd;
-				if (r = MKDIR(sp, r ? (mode|S_IWUSR|S_IXUSR) : mode)) return(r);
-#if FS
-				if (fsmonitored(state.path.name) && !LSTAT(state.path.name, &state.path.st))
-					fscall(state.path.monitor, MSG_mkdir, 0, state.path.name, state.path.st.st_mode);
-#endif
-				if (sp == state.pwd || streq(sp, state.pwd))
-				{
-					state.level = 0;
-					CHDIR(state.pwd);
-				}
-			}
-		} while (*cp);
-	}
-#if FS
-	if (!r)
-	{
-		if (mp) fscall(mp, MSG_mkdir, 0, path, mode);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_mkdir))
-				fscall(mp, MSG_mkdir, 0, path, mode);
-	}
-#endif
-	return(r);
-}
-
-/*
- * 3d internal mkdir to skip pathreal(path, ...)
- */
-
-int
-fs3d_mkdir(const char* path, mode_t mode)
-{
-	int	r;
-
-	state.real++;
-	r = mkdir(path, mode);
-	state.real--;
-	return(r);
-}

+ 0 - 72
src/cmd/3d/mknod3d.c

@@ -1,72 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide mknod
-#else
-#define mknod        ______mknod
-#endif
-#define _def_syscall_3d	1
-#define _LS_H		1
-
-#include "3d.h"
-
-#undef	_def_syscall_3d
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide mknod
-#else
-#undef  mknod
-#endif
-
-#include "FEATURE/syscall"
-
-#ifdef mknod3d
-
-int
-mknod3d(const char* path, mode_t mode, dev_t dev)
-{
- 	register char*	sp;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_mknod, 0, path, mode, dev))
-		return(state.ret);
-	mp = monitored();
-#endif
- 	if (!(sp = pathreal(path, P_PATHONLY, NiL)) || MKNOD(sp, mode, dev))
-		return(-1);
-#if FS
- 	if (mp && !STAT(sp, &state.path.st))
- 		fscall(mp, MSG_mknod, 0, path, state.path.st.st_mode, dev);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_mknod))
-			fscall(mp, MSG_mknod, 0, path, mode, dev);
-#endif
-	return(0);
-}
-
-#else
-
-NoN(mknod)
-
-#endif

+ 0 - 147
src/cmd/3d/mount3d.c

@@ -1,147 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-int
-mount3d(const char* aspc, char* path, int mode, void* a4, void* a5, void* a6)
-{
-	char*			spc = (char*)aspc;
-	register Fs_t*		fs;
-	register char*		sp;
-	register int		r;
-	Table_t*		tab;
-	int			size = 0;
-	int			oerrno;
-	unsigned long		x;
-
-	if ((!spc || !*spc) && (!path || !*path) && !mode) return(0);
-	if (mode & FS3D_ALL)
-	{
-		initialize();
-		switch (mode & FS3D_ALL)
-		{
-		case FS3D_VERSION:
-			tab = &state.vmap;
-			break;
-		case FS3D_VIEW:
-			tab = &state.vpath;
-			break;
-		default:
-			tab = 0;
-			break;
-		}
-		if (mode & FS3D_GET)
-		{
-			size = FS3D_SIZEOF(mode);
-			if ((sp = spc) && (!*sp || *sp == '-' && !*(sp + 1) || *sp == '/' && *(sp + 1) == '#'))
-			{
-				r = -1;
-				oerrno = errno;
-				errno = 0;
-				if (*sp && *sp++ == '/') sp++;
-				if (!*sp)
-				{
-					if ((r = mapdump(NiL, NiL, 0)) >= 0 && r < size)
-					{
-						mapdump(NiL, path, 0);
-						r = 0;
-					}
-				}
-				else
-				{
-					x = getkey(sp, sp + strlen(sp), 0);
-					for (fs = state.fs; fs < state.fs + elementsof(state.fs); fs++)
-						if (x == fs->key)
-						{
-							if (fs->get && (r = (*fs->get)(fs, NiL, sp = state.key.next, 0)) >= 0 && r < size)
-							{
-								if ((r = (*fs->get)(fs, path, sp, 0)) > 0 && path[r - 1] == ' ') r--;
-								path[r] = 0;
-								r = 0;
-							}
-							break;
-						}
-				}
-				if (r >= 0) errno = oerrno;
-				else if (!errno) errno = ENODEV;
-			}
-			else if (!spc)
-			{
-				if ((r = mapdump(tab, NiL, 0)) >= 0 && r < size)
-				{
-					mapdump(tab, path, 0);
-					r = 0;
-				}
-			}
-			else if (tab == &state.vmap)
-			{
-				register Map_t*	map;
-
-				if (!(pathreal(spc, P_PATHONLY|P_ABSOLUTE|P_NOSLASH, NiL)))
-					r = -1;
-				else if (!(map = search(tab, state.path.name, strlen(state.path.name), NiL, 0)))
-				{
-					if ((r = 0) < size)
-						path[r] = 0;
-				}
-				else if ((r = T_VALSIZE(map)) < size)
-				{
-					strncpy(path, map->val, r);
-					path[r] = 0;
-					r = 0;
-				}
-			}
-			else if (!pathreal(spc, P_LSTAT, NiL)) r = -1;
-#if 1
-			else
-			{
-				r = strlen(state.path.name);
-				if (r > 1)
-				{
-					if (state.path.name[r - 1] == '.' && state.path.name[r - 2] == '/')
-					{
-						if (!(r -= 2))
-							r = 1;
-						state.path.name[r] = 0;
-					}
-				}
-				if (++r <= size)
-				{
-					strcpy(path, state.path.name);
-					r = 0;
-				}
-			}
-#else
-			else if ((r = strlen(state.path.name)) < size)
-			{
-				strcpy(path, state.path.name);
-				r = 0;
-			}
-#endif
-			return(r);
-		}
-		else if (tab && spc) return(mapset(tab, path, 0, spc, 0));
-	}
-	return(MOUNT(spc, path ? pathreal(path, 0, NiL) : (char*)0, mode, a4, a5, a6));
-}

+ 0 - 96
src/cmd/3d/opaque.sh

@@ -1,96 +0,0 @@
-########################################################################
-#                                                                      #
-#               This software is part of the ast package               #
-#          Copyright (c) 1989-2011 AT&T Intellectual Property          #
-#                      and is licensed under the                       #
-#                 Eclipse Public License, Version 1.0                  #
-#                    by AT&T Intellectual Property                     #
-#                                                                      #
-#                A copy of the License is available at                 #
-#          http://www.eclipse.org/org/documents/epl-v10.html           #
-#         (with md5 checksum b35adb5213ca9657e911e9befb180842)         #
-#                                                                      #
-#              Information and Software Systems Research               #
-#                            AT&T Research                             #
-#                           Florham Park NJ                            #
-#                                                                      #
-#                 Glenn Fowler <gsf@research.att.com>                  #
-#                  David Korn <dgk@research.att.com>                   #
-#                   Eduardo Krell <ekrell@adexus.cl>                   #
-#                                                                      #
-########################################################################
-:
-# opaque file ...
-# handles old (pre-92) and new style opaque
-# @(#)opaque (AT&T Bell Laboratories) 10/11/95
-
-function err_exit
-{
-	print -u2 "$command: $@"
-	exit 1
-}
-
-function usage
-{
-	print -u2 "Usage: $command file ..."
-	exit 2
-}
-
-command=${0##*/}
-case $1 in
---)	shift
-	break
-	;;
-""|-\?)	usage
-	;;
--*)	print -u2 -- "$1: invalid option"
-	usage
-	;;
-esac
-
-# the rest is in 2d
-
-2d + 2>/dev/null || { { : > xxx && rm xxx && 2d + ;} || exit 1 ;}
-n=$(umask)
-
-for i
-do	if	[[ -f $i ]]
-	then	[[ $i -ef .../... ]] || print -u2 "$command: $i: file exists"
-	else	case $i in
-		*/*)	dir=${i%/*} file=${i##*/} ;;
-		*)	dir=. file=$i ;;
-		esac
-		[[ $dir -ef . ]] || cd "$dir" || err_exit "$dir: cd failed"
-		if	[[ ! -f .../... ]]
-		then	if	[[ ! -d ... ]]
-			then	if	mkdir ...
-				then	chgrp 3d ... 2>/dev/null && chmod g+s ...
-					umask 777
-					> .../... || err_exit "$i: cannot opaque"
-					umask ${n#8#}
-				elif	[[ ! -f ... ]]
-				then	err_exit "...: cannot mkdir"
-				elif	[[ -r ... || -w ... || -x ... || -s ... ]] 
-				then	err_exit "...: obsolescent opaque must be 0 mode file"
-				else	mkdir ...3d || err_exit "...3d: cannot mkdir"
-					if	mv ... ...3d
-					then	if	mv ...3d ...
-						then	:
-						else	rmdir ...
-							mv ...3d ...
-							err_exit "...: cannot rename obsolescent opaque"
-						fi
-					else	rmdir ...3d
-						err_exit "...: cannot rename obsolescent opaque"
-					fi
-					chgrp 3d ... 2>/dev/null && chmod g+s ...
-				fi
-			else	umask 777
-				> .../... || err_exit "$i: cannot opaque"
-				umask ${n#8#}
-			fi
-		fi
-		ln .../... "$file"
-		[[ $dir -ef . ]] || cd ~- || err_exit "$OLDPWD: cannot restore directory"
-	fi
-done

+ 0 - 358
src/cmd/3d/open3d.c

@@ -1,358 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-/*
- * this does the actual open, creating versions as required
- */
-
-static int
-vcreate(register const char* path, int flags, int mode)
-{
-	register char*	cp;
-	register char*	ep;
-	int		dirlen;
-	int		namlen;
-	int		fd;
-	int		r;
-	char		buf[PATH_MAX+1];
-
-	if (!state.vmap.size || !(flags & O_CREAT))
-		return OPEN(path, flags, mode);
-	ep = cp = (char*)path + strlen(path);
-	if (!instance(state.path.name, cp, &state.path.st, 1))
-		return OPEN(path, flags, mode);
-	while (cp > (char*)path && *--cp != '/');
-	if (*cp == '/') cp++;
-	namlen = ep - cp;
-
-	/*
-	 * construct pathname for version instance name text into buf
-	 */
-
-	memcpy(buf, path, dirlen = cp - path);
-	memcpy(buf + dirlen, state.opaque, 4);
-	*ep = '/';
-	strcpy(buf + dirlen + 4, cp);
-	if ((fd = OPEN(buf, flags, mode)) >= 0)
-		return fd;
-	if (errno != ENOTDIR && errno != ENOENT)
-		return -1;
-	buf[dirlen + namlen + 4] = 0;
-	if (MKDIR(buf, VERMODE))
-	{
-		buf[dirlen + 3] = 0;
-		if (MKDIR(buf, VERMODE))
-		{
-			if (errno != EEXIST)
-				return -1;
-			if (LSTAT(buf, &state.path.st))
-				return -1;
-
-			/*
-			 * check for old style opaque, can be removed soon
-			 */
-
-			if (S_ISREG(state.path.st.st_mode) && !(state.path.st.st_mode & S_IPERM))
-			{
-				char	savebuf[8];
-
-				memcpy(savebuf, cp, sizeof(savebuf));
-				strcpy(cp, "....");
-				if (RENAME(buf, path))
-				{
-					errno = EEXIST;
-					return -1;
-				}
-				if (MKDIR(buf, VERMODE))
-					return -1;
-				buf[dirlen + 3] = '.';
-				buf[dirlen + 4] = 0;
-				strcpy(cp, state.opaque);
-				if (RENAME(buf, path))
-				{
-					errno = EEXIST;
-					return -1;
-				}
-				memcpy(cp, savebuf, 8);
-				buf[dirlen + 3] = 0;
-				buf[dirlen + 4] = *cp;
-			}
-			else
-			{
-				errno = EEXIST;
-				return -1;
-			}
-		}
-		buf[dirlen + 3] = '/';
-		if (MKDIR(buf, VERMODE))
-			return -1;
-	}
-	buf[dirlen + namlen + 4] = '/';
-
-	/*
-	 * now create the file
-	 */
-
-	if ((fd = OPEN(buf, flags, mode)) < 0)
-		return -1;
-	strcpy(buf + dirlen + namlen + 5, state.vdefault);
-	*ep = 0;
-	r = RENAME(path, buf);
-	if (SYMLINK(buf + dirlen, path))
-		return fd;
-	if (r)
-	{
-		strcpy(buf + dirlen + namlen + 5, ep + 1);
-		LINK(buf, path);
-	}
-	return fd;
-}
-
-int
-open3d(const char* path, int oflag, ...)
-{
-	register char*	sp = 0;
-	register int	r;
-	int		fd = -1;
-	int		level;
-	int		synthesize;
-	mode_t		mode;
-	struct stat	st;
-	va_list		ap;
-#if FS
-	Mount_t*	mp;
-#endif
-
-	va_start(ap, oflag);
-	mode = (oflag & O_CREAT) ? va_arg(ap, int) : 0;
-	va_end(ap);
-#if FS
-	if (!fscall(NiL, MSG_open, 0, path, oflag, mode, 0))
-	{
-		message((-1, "DEBUG: fs open fd=%d", state.ret));
-		return state.ret;
-	}
-	mp = monitored();
-#endif
-	if (state.in_2d)
-	{
-		if ((r = OPEN((!path || *path) ? path : state.dot, oflag, mode)) < 0 || !state.call.monitor || state.in_2d == 1 || FSTAT(r, &st))
-			return r;
-		goto done;
-	}
-	for (;;)
-	{
-		if (!(sp = pathreal(path, (oflag & O_CREAT) ? P_NOOPAQUE : 0, &st)))
-		{
-			if (oflag & O_CREAT)
-			{
-				Path_t	save;
-
-				save = state.path;
-				state.real++;
-				sp = pathreal(path, P_PATHONLY|P_DOTDOT, NiL);
-				state.real--;
-				if (!sp)
-				{
-					state.path = save;
-					errno = EROFS;
-					return -1;
-				}
-				if (state.path.level && LSTAT(sp, &st))
-				{
-					if (LSTAT(state.dot, &st) || fs3d_mkdir(sp, st.st_mode & S_IPERM))
-					{
-						state.path = save;
-						return -1;
-					}
-					state.path = save;
-					continue;
-				}
-				state.path = save;
-				sp = 0;
-			}
-			st.st_mode = 0;
-		}
-		else if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode))
-		{
-			r = OPEN(path, oflag, mode);
-			goto done;
-		}
-		break;
-	}
-	level = state.path.level;
-	synthesize = state.path.synthesize;
-#if VCS && defined(VCS_OPEN)
-	VCS_OPEN(path, oflag, mode, &state.path.st);
-#endif
-	if ((oflag & O_CREAT) && (!sp || level || (oflag & O_EXCL)) || (sp || level) && ((oflag & O_TRUNC) || (oflag & O_ACCMODE) != O_RDONLY))
-	{
-		if (sp)
-		{
-			if ((oflag & O_ACCMODE) != O_RDONLY)
-			{
-				if (!level) 
-				{
-					r = OPEN(sp, oflag, mode);
-					goto done;
-				}
-				if (!(oflag & O_TRUNC) && (fd = OPEN(sp, O_RDONLY, 0)) < 0)
-					return -1;
-			}
-			mode = ((S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)|(st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)));
-		}
-		if (!(sp = pathreal(path, (oflag & O_CREAT) ? (P_PATHONLY|P_SAFE) : 0, NiL)))
-		{
-			if (fd >= 0)
-				CLOSE(fd);
-			return -1;
-		}
-		if (synthesize)
-			fs3d_mkdir(state.pwd, S_IRWXU|S_IRWXG|S_IRWXO);
-	}
-	else if (!sp)
-	{
-		r = -1;
-		goto done;
-	}
-	r = vcreate(sp, ((oflag & O_ACCMODE) == O_RDWR) ? (oflag|O_CREAT) : oflag, mode);
-	if (r < 0 && errno == ENOENT && ((oflag & (O_CREAT|O_TRUNC)) || (oflag & O_ACCMODE) != O_RDONLY))
-	{
-		if (!(sp = pathreal(path, P_PATHONLY|P_NOOPAQUE, NiL)))
-			r = -1;
-		else if (state.level <= 0 || *sp == '/')
-			r = vcreate(sp, O_CREAT|oflag, mode);
-		else errno = ENOENT;
-		if (r < 0 && errno == ENOENT && (sp = pathreal(path, P_DOTDOT, NiL)) && state.path.level)
-		{
-			if (sp = pathreal(path, P_DOTDOT|P_PATHONLY|P_NOOPAQUE, NiL))
-				r = fs3d_mkdir(sp, S_IRWXU|S_IRWXG|S_IRWXO);
-			if (!r)
-			{
-				/*
-				 * try again
-				 */
-
-				if (!(sp = pathreal(path, P_PATHONLY|P_SAFE, NiL)))
-					r = -1;
-				else r = vcreate(sp, O_CREAT|oflag, mode);
-			}
-			else errno = ENOENT;
-		}
-	}
-	if (r > 0)
-	{
-		if (level && fd >= 0)
-		{
-			if (fs3d_copy(fd, r, NiL))
-			{
-				CLOSE(r);
-				CLOSE(fd);
-				return -1;
-			}
-			state.path.level = 0;
-		}
-		state.path.open_level = state.path.level;
-		setfdview(r, state.path.open_level);
-	}
-	if (fd >= 0)
-		CLOSE(fd);
- done:
-#if FS || defined(fchdir3d)
-	if (r >= 0)
-	{
-#if defined(fchdir3d)
-		if (S_ISDIR(st.st_mode) && r < elementsof(state.file))
-		{
-			Dir_t*	dp;
-
-			if (state.file[r].dir)
-			{
-				free(state.file[r].dir);
-				state.file[r].dir = 0;
-			}
-			if (dp = newof(0, Dir_t, 1, strlen(sp)))
-			{
-				strcpy(dp->path, sp);
-				dp->dev = st.st_dev;
-				dp->ino = st.st_ino;
-				state.file[r].dir = dp;
-			}
-		}
-#endif
-#if FS
-		level = state.path.level;
-		if (state.cache)
-		{
-			if (!st.st_mode)
-				FSTAT(r, &st);
-			fileinit(r, &st, mp, 1);
-		}
-		if (mp)
-			fscall(mp, MSG_open, r, state.path.name, oflag, st.st_mode, level);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_open))
-				fscall(mp, MSG_open, r, state.path.name, oflag, st.st_mode, level);
-#endif
-	}
-#endif
-	return r;
-}
-
-/*
- * use this open() within 3d
- * to save and restore the path state
- */
-
-int
-fs3d_open(const char* path, int oflag, mode_t mode)
-{
-	int	fd;
-	Path_t	save;
-
-	save = state.path;
-	fd = open(path, oflag, mode);
-	state.path = save;
-	return fd;
-}
-
-#if !_nosys_open64
-
-int
-open643d(const char* path, int oflag, ...)
-{
-	mode_t		mode;
-	va_list		ap;
-
-	va_start(ap, oflag);
-	mode = (oflag & O_CREAT) ? va_arg(ap, int) : 0;
-	va_end(ap);
-#if defined(O_LARGEFILE)
-	oflag |= O_LARGEFILE;
-#endif
-	return open(path, oflag, mode);
-}
-
-#endif

+ 0 - 156
src/cmd/3d/pathcanon.c

@@ -1,156 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * pathcanon - generate canonical pathname from given pathname
- *
- * this routine works with both relative and absolute paths
- * relative paths can contain any number of leading ../
- * a pointer to the trailing '\0' is returned, 0 on error
- * the operator ... is also applied by this routine
- * phys is for libast compatibility and is currently ignored
- */
-
-#include "3d.h"
-
-char*
-pathcanon(char* path, size_t size, int phys)
-{
-	register char*	sp;
-	register char*	dp = path;
-	register int	c = '/';
-	register char*	begin = dp;
-	int		add_dot = 0;
-	long		visits = 0;
-
-	message((-6, "patcanon: ++ %s%s", path, phys ? " [PHYSICAL]" : ""));
-	if (!size) size = strlen(dp) + 1;
-#if PRESERVE_LEADING_SLASH_SLASH
-	if (*dp == '/' && *(dp + 1) == '/')
-		path = ++dp;
-#endif
-	if (*dp != '/') dp--;
-	sp = dp;
-	for (;;)
-	{
-		sp++;
-		if (c == '/')
-		{
-			/*
-			 * eliminate redundant /
-			 */
-
-			if (*sp == '/')
-				continue;
-			if (*sp == '.')
-			{
-				if ((c = *++sp) == '/')
-				{
-					/*
-					 * ./
-					 */
-
-					add_dot++;
-					continue;
-				}
-				if (!c)
-				{
-					/*
-					 * .
-					 */
-
-					add_dot++;
-					break;
-				}
-				if (c == '.')
-				{
-					if (!(c = *++sp) || c == '/')
-					{
-						/*
-						 * ..
-						 */
-
-						if (dp < begin)
-							begin += 3;
-						else
-						{
-							if (dp > begin)
-								while (*--dp != '/')
-									if (dp < begin)
-										break;
-							if (!c)
-								break;
-							continue;
-						}
-					}
-					else if (c == '.' && !state.in_2d)
-					{
-						if (!(c = *++sp) || c == '/')
-						{
-							/*
-							 * ...
-							 */
-
-							*dp = 0;
-							phys = state.path.level;
-							if (!(dp = pathnext(path, sp, &visits)))
-							{
-								message((-6, "patcanon: -- %s", NiL));
-								return(0);
-							}
-							if (!state.real)
-								state.path.level = phys;
-							if (!(*(sp = dp) = c))
-							{
-								dp--;
-								break;
-							}
-							continue;
-						}
-						*++dp = '.';
-					}
-					*++dp = '.';
-				}
-				*++dp = '.';
-			}
-		}
-		add_dot = 0;
-		if (!(c = *sp))
-			break;
-		*++dp = c;
-	}
-
-	/*
-	 * preserve trailing /.
-	 */
-
-	if (add_dot)
-	{
-		if (*dp != '/')
-			*++dp = '/';
-		*++dp = '.';
-	}
-	*++dp = 0;
-	message((-6, "patcanon: -- %s", path));
-	return(dp);
-}

+ 0 - 64
src/cmd/3d/pathconf3d.c

@@ -1,64 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef pathconf3d
-
-long
-pathconf3d(const char* path, int op)
-{
-	register char*	sp;
-	long		r;
-	int		oerrno;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_pathconf, 0, path, op))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, 0, NiL)))
-		return(-1);
-	oerrno = errno;
-	errno = 0;
-	r = PATHCONF(sp, op);
-	if (!errno)
-	{
-		errno = oerrno;
-#if FS
-		if (mp)
-			fscall(mp, MSG_pathconf, 0, sp, op);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_pathconf))
-				fscall(mp, MSG_pathconf, 0, sp, op);
-#endif
-	}
-	return(r);
-}
-
-#else
-
-NoN(pathconf)
-
-#endif

+ 0 - 203
src/cmd/3d/pathnext.c

@@ -1,203 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2012 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-/*
- * get next view for path sp
- */
-
-char*
-pathnext(char* sp, char* extra, long* visits)
-{
-	register char*	ep = sp + strlen(sp);
-	register char*	cp;
-	register char*	tmp;
-	register int	shift;
-	Map_t*		vpath;
-	int		vpathlen;
-
-	message((-4, "pathnext: ++ %s%s%s [0x%08x]", sp, extra ? " + " : state.null, extra ? extra : state.null, visits ? *visits : 0L));
-
-	/*
-	 * check for next layer and previous visit
-	 */
-
-	if (state.path.level + 1 >= state.limit)
-	{
-		message((-4, "pathnext: -- %s [limit=%d]", NiL, state.limit));
-		return 0;
-	}
-	ep = sp + (shift = strlen(sp));
-	if (!(vpath = search(state.path.table ? state.path.table : &state.vpath, sp, shift, (const char*)visits, T_PREFIX)))
-	{
-		message((-4, "pathnext: -- %s [0x%08x]", NiL, visits ? *visits : 0L));
-		return 0;
-	}
-
-	/*
-	 * we found a viewpath entry
-	 * check if stuff after extra needs to be shifted
-	 */
-
-	vpathlen = T_VALSIZE(vpath);
-	cp = sp + vpath->keysize;
-	shift = vpathlen - (cp - sp);
-	if (shift < 0)
-	{
-		/*
-		 * shift left
-		 */
-
-		if (cp < ep)
-			strcopy(sp + vpathlen + 1, cp + 1);
-	}
-	else if (shift > 0)
-	{
-		/*
-		 * shift right extra
-		 */
-
-		if (extra)
-		{
-			for (tmp = extra + strlen(extra); tmp >= extra; tmp--)
-				tmp[shift] = *tmp;
-			extra += shift;
-		}
-
-		/*
-		 * shift right cp
-		 */
-
-		if (cp < ep)
-		{
-			for (tmp = ep; tmp > cp; tmp--)
-				tmp[shift] = *tmp;
-			strcopy(sp + vpathlen + 1, cp + shift + 1);
-		}
-	}
-
-	/*
-	 * insert vpath
-	 */
-
-	strncpy(sp, vpath->val, vpathlen);
-	sp[vpathlen] = cp < ep ? '/' : 0;
-	cp = sp;
-	if (extra)
-		strcpy(sp = ep + shift, extra);
-	state.path.level++;
-	message((-4, "pathnext: -- %s [level=%d visits=0x%08x]", cp, state.path.level, visits ? *visits : 0L));
-	return sp;
-}
-
-/*
- * search for the instance name for path sp
- * and place in instname
- * 0 returned when instances exhausted
- * if create is non-zero, use name before the first slash as instance
- * name, and do not check existence.
- */
-
-int
-instance(register char* sp, char* instname, struct stat* st, int create)
-{
-	register char*	cp;
-	register char*	mp;
-	register char*	mapnext;
-	register int	size;
-	int		maps;
-	char*		mapend;
-	Map_t*		map;
-
-	cp = instname++;
-	mapnext = mapend = 0;
-	maps = 0;
-	if (state.vmap.size)
-	{
-		while (*--cp != '/');
-		if (!create) cp -= 4;
-	}
-	else cp = sp;
-	for (;;)
-	{
-		if ((mp = mapnext) >= mapend)
-		{
-			/*
-			 * look for next vmap
-			 */
-
-			while (cp > sp)
-			{
-				map = search(&state.vmap, sp, cp - sp, NiL, 0);
-				if (cp > sp + 1)
-				{
-					while (*--cp != '/');
-					while (cp > sp && cp[-1] == '/') cp--;
-					if (cp == sp) cp++;
-				}
-				else cp = sp;
-				if (map && (!create || *map->val != '/'))
-					goto match;
-			}
-			if (!create)
-			{
-				strcpy(instname, state.vdefault);
-				maps++;
-				if (!LSTAT(sp, st))
-					goto found;
-			}
-			return 0;
-		match:
-			mp = map->val;
-			size = T_VALSIZE(map);
-			mapend = mp + size;
-			if (create)
-			{
-				while (mp < mapend && *mp!='/') mp++;
-				if ((size = mp - map->val) <= 0)
-					return 0;
-				memcpy(instname, map->val, size);
-				instname[size] = 0;
-				maps++;
-				goto found;
-			}
-			if (*mp == '/') mp++;
-		}
-		for (mapnext = mp; mapnext < mapend; mapnext++)
-			if (*mapnext == '/')
-				break;
-		if ((size = mapnext - mp) <= 0) continue;
-		memcpy(instname, mp, size = mapnext - mp);
-		instname[size] = 0;
-		while (mapnext < mapend && *mapnext == '/') mapnext++;
-		maps++;
-		if (!LSTAT(sp, st))
-			goto found;
-	}
-	/*NOTREACHED*/
- found:
-	if (maps > 1)
-		state.path.level |= INSTANCE;
-	return 1;
-}

+ 0 - 654
src/cmd/3d/pathreal.c

@@ -1,654 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2012 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifndef MAXSYMLINKS
-#define MAXSYMLINKS	20
-#endif
-
-/*
- * if <sp> is a hard link to state.opaque in the same directory then the file
- * is opaque and the errno should be ENOENT
- */
-
-static int
-checkopaque(register char* path, struct stat* st)
-{
-	register char*	basesp;
-	int		oerrno = errno;
-	struct stat	statb;
-	char		savebuf[sizeof(state.opaque)];
-	register int	r = 0;
-
-	if (st->st_nlink <= 1)
-		return 0;
-	if (st->st_mode & (S_IRWXU|S_IRWXG|S_IRWXO))
-		return 0;
-
-	/*
-	 * change the basename to state.opaque
-	 */
-
-	if (basesp = strrchr(path, '/'))
-		basesp++;
-	else
-		basesp = path;
-	memcpy(savebuf, basesp, sizeof(state.opaque));
-	strcpy(basesp, state.opaque);
-	if (LSTAT(path, &statb))
-	{
-		/*
-		 * for backward compatability
-		 */
-
-		basesp[3] = 0;
-		if (LSTAT(path, &statb))
-			goto not_opaque;
-	}
-	if (statb.st_ino == st->st_ino && statb.st_dev == st->st_dev)
-	{
-		errno = ENOENT;
-		r = statb.st_ino;
-	}
-	else
-		errno = oerrno;
- not_opaque:
-	memcpy(basesp, savebuf, sizeof(state.opaque));
-	return r;
-}
-
-/*
- * return real path name for path
- */
-
-#if DEBUG
-
-static char*	_pathreal(const char*, int, struct stat*);
-
-char*
-pathreal(const char* apath, register int type, struct stat* st)
-{
-	char*	path = (char*)apath;
-
-	initialize();
-	message((-5, "pathreal: ++ %s type=|%s%s%s%s%s%s%s%s%s%s%s", path
-		, (type & P_ABSOLUTE) ? "ABSOLUTE|" : state.null
-		, (type & P_DOTDOT) ? "DOTDOT|" : state.null
-		, (type & P_LSTAT) ? "LSTAT|" : state.null
-		, st ? "MYSTAT|" : state.null
-		, (type & P_NOOPAQUE) ? "NOOPAQUE|" : state.null
-		, (type & P_NOSLASH) ? "NOSLASH|" : state.null
-		, (type & P_PATHONLY) ? "PATHONLY|" : state.null
-		, (type & P_READLINK) ? "READLINK|" : state.null
-		, (type & P_SAFE) ? "SAFE|" : state.null
-		, (type & P_SLASH) ? "SLASH|" : state.null
-		, (type & P_TOP) ? "TOP|" : state.null
-		));
-	path = _pathreal(path, type, st);
-	message((-5, "pathreal: -- %s level=%d links=%d", path, state.path.level, state.path.nlinks));
-	return path;
-}
-
-#undef	initialize
-#define initialize()
-#undef	pathreal
-#define pathreal _pathreal
-static
-
-#endif
-
-char*
-pathreal(const char* apath, register int type, struct stat* st)
-{
-	char*			path = (char*)apath;
-	register char*		sp;
-	register char*		cp;
-	register char*		ip;
-	Table_t*		safe;
-	int			oerrno = errno;
-	int			opaqued = 0;
-	int			len;
-	int			vir;
-	int			safesize;
-	int			safe_dir;
-	long			visits;
-	char			buf[PATH_MAX + 1];
-
-	static struct stat	stbuf;
-	static struct stat	tsbuf;
-
-	state.path.level = state.path.synthesize = state.path.nlinks = 0;
-	if (!path)
-	{
-		errno = EFAULT;
-		return 0;
-	}
-	initialize();
-	if (state.in_2d)
-	{
-		if (!st || (!state.level || *path == '/') && !LSTAT(path, st))
-			return path;
-		if (state.level && streq(path, ".") && !CHDIR(state.pwd))
-		{
-			state.level = 0;
-			return path;
-		}
-		return 0;
-	}
-#if FS
-	if (mounted() && (sp = fsreal(state.path.monitor, MSG_stat, state.path.mount)))
-		apath = (char*)(path = sp);
-#endif
-
-	/*
-	 * handle null path, . and / separately
-	 */
-
-	if (safe = state.safe ? &state.vsafe : (Table_t*)0)
-	{
-		type |= P_ABSOLUTE;
-		if (!(safesize = state.safe->servicesize))
-			safesize = strlen(state.safe->service);
-	}
-	else
-		type &= ~P_SAFE;
- again:
-	if (!*path)
-	{
-		errno = ENOENT;
-		return 0;
-	}
-	cp = sp = path;
-	state.path.synthesize = state.path.linksize = 0;
-	if (!st)
-		st = &stbuf;
-
-	/*
-	 * check if virtual dir has been created by another process
-	 * only P_PATHONLY|P_TOP calls (usually create or modify link) and
-	 * references to "." are checked for performance
-	 */
-
-	if (state.level > 0 && state.pwd && ((type & (P_PATHONLY|P_TOP)) && *sp != '/' || *sp == '.' && sp[1] == 0))
-	{
-		if (!CHDIR(state.pwd))
-			state.level = 0;
-		else if (!(type & (P_PATHONLY|P_TOP)))
-		{
-			len = 0;
-			state.path.level += (state.path.synthesize = state.level);
-			sp = strcpy(state.path.name, state.pwd);
-			goto skip;
-		}
-	}
-	if (!state.pwd || sp[1] == 0 && (*sp == '.' || *sp == '/' && !safe))
-	{
-		if (st != &stbuf && LSTAT(sp, st))
-			return 0;
-		if (*sp == '/' || !state.pwd && (type & P_PATHONLY))
-			strncpy(state.path.name, sp, PATH_MAX);
-		else if (!state.pwd)
-		{
-			/*
-			 * treat the current directory as if were empty
-			 */
-
-			errno = ENOENT;
-			return 0;
-		}
-		else
-			strncpy(state.path.name, state.pwd, PATH_MAX);
-		errno = oerrno;
-		return state.path.name;
-	}
-
-	/*
-	 * put absolute pathname into state.path
-	 */
-
-	safe_dir = 0;
-	if (*path != '/')
-	{
-		strcpy(state.path.name, state.pwd);
-		sp = state.path.name + state.pwdsize;
-		*sp++ = '/';
-		if (safe && state.pwdsize >= safesize && !strncmp(state.pwd, state.safe->service, safesize) && (!state.pwd[safesize] || state.pwd[safesize] == '/'))
-			safe_dir = safesize;
-	}
-	else
-		sp = state.path.name;
-	ip = state.path.name + elementsof(state.path.name);
-	while (sp < ip && (*sp = *cp++))
-		sp++;
-	if (type & P_DOTDOT)
-		strcpy(sp, "/..");
-	sp = state.path.name;
-	if (!(ip = pathcanon(sp + safe_dir, sizeof(state.path.name) - safe_dir, 0)))
-	{
-		errno = ENOENT;
-		return 0;
-	}
-	if (type & (P_DOTDOT|P_NOSLASH))
-	{
-		/*
-		 * remove trailing slashes
-		 */
-
-		while (*--ip == '/');
-		*++ip = 0;
-	}
-	else if ((type & P_SLASH) && *(ip - 1) != '/')
-		*ip++ = '/';
-	if (*(ip - 1) == '/' && ip - sp > 1)
-	{
-		/*
-		 * trailing slash is equivalent to trailing slash-dot
-		 * this forces the common-sense interpretation
-		 */
-#if DEBUG
-		if (!(state.test & 010))
-#endif
-		*ip++ = '.';
-		*ip = 0;
-	}
-	len = ip - sp;
-
-	/*
-	 * try to use relative path
-	 */
-
-	if (!(type & (P_LSTAT|P_READLINK)))
-	{
-		for (ip = state.pwd; *ip && *ip == *sp++; ip++);
-		if (*ip != 0 || *sp && *sp != '/' || state.level < 0)
-			sp = state.path.name;
-		else
-		{
-			state.path.level += (state.path.synthesize = state.level);
-			if (state.level && !(type & P_PATHONLY) && st == &stbuf)
-			{
-				sp = state.path.name;
-				len -= state.pwdsize;
-			}
-			else if (type & P_ABSOLUTE)
-				sp = state.path.name;
-			else if (*sp == '/')
-				sp++;
-		}
-		if (*sp == 0)
-			sp = state.dot;
-	}
- skip:
-	if ((type & P_NOOPAQUE) && !LSTAT(sp, st) && checkopaque(sp, st))
-	{
-		message((-1, "%s: remove opaque", sp));
-		UNLINK(sp);
-		opaqued = 1;
-	}
-	if (safe && *sp == '/')
-	{
-		state.path.table = safe;
-		cp = pathnext(sp, NiL, NiL);
-		state.path.table = safe = 0;
-		if (cp)
-		{
-			state.path.level = 0;
-			path = strcpy(buf, sp);
-			message((-5, "pathreal: == safe map %s", path));
-			type &= ~(P_DOTDOT|P_SAFE);
-			goto again;
-		}
-		if (!*(sp + 1))
-		{
-			strncpy(sp, state.safe->service, safesize);
-			sp[safesize] = 0;
-		}
-		else if (strncmp(sp, state.safe->service, safesize) || sp[safesize] && sp[safesize] != '/')
-		{
-			if (*path != '/' && safe_dir)
-			{
-				errno = EPERM;
-				return 0;
-			}
-			if (sp[1])
-				strcpy(buf, sp);
-			else
-				*buf = 0;
-			len = sfsprintf(sp, sizeof(state.path.name), "%-*s%s", safesize, state.safe->service, buf);
-			message((-5, "pathreal: == safe next %s", sp));
-			if (!pathnext(sp, NiL, NiL))
-			{
-				errno = EPERM;
-				return 0;
-			}
-		}
-		else
-			type &= ~P_SAFE;
-	}
-	if ((type & P_SAFE) && state.path.level)
-	{
-		errno = EPERM;
-		return 0;
-	}
-	if (type & P_PATHONLY)
-	{
-		errno = oerrno;
-		return sp;
-	}
-	visits = 0;
-	vir = 1;
-	while (LSTAT(sp, st))
-	{
-		if (vir)
-		{
-			if (apath[0] == '.' && apath[1] == '.' && apath[2] == '.' && !apath[3])
-			{
-				if (state.level > 0)
-				{
-					message((-1, "pathreal: %s => %s", apath, sp));
-					LSTAT(".", st);
-					return sp;
-				}
-				errno = ENOENT;
-				return 0;
-			}
-			vir = 0;
-		}
-		if (errno == ENOTDIR)
-		{
-			/*
-			 * check for version instance
-			 */
-
-			cp = ip = sp + strlen(sp);
-			while (ip > sp && *--ip != '/');
-			if (ip < sp)
-				return 0;
-			while (ip > sp && *--ip == '/');
-			if (ip < sp)
-				return 0;
-			while (ip > sp && *--ip != '/');
-			if (*ip == '/')
-				ip++;
-			while (cp >= ip)
-			{
-				cp[4] = *cp;
-				cp--;
-			}
-			memcpy(ip, state.opaque, 4);
-			if (!LSTAT(sp, st))
-				break;
-			errno = ENOTDIR;
-			return 0;
-		}
-
-		if (errno != ENOENT || opaqued)
-			return 0;
-#if FS
-		/*
-		 * check user mount
-		 */
-
-		if (visits)
-		{
-			Mount_t*	mp;
-			const char*	up;
-
-			if ((mp = getmount(sp, &up)) && (mp->fs->flags & FS_NAME) && (sp = fsreal(mp, MSG_open, (char*)up)) && !LSTAT(sp, st))
-				break;
-		}
-#endif
-
-		/*
-		 * search down the viewpath
-		 */
-
-		if (type & P_SAFE)
-		{
-			errno = EPERM;
-			return 0;
-		}
-		if (!pathnext(state.path.name, NiL, &visits))
-			return 0;
-		sp = state.path.name;
-		if (!(type & P_ABSOLUTE))
-		{
-			/*
-			 * try to use relative path
-			 */
-
-			for (ip = state.pwd; *ip && *ip == *sp++; ip++);
-			if (*ip == 0 && *sp == '/')
-				sp++;
-			else
-				sp = state.path.name;
-		}
-		if (*sp == 0)
-			sp = state.dot;
-	}
-	if (st->st_nlink > 1 && checkopaque(sp, st))
-		return 0;
-	if ((type & P_TOP) && state.path.level)
-	{
-		int	rfd;
-		int	wfd;
-
-		if ((rfd = OPEN(sp, O_RDONLY, 0)) < 0)
-			sp = 0;
-		else
-		{
-			tsbuf = *st;
-			wfd = open(apath, O_WRONLY|O_CREAT|O_TRUNC|O_cloexec, st->st_mode & S_IPERM);
-			*st = tsbuf;
-			if (wfd < 0)
-				sp = 0;
-			else 
-			{
-				if (fs3d_copy(rfd, wfd, st))
-					sp = 0;
-				CLOSE(wfd);
-			}
-			CLOSE(rfd);
-		}
-		if (!sp)
-		{
-			errno = EROFS;
-			return 0;
-		}
-		if (st == &stbuf)
-			st = 0;
-		return pathreal(apath, P_PATHONLY, st);
-	}
-	IVIEW(st, state.path.level);
-	if (state.path.synthesize)
-	{
-		if (state.path.level < state.level)
-		{
-			if (len)
-			{
-				ip  = state.path.name + strlen(state.path.name) - len;
-				len = *ip;
-				*ip = 0;
-			}
-			if (!CHDIR(state.path.name))
-				state.level = state.path.level;
-			message((-1, "chdir=%s level=%d", state.path.name, state.level));
-			*ip = len;
-		}
-		else if (S_ISDIR(st->st_mode))
-		{
-			int		mask;
-			static int	uid = -1;
-			static int	gid;
-
-			umask(mask = umask(0));
-			st->st_mode = (st->st_mode | (S_IRWXU|S_IRWXG|S_IRWXO)) & ~(mask & (S_IRWXU|S_IRWXG|S_IRWXO));
-			if (uid == -1)
-			{
-				uid = geteuid();
-				gid = getegid();
-			}
-			st->st_uid = uid;
-			st->st_gid = gid;
-		}
-	}
-	ip = sp;
-
-	/*
-	 * symbolic links handled specially
-	 * get filename from pathname
-	 */
-
-	if (S_ISLNK(st->st_mode) && (len = checklink(sp, st, type)) > 1 && !(type & (P_LSTAT|P_READLINK)) && state.path.nlinks++ < MAXSYMLINKS)
-	{
-		path = strcpy(buf, state.path.name);
-		message((-1, "pathreal: == again %s", path));
-		if (*path != '/')
-			state.path.level = 0;
-		type &= ~(P_DOTDOT|P_SAFE);
-		goto again;
-	}
-#if VCS && defined(VCS_REAL)
-	VCS_REAL(state.path.name, st);
-#endif
-	errno = oerrno;
-	return sp;
-}
-
-/*
- * check whether sp points to a version object and find version instance
- * sp is canonicalized and points into state.path
- * when called from unlink, (type & P_PATHONLY) is set
- *     -1 for non-existent link
- *     length of path for a relative link that is not a version object
- *     0  otherwise
- *    state.path.linkname and state.path.linksize are set for version object
- */
-
-int
-checklink(const char* asp, struct stat* st, int type)
-{
-	register char*	sp = (char*)asp;
-	register char*	ip;
-	register int	len;
-	register int	n;
-	register char*	bp;
-
-	char		buf[PATH_MAX + 1];
-
-	if (sp < state.path.name || sp >= state.path.name + sizeof(state.path.name))
-	{
-		message((-1, "AHA#%d checklink bounds sp=%p state.path.name=%p sp=%s", __LINE__, sp, state.path.name, sp));
-		sp = strncpy(state.path.name, sp, sizeof(state.path.name) - 1);
-	}
-	while (S_ISLNK(st->st_mode))
-	{
-		/*
-		 * go to the last component
-		 */
-
-		if (ip = strrchr(sp, '/'))
-			ip++;
-		else
-			ip = sp;
-		strcpy(buf, ip);
-		len = (state.path.name + sizeof(state.path.name) - 1) - ip;
-		if ((len = READLINK(sp, ip, len)) < 0)
-		{
-			message((-1, "%s: cannot readlink", sp));
-			return 0;
-		}
-		state.path.linkname = ip;
-		state.path.linksize = len;
-
-		/*
-		 * check for relative link
-		 */
-
-		if (*ip != '/')
-		{
-			ip[len] = 0;
-			if (*ip == *state.opaque && !memcmp(ip, state.opaque, 4) && !memcmp(ip + 4, buf, n = strlen(buf)))
-			{
-				/*
-				 * version object
-				 */
-
-				ip += n + 4;
-				if (instance(state.path.name, ip, st, 0))
-				{
-					state.path.linksize = strlen(state.path.linkname);
-					if (type & P_LSTAT)
-					{
-						st->st_size = state.path.linksize;
-						st->st_mode &= S_IPERM;
-#ifdef S_IFLNK
-						st->st_mode |= S_IFLNK;
-#endif
-						return 0;
-					}
-					continue;
-				}
-				errno = ENOENT;
-				return -1;
-			}
-			else if (!(type & (P_LSTAT|P_PATHONLY|P_READLINK)) && *ip == '.' && *(ip + 1) == '.' && (*(ip + 2) == '/' || *(ip + 2) == 0))
-			{
-				memcpy(buf, ip, len + 1);
-				bp = state.path.name;
-				while (ip > bp && *(ip - 1) == '/')
-					ip--;
-				for (;;)
-				{
-					*(sp = ip) = 0;
-					while (ip > bp && *--ip != '/');
-					while (ip > bp && *(ip - 1) == '/')
-						ip--;
-					if (*ip == '/')
-						ip++;
-					if ((n = READLINK(state.path.name, ip, PATH_MAX - (ip - state.path.name))) <= 0)
-					{
-						*sp++ = '/';
-						state.path.linkname = (char*)memcpy(sp, buf, len + 1);
-						return sp + len - state.path.name;
-					}
-					if (*ip == '/')
-						ip = (char*)memcpy(bp = state.path.name, ip, n);
-					else if (ip > bp)
-						*(ip - 1) = '/';
-					ip += n;
-				}
-			}
-		}
-
-		/*
-		 * restore last component
-		 */
-
-		if (!(type & P_READLINK))
-			strcpy(ip, buf);
-		break;
-	}
-	return 0;
-}

+ 0 - 49
src/cmd/3d/peek.c

@@ -1,49 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#include <cs.h>
-
-/*
- * peek siz chars from fd into buf
- * if not peekable but seekable then chars are peeked at offset 0
- */
-
-ssize_t
-peek(int fd, void* buf, size_t siz)
-{
-	register int	n;
-
-	n = cspeek(&cs, fd, buf, siz);
-	if (n >= 0)
-		return(n);
-	cspeek(&cs, -1, NiL, 0);
-	if (!FSTAT(fd, &state.path.st) && state.path.st.st_size <= siz)
-	{
-		while ((n = read(fd, buf, siz)) != state.path.st.st_size && lseek(fd, 0L, 1) > 0 && lseek(fd, 0L, 0) == 0);
-		if (n == state.path.st.st_size || n > 0 && !state.path.st.st_size)
-			return(n);
-	}
-	return(-1);
-}

+ 0 - 67
src/cmd/3d/pipe3d.c

@@ -1,67 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef pipe3d
-
-int
-pipe3d(int* fds)
-{
-	int		r;
-#if !_mangle_syscall
-	int		fd;
-#endif
-
-	initialize();
-#if !_mangle_syscall
-	if (r = (state.fs[FS_option].flags & FS_ON) != 0) state.fs[FS_option].flags &= ~FS_ON;
-	for (fd = 0; fd < OPEN_MAX; fd++)
-		if ((fds[0] = DUP(fd)) >= 0)
-		{
-			fds[1] = DUP(fds[0]);
-			CLOSE(fds[1]);
-			CLOSE(fds[0]);
-			break;
-		}
-	if (r) state.fs[FS_option].flags |= FS_ON;
-#endif
-	r = PIPE(fds);
-#if FS
-	if (!r && !state.in_2d)
-	{
-		Mount_t*	mp;
-
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_pipe))
-				fscall(mp, MSG_pipe, 0, fds);
-	}
-#endif
-	return(r);
-}
-
-#else
-
-NoN(pipe)
-
-#endif

+ 0 - 73
src/cmd/3d/read3d.c

@@ -1,73 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef	read3d
-
-ssize_t
-read3d(int fd, void* buf, size_t n)
-{
-	register ssize_t 	r;
-#if FS
-	Mount_t*		mp;
-	off_t			off;
-	int			pos = 0;
-	
-	if (!fscall(NiL, MSG_read, 0, fd, buf, n))
-		return(state.ret);
-	mp = monitored();
-#endif
-	r = READ(fd, buf, n);
-#if FS
-	if (r >= 0)
-	{
-		if (mp)
-		{
-			if (!pos)
-			{
-				pos = 1;
-				off = LSEEK(fd, 0, SEEK_CUR) - r;
-			}
-			fscall(mp, r, MSG_read3d, fd, buf, n, off);
-		}
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_read))
-			{
-				if (!pos)
-				{
-					pos = 1;
-					off = LSEEK(fd, 0, SEEK_CUR) - r;
-				}
-				fscall(mp, MSG_read3d, r, fd, buf, n, off);
-			}
-	}
-#endif
-	return(r);
-}
-
-#else
-
-NoN(read)
-
-#endif

+ 0 - 68
src/cmd/3d/readlink3d.c

@@ -1,68 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-ssize_t
-readlink3d(const char* path, char* buf, register size_t size)
-{
-	size_t		r;
-#if FS
-	Mount_t*	mp;
-#endif
-
-	if (state.in_2d)
-		return(READLINK(path, buf, size));
-#if FS
-	if (!fscall(NiL, MSG_readlink, 0, path, buf, size))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!pathreal(path, P_READLINK, NiL))
-		return(-1);
-
-	/*
-	 * see if link text is already in memory
-	 */
-
-	if (r = state.path.linksize)
-	{
-		if (r > state.path.linksize)
-			r = state.path.linksize;
-		memcpy(buf, state.path.linkname, r);
-#if FS
-		if (mp) fscall(mp, MSG_readlink, r, path, buf, size);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_readlink))
-				fscall(mp, MSG_readlink, r, path, buf, size);
-#endif
-		return(r);
-	}
-
-	/*
-	 * exists but not a symbolic link
-	 */
-
-	errno = EINVAL;
-	return(-1);
-}

+ 0 - 85
src/cmd/3d/rename3d.c

@@ -1,85 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-int
-rename3d(const char* path, const char* target)
-{
-	register char*	sp;
-	register int	r;
-	char*		t;
-	int		oerrno;
-	char		buf[PATH_MAX+1];
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_rename, 0, path, target))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_TOP|P_LSTAT, NiL)))
-		return(-1);
-	strncpy(buf, sp, PATH_MAX);
-	if (!(sp = pathreal(target, P_PATHONLY|P_NOOPAQUE, NiL)))
-		return(-1);
-	oerrno = errno;
-	if ((r = RENAME(buf, sp)) && errno == ENOENT && (t = strrchr(sp, '/')))
-	{
-		*t = 0;
-		r = fs3d_mkdir(sp, S_IRWXU|S_IRWXG|S_IRWXO);
-		*t = '/';
-		if (!r)
-		{
-			errno = oerrno;
-			r = RENAME(buf, sp);
-		}
-	}
-#if FS
-	if (!r)
-	{
-		if (mp)
-		{
-			if (sp != buf)
-			{
-				if (!(sp = pathreal(target, P_PATHONLY|P_NOOPAQUE|P_ABSOLUTE, NiL)))
-					return(r);
-				sp = strncpy(buf, sp, PATH_MAX);
-			}
-			fscall(mp, MSG_rename, 0, path, sp);
-		}
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_rename))
-			{
-				if (sp != buf)
-				{
-					if (!(sp = pathreal(target, P_PATHONLY|P_NOOPAQUE|P_ABSOLUTE, NiL)))
-						return(r);
-					sp = strncpy(buf, sp, PATH_MAX);
-				}
-				fscall(mp, MSG_rename, 0, path, sp);
-			}
-	}
-#endif
-	return(r);
-}

+ 0 - 133
src/cmd/3d/rmdir3d.c

@@ -1,133 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#include "dir_3d.h"
-
-static int
-rmfiles(char* path, char* endpath, ino_t ino)
-{
-	register DIRDIR*		dp;
-	register struct DIRdirent*	ep;
-	register char*			s;
-	register char*			t;
-	int				pass = 0;
-
-	*endpath = 0;
-	if (!(dp = OPENDIR(path))) return(0);
-	*endpath++ = '/';
-	for (;;)
-	{
-		if (!(ep = (struct DIRdirent*)READDIR(dp)))
-		{
-			if (pass++)
-			{
-				CLOSEDIR(dp);
-				return(1);
-			}
-			SEEKDIR(dp, 0L);
-		}
-		else
-		{
-#ifdef D_FILENO
-			if (D_FILENO(ep) != ino)
-#else
-			struct stat	st;
-
-			strcpy(endpath, ep->d_name);
-			if (STAT(path, &st)) break;
-			if (st.st_ino != ino)
-#endif
-			{
-				s = state.opaque;
-				t = ep->d_name;
-				while (*s && *s++ == *t) t++;
-				if (*s || *t) break;
-			}
-			else if (pass)
-			{
-#ifdef D_FILENO
-				strcpy(endpath, ep->d_name);
-#endif
-				if (UNLINK(path)) break;
-			}
-		}
-	}
-	CLOSEDIR(dp);
-	return(0);
-}
-
-int
-rmdir3d(const char* path)
-{
-	register char*	sp;
-	register int	r;
-	int		pass = 0;
-	struct stat	st;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_rmdir, 0, path))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_PATHONLY, NiL)))
-		return(-1);
-	if (state.path.level)
-		return(0);
- retry:
-	r = RMDIR(sp);
-	if (!r)
-	{
-#if FS
-		if (mp) fscall(mp, MSG_rmdir, 0, path);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_rmdir))
-				fscall(mp, MSG_rmdir, 0, path);
-#endif
-	}
-	else
-	{
-		if (errno == ENOENT && pathreal(path, 0, NiL))
-			return(0);
-		if (errno == ENOTEMPTY && !pass++)
-		{
-			register char*	slast = sp;
-
-			while (*slast) slast++;
-			*slast = '/';
-			strcpy(slast+1, state.opaque);
-			if (!LSTAT(sp, &st))
-			{
-				if (rmfiles(sp, slast, st.st_ino))
-				{
-					*slast = 0;
-					goto retry;
-				}
-			}
-			else errno = ENOTEMPTY;
-		}
-	}
-	return(r);
-}

+ 0 - 50
src/cmd/3d/sbrk3d.c

@@ -1,50 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef	sbrk3d
-
-void*
-sbrk3d(ssize_t i)
-{
-#if FS
-	register Mount_t*	mp;
-	void*			p;
-
-	initialize();
-	if ((p = SBRK(i)) != (void*)(-1))
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_break))
-				fscall(mp, MSG_break, 0, p);
-	return(p);
-#else
-	return(SBRK(i));
-#endif
-}
-
-#else
-
-NoN(sbrk)
-
-#endif

+ 0 - 138
src/cmd/3d/stat3d.c

@@ -1,138 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma noprototyped
-
-#include "3d.h"
-
-/* the 3 arg _xstat() disrupts our proto game -- every party needs one */
-#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
-int stat3d(const char* path, struct stat* st)
-#else
-#if defined(_STAT)
-int _stat(path, st) char* path; struct stat* st; { return stat(path, st); }
-#endif
-int stat(path, st) char* path; struct stat* st;
-#endif
-{
-	register char*	sp;
-#if FS
-	Mount_t*	mp;
-#endif
-#ifdef _3D_STAT_VER
-	struct stat*	so;
-	struct stat	sc;
-#endif
-
-#ifdef _3D_STAT_VER
-	if (_3d_ver != _3D_STAT_VER)
-	{
-		so = st;
-		st = &sc;
-	}
-#endif
-#if FS
-	if (!fscall(NiL, MSG_stat, 0, path, st))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, 0, st)))
-		return -1;
-	if (S_ISLNK(st->st_mode))
-	{
-#ifdef _3D_STAT_VER
-		if (st == &sc)
-			st = so;
-		if (XSTAT(_3d_ver, sp, st))
-			return -1;
-#ifdef _3D_STAT64_VER
-		if (_3d_ver == _3D_STAT64_VER)
-			IVIEW(((struct stat64*)st), state.path.level);
-		else
-#endif
-#else
-		if (STAT(sp, st))
-			return -1;
-#endif
-		IVIEW(st, state.path.level);
-	}
-#if FS
-	if (mp)
-		fscall(mp, MSG_stat, 0, state.path.name, st);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_stat))
-			fscall(mp, MSG_stat, 0, state.path.name, st);
-#endif
-#ifdef _3D_STAT_VER
-	if (st == &sc)
-	{
-		st = so;
-		if (XSTAT(_3d_ver, sp, st))
-			return -1;
-#ifdef _3D_STAT64_VER
-		if (_3d_ver == _3D_STAT64_VER)
-			IVIEW(((struct stat64*)st), state.path.level);
-		else
-#endif
-		IVIEW(st, state.path.level);
-	}
-#endif
-#if _mem_d_type_dirent
-	if (S_ISDIR(st->st_mode))
-		st->st_nlink = _3D_LINK_MAX;
-#endif
-	return 0;
-}
-
-#if defined(_LARGEFILE64_SOURCE) && defined(STAT643D) && !defined(_3D_STAT64_VER)
-
-int
-stat643d(const char* path, struct stat64* st)
-{
-	register char*	sp;
-	struct stat	ss;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_stat, 0, path, &ss))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, 0, &ss)))
-		return -1;
-	if (STAT64(sp, st))
-		return -1;
-	IVIEW(st, state.path.level);
-#if FS
-	if (mp)
-		fscall(mp, MSG_stat, 0, state.path.name, &ss);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_stat))
-			fscall(mp, MSG_stat, 0, state.path.name, &ss);
-#endif
-#if _mem_d_type_dirent
-	if (S_ISDIR(st->st_mode))
-		st->st_nlink = _3D_LINK_MAX;
-#endif
-	return 0;
-}
-
-#endif

+ 0 - 182
src/cmd/3d/statfs3d.c

@@ -1,182 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide statfs
-#else
-#define statfs        ______statfs
-#endif
-#define _def_syscall_3d	1
-
-#include "3d.h"
-
-#if defined(statfs3d) && ( _sys_statfs || _sys_vfs || _sys_mount && _mem_f_files_statfs )
-
-#include <cs_lib.h>
-
-#if _sys_statfs
-#include <sys/statfs.h>
-#else
-#if _sys_vfs
-#include <sys/vfs.h>
-#define _vfs_statfs	1
-#else
-#if _sys_mount
-#if _lib_getmntinfo
-#include <sys/param.h>		/* expect some macro redefinitions here */
-#endif
-#include <sys/mount.h>
-#endif
-#endif
-#endif
-
-#undef	_def_syscall_3d
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide statfs
-#else
-#undef  statfs
-#endif
-
-#include "FEATURE/syscall"
-
-#if _vfs_statfs
-#define VFS	(fs)
-#else
-#define VFS	(&vfs)
-#endif
-
-#if ARG3D_statfs == 4
-
-int
-statfs3d(const char* path, struct statfs* fs, int size, int type)
-{
-	register char*	sp;
-#if FS
-	Mount_t*	mp;
-#if !_vfs_statfs
-	struct statvfs	vfs;
-#endif
-
-	if (!fscall(NiL, MSG_statfs, 0, path, VFS, size, type))
-	{
-#if !_vfs_statfs
-		if (!state.ret)
-		{
-			memset(fs, 0, sizeof(*fs));
-			fs->f_bsize = vfs.f_bsize;
-			fs->f_blocks = vfs.f_blocks;
-			fs->f_bfree = vfs.f_bfree;
-			fs->f_files = vfs.f_files;
-			fs->f_ffree = vfs.f_ffree;
-		}
-#endif
-		return state.ret;
-	}
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, 0, NiL)))
-		return -1;
-	if (STATFS(sp, fs, size, type))
-		return -1;
-#if FS
-#if !_vfs_statfs
-	if (mp || state.global)
-	{
-		memset(&vfs, 0, sizeof(vfs));
-		vfs.f_bsize = fs->f_bsize;
-		vfs.f_blocks = fs->f_blocks;
-		vfs.f_bfree = fs->f_bfree;
-		vfs.f_files = fs->f_files;
-		vfs.f_ffree = fs->f_ffree;
-	}
-#endif
-	if (mp)
-		fscall(mp, MSG_statfs, 0, state.path.name, VFS, size, type);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_statfs))
-			fscall(mp, MSG_statfs, 0, state.path.name, VFS, size, type);
-#endif
-	return 0;
-}
-
-#else
-
-int
-statfs3d(const char* path, struct statfs* fs)
-{
-	register char*	sp;
-#if FS
-	Mount_t*	mp;
-#if !_vfs_statfs
-	struct statvfs	vfs;
-#endif
-
-	if (!fscall(NiL, MSG_statfs, 0, path, VFS))
-	{
-#if !_vfs_statfs
-		if (!state.ret)
-		{
-			memset(fs, 0, sizeof(*fs));
-			fs->f_bsize = vfs.f_bsize;
-			fs->f_blocks = vfs.f_blocks;
-			fs->f_bfree = vfs.f_bfree;
-			fs->f_files = vfs.f_files;
-			fs->f_ffree = vfs.f_ffree;
-		}
-#endif
-		return state.ret;
-	}
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, 0, NiL)))
-		return -1;
-	if (STATFS(sp, fs))
-		return -1;
-#if FS
-#if !_vfs_statfs
-	if (mp || state.global)
-	{
-		memset(&vfs, 0, sizeof(vfs));
-		vfs.f_bsize = fs->f_bsize;
-		vfs.f_blocks = fs->f_blocks;
-		vfs.f_bfree = fs->f_bfree;
-		vfs.f_files = fs->f_files;
-		vfs.f_ffree = fs->f_ffree;
-	}
-#endif
-	if (mp)
-		fscall(mp, MSG_statfs, 0, state.path.name, VFS);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_statfs))
-			fscall(mp, MSG_statfs, 0, state.path.name, VFS);
-#endif
-	return 0;
-}
-
-#endif
-
-#else
-
-NoN(statfs)
-
-#endif

+ 0 - 57
src/cmd/3d/statvfs3d.c

@@ -1,57 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if defined(statvfs3d) && defined(_sys_statvfs)
-
-int
-statvfs3d(const char* path, struct statvfs* fs)
-{
-	register char*	sp;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_statfs, 0, path, fs))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, 0, NiL)))
-		return(-1);
-	if (STATVFS(sp, fs))
-		return(-1);
-#if FS
-	if (mp)
-		fscall(mp, MSG_statfs, 0, state.path.name, fs);
-	for (mp = state.global; mp; mp = mp->global)
-		if (fssys(mp, MSG_statfs))
-			fscall(mp, MSG_statfs, 0, state.path.name, fs);
-#endif
-	return(0);
-}
-
-#else
-
-NoN(statvfs)
-
-#endif

+ 0 - 34
src/cmd/3d/std_3d.h

@@ -1,34 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-/*
- * std 3d symbol mappings
- *
- * NOTE: include once before std headers and once after
- *	 to make sure our slimey tricks win
- */
-
-#undef	remove
-#define remove		unlink
-
-#undef	sfsprintf
-#define sfsprintf	_3d_sfsprintf

+ 0 - 810
src/cmd/3d/strmatch.c

@@ -1,810 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2012 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * NOTE: obsolete strmatch() for 3d private use
- *	 -last strmatch() based on <regex.h> for external use
- */
-
-/*
- * D. G. Korn
- * G. S. Fowler
- * AT&T Research
- *
- * match shell file patterns -- derived from Bourne and Korn shell gmatch()
- *
- *	sh pattern	egrep RE	description
- *	----------	--------	-----------
- *	*		.*		0 or more chars
- *	?		.		any single char
- *	[.]		[.]		char class
- *	[!.]		[^.]		negated char class
- *	[[:.:]]		[[:.:]]		ctype class
- *	[[=.=]]		[[=.=]]		equivalence class
- *	[[...]]		[[...]]		collation element
- *	*(.)		(.)*		0 or more of
- *	+(.)		(.)+		1 or more of
- *	?(.)		(.)?		0 or 1 of
- *	(.)		(.)		1 of
- *	@(.)		(.)		1 of
- *	a|b		a|b		a or b
- *	\#				() subgroup back reference [1-9]
- *	a&b				a and b
- *	!(.)				none of
- *
- * \ used to escape metacharacters
- *
- *	*, ?, (, |, &, ), [, \ must be \'d outside of [...]
- *	only ] must be \'d inside [...]
- *
- * BUG: unbalanced ) terminates top level pattern
- *
- * BOTCH: collating element sort order and character class ranges apparently
- *	  do not have strcoll() in common so we resort to fnmatch(), calling
- *	  it up to COLL_MAX times to determine the matched collating
- *	  element size
- */
-
-#include <ast.h>
-#include <ctype.h>
-#include <hashkey.h>
-
-#undef	_lib_fnmatch	/* 3d */
-#undef	_lib_mbtowc	/* 3d */
-
-#define strgrpmatch	_3d_strgrpmatch
-
-#if _hdr_wchar && _lib_wctype && _lib_iswctype
-
-#include <stdio.h> /* because <wchar.h> includes it and we generate it */
-#include <wchar.h>
-#if _hdr_wctype
-#include <wctype.h>
-#endif
-
-#undef	isalnum
-#define isalnum(x)	iswalnum(x)
-#undef	isalpha
-#define isalpha(x)	iswalpha(x)
-#undef	iscntrl
-#define iscntrl(x)	iswcntrl(x)
-#undef	isblank
-#define isblank(x)	iswblank(x)
-#undef	isdigit
-#define isdigit(x)	iswdigit(x)
-#undef	isgraph
-#define isgraph(x)	iswgraph(x)
-#undef	islower
-#define islower(x)	iswlower(x)
-#undef	isprint
-#define isprint(x)	iswprint(x)
-#undef	ispunct
-#define ispunct(x)	iswpunct(x)
-#undef	isspace
-#define isspace(x)	iswspace(x)
-#undef	isupper
-#define isupper(x)	iswupper(x)
-#undef	isxdigit
-#define isxdigit(x)	iswxdigit(x)
-
-#if !defined(iswblank) && !_lib_iswblank
-
-static int
-iswblank(wint_t wc)
-{
-	static int	initialized;
-	static wctype_t	wt;
-
-	if (!initialized)
-	{
-		initialized = 1;
-		wt = wctype("blank");
-	}
-	return iswctype(wc, wt);
-}
-
-#endif
-
-#else
-
-#undef	_lib_wctype
-
-#ifndef	isblank
-#define	isblank(x)	((x)==' '||(x)=='\t')
-#endif
-
-#ifndef isgraph
-#define	isgraph(x)	(isprint(x)&&!isblank(x))
-#endif
-
-#endif
-
-#if _DEBUG_MATCH
-#include <error.h>
-#endif
-
-#define MAXGROUP	10
-
-typedef struct Group_s
-{
-	char*		beg[MAXGROUP];
-	char*		end[MAXGROUP];
-	char*		next_s;
-	short		groups;
-} Group_t;
-
-typedef struct Match_s
-{
-	Group_t		current;
-	Group_t		best;
-	char*		last_s;
-	char*		next_p;
-} Match_t;
-
-#if _lib_mbtowc && MB_LEN_MAX > 1
-#define mbgetchar(p)	((ast.locale.set&LC_SET_CTYPE)?((ast.tmp_int=mbtowc(&ast.tmp_wchar,p,MB_CUR_MAX))>=0?((p+=ast.tmp_int),ast.tmp_wchar):0):(*p++))
-#else
-#define mbgetchar(p)	(*p++)
-#endif
-
-#ifndef isxdigit
-#define isxdigit(c)	((c)>='0'&&(c)<='9'||(c)>='a'&&(c)<='f'||(c)>='A'&&(c)<='F')
-#endif
-
-#define getsource(s,e)	(((s)>=(e))?0:mbgetchar(s))
-
-#define COLL_MAX	3
-
-#if !_lib_strcoll
-#undef	_lib_fnmatch
-#endif
-
-#if _lib_fnmatch
-extern int		fnmatch(const char*, const char*, int);
-#endif
-
-/*
- * gobble chars up to <sub> or ) keeping track of (...) and [...]
- * sub must be one of { '|', '&', 0 }
- * 0 returned if s runs out
- */
-
-static char*
-gobble(Match_t* mp, register char* s, register int sub, int* g, int clear)
-{
-	register int	p = 0;
-	register char*	b = 0;
-	int		c = 0;
-	int		n;
-
-	for (;;)
-		switch (mbgetchar(s))
-		{
-		case '\\':
-			if (mbgetchar(s))
-				break;
-			/*FALLTHROUGH*/
-		case 0:
-			return 0;
-		case '[':
-			if (!b)
-			{
-				if (*s == '!')
-					mbgetchar(s);
-				b = s;
-			}
-			else if (*s == '.' || *s == '=' || *s == ':')
-				c = *s;
-			break;
-		case ']':
-			if (b)
-			{
-				if (*(s - 2) == c)
-					c = 0;
-				else if (b != (s - 1))
-					b = 0;
-			}
-			break;
-		case '(':
-			if (!b)
-			{
-				p++;
-				n = (*g)++;
-				if (clear)
-				{
-					if (!sub)
-						n++;
-					if (n < MAXGROUP)
-						mp->current.beg[n] = mp->current.end[n] = 0;
-				}
-			}
-			break;
-		case ')':
-			if (!b && p-- <= 0)
-				return sub ? 0 : s;
-			break;
-		case '|':
-			if (!b && !p && sub == '|')
-				return s;
-			break;
-		}
-}
-
-static int	grpmatch(Match_t*, int, char*, register char*, char*, int);
-
-#if _DEBUG_MATCH
-static long		test;
-
-#define return x)	do{error_info.indent--;return(x;}while(0)
-#endif
-
-/*
- * match a single pattern
- * e is the end (0) of the substring in s
- * r marks the start of a repeated subgroup pattern
- */
-
-static int
-onematch(Match_t* mp, int g, char* s, char* p, char* e, char* r, int flags)
-{
-	register int 	pc;
-	register int 	sc;
-	register int	n;
-	register int	icase;
-	char*		olds;
-	char*		oldp;
-
-#if _DEBUG_MATCH
-	error_info.indent++;
-	error(-1, "onematch g=%d s=%-.*s p=%s r=%p flags=%o", g, e - s, s, p, r, flags);
-#endif
-	icase = flags & STR_ICASE;
-	do
-	{
-		olds = s;
-		sc = getsource(s, e);
-		if (icase && isupper(sc))
-			sc = tolower(sc);
-		oldp = p;
-		switch (pc = mbgetchar(p))
-		{
-		case '(':
-		case '*':
-		case '?':
-		case '+':
-		case '@':
-		case '!':
-			if (pc == '(' || *p == '(')
-			{
-				char*	subp;
-				int	oldg;
-
-				s = olds;
-				subp = p + (pc != '(');
-				oldg = g;
-				n = ++g;
-				if (g < MAXGROUP && (!r || g > mp->current.groups))
-					mp->current.beg[g] = mp->current.end[g] = 0;
-				if (!(p = gobble(mp, subp, 0, &g, !r)))
-					return 0;
-				if (pc == '*' || pc == '?' || pc == '+' && oldp == r)
-				{
-					if (onematch(mp, g, s, p, e, NiL, flags))
-						return 1;
-					if (!sc || !getsource(s, e))
-					{
-						mp->current.groups = oldg;
-						return 0;
-					}
-				}
-				if (pc == '*' || pc == '+')
-				{
-					p = oldp;
-					sc = n - 1;
-				}
-				else
-					sc = g;
-				pc = (pc != '!');
-				do
-				{
-					if (grpmatch(mp, n, olds, subp, s, flags) == pc)
-					{
-						if (n < MAXGROUP)
-						{
-							if (!mp->current.beg[n] || mp->current.beg[n] > olds)
-								mp->current.beg[n] = olds;
-							if (s > mp->current.end[n])
-								mp->current.end[n] = s;
-#if _DEBUG_MATCH
-							error(-4, "subgroup#%d n=%d beg=%p end=%p len=%d", __LINE__, n, mp->current.beg[n], mp->current.end[n], mp->current.end[n] - mp->current.beg[n]);
-#endif
-						}
-						if (onematch(mp, sc, s, p, e, oldp, flags))
-						{
-							if (p == oldp && n < MAXGROUP)
-							{
-								if (!mp->current.beg[n] || mp->current.beg[n] > olds)
-									mp->current.beg[n] = olds;
-								if (s > mp->current.end[n])
-									mp->current.end[n] = s;
-#if _DEBUG_MATCH
-								error(-4, "subgroup#%d n=%d beg=%p end=%p len=%d", __LINE__, n, mp->current.beg[n], mp->current.end[n], mp->current.end[n] - mp->current.beg[n]);
-#endif
-							}
-							return 1;
-						}
-					}
-				} while (s < e && mbgetchar(s));
-				mp->current.groups = oldg;
-				return 0;
-			}
-			else if (pc == '*')
-			{
-				/*
-				 * several stars are the same as one
-				 */
-
-				while (*p == '*' && *(p + 1) != '(')
-					p++;
-				oldp = p;
-				switch (pc = mbgetchar(p))
-				{
-				case '@':
-				case '!':
-				case '+':
-					n = *p == '(';
-					break;
-				case '(':
-				case '[':
-				case '?':
-				case '*':
-					n = 1;
-					break;
-				case 0:
-				case '|':
-				case '&':
-				case ')':
-					mp->current.next_s = (flags & STR_MAXIMAL) ? e : olds;
-					mp->next_p = oldp;
-					mp->current.groups = g;
-					if (!pc && (!mp->best.next_s || (flags & STR_MAXIMAL) && mp->current.next_s > mp->best.next_s || !(flags & STR_MAXIMAL) && mp->current.next_s < mp->best.next_s))
-					{
-						mp->best = mp->current;
-#if _DEBUG_MATCH
-						error(-3, "best#%d groups=%d next=\"%s\"", __LINE__, mp->best.groups, mp->best.next_s);
-#endif
-					}
-					return 1;
-				case '\\':
-					if (!(pc = mbgetchar(p)))
-						return 0;
-					if (pc >= '0' && pc <= '9')
-					{
-						n = pc - '0';
-#if _DEBUG_MATCH
-						error(-2, "backref#%d n=%d g=%d beg=%p end=%p len=%d", __LINE__, n, g, mp->current.beg[n], mp->current.end[n], mp->current.end[n] - mp->current.beg[n]);
-#endif
-						if (n <= g && mp->current.beg[n])
-							pc = *mp->current.beg[n];
-					}
-					/*FALLTHROUGH*/
-				default:
-					if (icase && isupper(pc))
-						pc = tolower(pc);
-					n = 0;
-					break;
-				}
-				p = oldp;
-				for (;;)
-				{
-					if ((n || pc == sc) && onematch(mp, g, olds, p, e, NiL, flags))
-						return 1;
-					if (!sc)
-						return 0;
-					olds = s;
-					sc = getsource(s, e);
-					if ((flags & STR_ICASE) && isupper(sc))
-						sc = tolower(sc);
-				}
-			}
-			else if (pc != '?' && pc != sc)
-				return 0;
-			break;
-		case 0:
-			if (!(flags & STR_MAXIMAL))
-				sc = 0;
-			/*FALLTHROUGH*/
-		case '|':
-		case '&':
-		case ')':
-			if (!sc)
-			{
-				mp->current.next_s = olds;
-				mp->next_p = oldp;
-				mp->current.groups = g;
-			}
-			if (!pc && (!mp->best.next_s || (flags & STR_MAXIMAL) && olds > mp->best.next_s || !(flags & STR_MAXIMAL) && olds < mp->best.next_s))
-			{
-				mp->best = mp->current;
-				mp->best.next_s = olds;
-				mp->best.groups = g;
-#if _DEBUG_MATCH
-				error(-3, "best#%d groups=%d next=\"%s\"", __LINE__, mp->best.groups, mp->best.next_s);
-#endif
-			}
-			return !sc;
-		case '[':
-			{
-				/*UNDENT...*/
-
-	int	invert;
-	int	x;
-	int	ok = 0;
-	char*	range;
-
-	if (!sc)
-		return 0;
-#if _lib_fnmatch
-	if (ast.locale.set & LC_SET_COLLATE)
-		range = p - 1;
-	else
-#endif
-	range = 0;
-	n = 0;
-	if (invert = *p == '!')
-		p++;
-	for (;;)
-	{
-		oldp = p;
-		if (!(pc = mbgetchar(p)))
-			return 0;
-		else if (pc == '[' && (*p == ':' || *p == '=' || *p == '.'))
-		{
-			x = 0;
-			n = mbgetchar(p);
-			oldp = p;
-			for (;;)
-			{
-				if (!(pc = mbgetchar(p)))
-					return 0;
-				if (pc == n && *p == ']')
-					break;
-				x++;
-			}
-			mbgetchar(p);
-			if (ok)
-				/*NOP*/;
-			else if (n == ':')
-			{
-				switch (HASHNKEY5(x, oldp[0], oldp[1], oldp[2], oldp[3], oldp[4]))
-				{
-				case HASHNKEY5(5,'a','l','n','u','m'):
-					if (isalnum(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'a','l','p','h','a'):
-					if (isalpha(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'b','l','a','n','k'):
-					if (isblank(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'c','n','t','r','l'):
-					if (iscntrl(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'d','i','g','i','t'):
-					if (isdigit(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'g','r','a','p','h'):
-					if (isgraph(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'l','o','w','e','r'):
-					if (islower(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'p','r','i','n','t'):
-					if (isprint(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'p','u','n','c','t'):
-					if (ispunct(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'s','p','a','c','e'):
-					if (isspace(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(5,'u','p','p','e','r'):
-					if (icase ? islower(sc) : isupper(sc))
-						ok = 1;
-					break;
-				case HASHNKEY5(6,'x','d','i','g','i'):
-					if (oldp[5] == 't' && isxdigit(sc))
-						ok = 1;
-					break;
-#if _lib_wctype
-				default:
-					{
-						char	cc[32];
-
-						if (x >= sizeof(cc))
-							x = sizeof(cc) - 1;
-						strncpy(cc, oldp, x);
-						cc[x] = 0;
-						if (iswctype(sc, wctype(cc)))
-							ok = 1;
-					}
-					break;
-#endif
-				}
-			}
-#if _lib_fnmatch
-			else if (ast.locale.set & LC_SET_COLLATE)
-				ok = -1;
-#endif
-			else if (range)
-				goto getrange;
-			else if (*p == '-' && *(p + 1) != ']')
-			{
-				mbgetchar(p);
-				range = oldp;
-			}
-			else if (isalpha(*oldp) && isalpha(*olds) && tolower(*oldp) == tolower(*olds) || sc == mbgetchar(oldp))
-				ok = 1;
-			n = 1;
-		}
-		else if (pc == ']' && n)
-		{
-#if _lib_fnmatch
-			if (ok < 0)
-			{
-				char	pat[2 * UCHAR_MAX];
-				char	str[COLL_MAX + 1];
-
-				if (p - range > sizeof(pat) - 2)
-					return 0;
-				memcpy(pat, range, p - range);
-				pat[p - range] = '*';
-				pat[p - range + 1] = 0;
-				if (fnmatch(pat, olds, 0))
-					return 0;
-				pat[p - range] = 0;
-				ok = 0;
-				for (x = 0; x < sizeof(str) - 1 && olds[x]; x++)
-				{
-					str[x] = olds[x];
-					str[x + 1] = 0;
-					if (!fnmatch(pat, str, 0))
-						ok = 1;
-					else if (ok)
-						break;
-				}
-				s = olds + x;
-				break;
-			}
-#endif
-			if (ok != invert)
-				break;
-			return 0;
-		}
-		else if (pc == '\\' && (oldp = p, !(pc = mbgetchar(p))))
-			return 0;
-		else if (ok)
-			/*NOP*/;
-#if _lib_fnmatch
-		else if (range && !(ast.locale.set & LC_SET_COLLATE))
-#else
-		else if (range)
-#endif
-		{
-		getrange:
-#if _lib_mbtowc
-			if (ast.locale.set & LC_SET_CTYPE)
-			{
-				wchar_t	sw;
-				wchar_t	bw;
-				wchar_t	ew;
-				int	sz;
-				int	bz;
-				int	ez;
-
-				sz = mbtowc(&sw, olds, MB_CUR_MAX);
-				bz = mbtowc(&bw, range, MB_CUR_MAX);
-				ez = mbtowc(&ew, oldp, MB_CUR_MAX);
-				if (sw == bw || sw == ew)
-					ok = 1;
-				else if (sz > 1 || bz > 1 || ez > 1)
-				{
-					if (sz == bz && sz == ez && sw > bw && sw < ew)
-						ok = 1;
-					else
-						return 0;
-				}
-			}
-			if (!ok)
-#endif
-			if (icase && isupper(pc))
-				pc = tolower(pc);
-			x = mbgetchar(range);
-			if (icase && isupper(x))
-				x = tolower(x);
-			if (sc == x || sc == pc || sc > x && sc < pc)
-				ok = 1;
-			if (*p == '-' && *(p + 1) != ']')
-			{
-				mbgetchar(p);
-				range = oldp;
-			}
-			else
-				range = 0;
-			n = 1;
-		}
-		else if (*p == '-' && *(p + 1) != ']')
-		{
-			mbgetchar(p);
-#if _lib_fnmatch
-			if (ast.locale.set & LC_SET_COLLATE) ok = -1;
-			else
-#endif
-			range = oldp;
-			n = 1;
-		}
-		else
-		{
-			if (icase && isupper(pc))
-				pc = tolower(pc);
-			if (sc == pc)
-				ok = 1;
-			n = pc;
-		}
-	}
-
-				/*...INDENT*/
-			}
-			break;
-		case '\\':
-			if (!(pc = mbgetchar(p)))
-				return 0;
-			if (pc >= '0' && pc <= '9')
-			{
-				n = pc - '0';
-#if _DEBUG_MATCH
-				error(-2, "backref#%d n=%d g=%d beg=%p end=%p len=%d", __LINE__, n, g, mp->current.beg[n], mp->current.end[n], mp->current.end[n] - mp->current.beg[n]);
-#endif
-				if (n <= g && (oldp = mp->current.beg[n]))
-				{
-					while (oldp < mp->current.end[n])
-						if (!*olds || *olds++ != *oldp++)
-							return 0;
-					s = olds;
-					break;
-				}
-			}
-			/*FALLTHROUGH*/
-		default:
-			if (icase && isupper(pc))
-				pc = tolower(pc);
-			if (pc != sc)
-				return 0;
-			break;
-		}
-	} while (sc);
-	return 0;
-}
-
-/*
- * match any pattern in a group
- * | and & subgroups are parsed here
- */
-
-static int
-grpmatch(Match_t* mp, int g, char* s, register char* p, char* e, int flags)
-{
-	register char*	a;
-
-#if _DEBUG_MATCH
-	error_info.indent++;
-	error(-1, "grpmatch g=%d s=%-.*s p=%s flags=%o", g, e - s, s, p, flags);
-#endif
-	do
-	{
-		for (a = p; onematch(mp, g, s, a, e, NiL, flags); a++)
-			if (*(a = mp->next_p) != '&')
-				return 1;
-	} while (p = gobble(mp, p, '|', &g, 1));
-	return 0;
-}
-
-#if _DEBUG_MATCH
-#undef	return
-#endif
-
-/*
- * subgroup match
- * 0 returned if no match
- * otherwise number of subgroups matched returned
- * match group begin offsets are even elements of sub
- * match group end offsets are odd elements of sub
- * the matched string is from s+sub[0] up to but not
- * including s+sub[1]
- */
-
-static int
-strgrpmatch(const char* b, const char* p, ssize_t* sub, int n, int flags)
-{
-	register int	i;
-	register char*	s;
-	char*		e;
-	Match_t		match;
-
-	s = (char*)b;
-	match.last_s = e = s + strlen(s);
-	for (;;)
-	{
-		match.best.next_s = 0;
-		match.current.groups = 0;
-		if ((i = grpmatch(&match, 0, s, (char*)p, e, flags)) || match.best.next_s)
-		{
-			if (!i)
-				match.current = match.best;
-			match.current.groups++;
-			match.current.end[0] = match.current.next_s;
-#if _DEBUG_MATCH
-			error(-1, "match i=%d s=\"%s\" p=\"%s\" flags=%o groups=%d next=\"%s\"", i, s, p, flags, match.current.groups, match.current.next_s);
-#endif
-			break;
-		}
-		if ((flags & STR_LEFT) || s >= e)
-			return 0;
-		s++;
-	}
-	if ((flags & STR_RIGHT) && match.current.next_s != e)
-		return 0;
-	if (!sub)
-		return 1;
-	match.current.beg[0] = s;
-	s = (char*)b;
-	if (n > match.current.groups)
-		n = match.current.groups;
-	for (i = 0; i < n; i++)
-	{
-		sub[i * 2] = match.current.end[i] ? match.current.beg[i] - s : 0;
-		sub[i * 2 + 1] = match.current.end[i] ? match.current.end[i] - s : 0;
-	}
-	return n;
-}
-
-/*
- * compare the string s with the shell pattern p
- * returns 1 for match 0 otherwise
- */
-
-int
-strmatch(const char* s, const char* p)
-{
-	return strgrpmatch(s, p, NiL, 0, STR_MAXIMAL|STR_LEFT|STR_RIGHT);
-}

+ 0 - 89
src/cmd/3d/symlink3d.c

@@ -1,89 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-int
-symlink3d(const char* path, const char* target)
-{
-	register char*	sp;
-	register char*	tp;
-	register int	r;
-	char*		t;
-	int		oerrno;
-	char		buf[PATH_MAX + 1];
-#if FS
-	char		tmp[PATH_MAX + 1];
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_symlink, 0, path, target))
-		return(state.ret);
-#endif
-	if (!state.safe) sp = (char*)path;
-	else if (!(sp = pathreal(path, P_PATHONLY|P_SAFE, NiL))) return(-1);
-	else sp = strncpy(buf, sp, PATH_MAX);
-#if FS
-	mp = monitored();
-#endif
-	if (!(tp = pathreal(target, P_PATHONLY|P_NOOPAQUE, NiL)))
-		return(-1);
-	oerrno = errno;
-	if ((r = SYMLINK(sp, tp)) && errno == ENOENT && (t = strrchr(tp, '/')))
-	{
-		*t = 0;
-		r = fs3d_mkdir(tp, S_IRWXU|S_IRWXG|S_IRWXO);
-		*t = '/';
-		if (!r)
-		{
-			errno = oerrno;
-			r = SYMLINK(sp, tp);
-		}
-	}
-#if FS
-	if (!r)
-	{
-		if (mp)
-		{
-			if (tp != tmp)
-			{
-				if (!(tp = pathreal(target, P_PATHONLY|P_NOOPAQUE|P_ABSOLUTE, NiL)))
-					return(r);
-				tp = strncpy(tmp, tp, PATH_MAX);
-			}
-			fscall(mp, MSG_symlink, 0, sp, tp);
-		}
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_symlink))
-			{
-				if (tp != tmp)
-				{
-					if (!(tp = pathreal(target, P_PATHONLY|P_NOOPAQUE|P_ABSOLUTE, NiL)))
-						return(r);
-					tp = strncpy(tmp, tp, PATH_MAX);
-				}
-				fscall(mp, MSG_symlink, 0, sp, tp);
-			}
-	}
-#endif
-	return(r);
-}

+ 0 - 88
src/cmd/3d/sys.tab

@@ -1,88 +0,0 @@
-#
-# 3d system call intercept
-#
-# name # class # return type # arg prototype[s] # att # [bsd] # op ...
-#
-# NOTE: tab is the field separator, space is the subfield separator
-#
-#	if	test 1 = "$REPLICATE" -o 1 = "$SYSCALL3D"
-#	fi
-#
-_exit		exit	void		int				1
-access		nop	int		const char*, int		33
-acl		control	int		const char*, int, int, aclent_t*	185		sys/acl.h
-#brk		break	int		void*				17	0
-chdir		nop	int		const char*			12
-chmod		chmod	int		const char*, mode_t		15
-chown		chown	int		const char*, uid_t, gid_t	16
-close		close	int		int				6
-closedir	nop	int		DIR*
-creat		open	int		const char*, mode_t		8
-dup		dup	int		int				41
-dup2		dup	int		int, int			90
-execve		exec	int		const char*, char* const*, char* const*	59	59
-facl		control	int		int, int, int, aclent_t*	200		sys/acl.h
-fchdir		nop	int		int				147
-fchmod		chmod	int		int, mode_t			124
-fchown		chown	int		int, uid_t, gid_t		123
-fcntl		dup	int		int, int, ...			92
-fork		fork	pid_t		void				2
-fpathconf	pathconf	long		int, int			187	114
-fstat		stat	int		int, struct stat*		62			version	sys/stat.h
-fstatfs		statfs	int		int, struct statfs*, int, int	158	38		variant	int, struct statfs*	sys/statfs.h
-fstatvfs	statfs	int		int, struct statvfs*		201	104
-fsync		sync	int		int				95
-ftruncate	truncate	int		int, off_t			130
-getdents	getdents	ssize_t		int, void*, size_t		174
-kill		kill	int		pid_t, int			37
-link		link	int		const char*, const char*	9
-lseek		seek	off_t		int, off_t, int			19
-lstat		stat	int		const char*, struct stat*	48	88		alternate	stat								version	sys/stat.h
-mkdir		mkdir	int		const char*, mode_t		136	80
-mknod		mknod	int		const char*, mode_t, dev_t	14	version	sys/stat.h
-mount		mount	int		const char*, char*, int, void*, void*, void*	167	21
-open		open	int		const char*, int, ...		5
-opendir		nop	DIR*		const char*
-pathconf	pathconf	long		const char*, int		186	113
-pipe		pipe	bool		int*				42
-read		read	ssize_t		int, void*, size_t		3
-readdir		nop	struct dirent*	DIR*
-readlink	link	ssize_t		const char*, char*, size_t	58	90
-rename		rename	int		const char*, const char*	128	134
-rewinddir	nop	void		DIR*
-rmdir		rmdir	int		const char*			137	79
-#sbrk		break	void*		ssize_t				0	69
-seekdir		nop	void		DIR*, long	coupled	rewinddir telldir
-stat		stat	int		const char*, struct stat*	38	18		version	sys/stat.h
-statfs		statfs	int		const char*, struct statfs*, int, int	157	35	variant	const char*, struct statfs*	sys/statfs.h
-statvfs		statfs	int		const char*, struct statvfs*	202	103
-symlink		link	int		const char*, const char*	57	89
-telldir		nop	long		DIR*
-truncate	truncate	int		const char*, off_t		129	0
-unlink		remove	int		const char*			10
-utime		utime	int		const char*, const struct utimbuf*	30
-utimensat	utime	int		int, const char*, const struct timespec*, int	236	0
-utimes		utime	int		const char*, const struct timeval*	138	0
-utimets		utime	int		const char*, const struct timespec*	235	0
-vfork		fork	pid_t		void				66
-write		write	ssize_t		int, const void*, size_t	4
-#
-# now, these guys put padding in struct stat in preparation for 64 bit
-# dev_t,ino_t,off_t, and then ignored it, but even worse, the padding
-# was kept in struct stat64
-#
-fstat64		stat		int	int, struct stat64*		255			version	sys/stat.h
-ftruncate64	truncate	int	int, off64_t			255
-lseek64		seek		off64_t	int, off64_t, int		255
-lstat64		stat		int	const char*, struct stat64*	255			version	sys/stat.h
-open64		open		int	const char*, int, ...		255
-stat64		stat		int	const char*, struct stat64*	255			version	sys/stat.h
-truncate64	truncate	int	const char*, off64_t		255
-#
-# dir got into the act too
-#
-getdents64	getdents	ssize_t		int, void*, size_t	255
-readdir64	nop		struct dirent64*	DIR*
-rewinddir64	nop		void		DIR*
-seekdir64	nop		void		DIR*, off64_t	coupled	rewinddir64 telldir64
-telldir64	nop		off64_t		DIR*

+ 0 - 716
src/cmd/3d/syscall3d.c

@@ -1,716 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2012 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * 3d system call trace
- */
-
-#define SYSTRACE3D	1
-
-#include "3d.h"
-
-#if SYSTRACE3D
-
-#define SYSCALL		syscall3d
-
-#include "dir_3d.h"
-
-#ifndef D_FILENO
-#define D_FILENO(d)	(1)
-#endif
-#ifndef D_TYPE
-#define D_TYPE(d)	(0)
-#endif
-
-#define C_EXIT		(MSG_MASK(MSG_exit))
-#define C_IO		(MSG_MASK(MSG_read)|MSG_MASK(MSG_write))
-#define C_ZERO		(MSG_MASK(MSG_pipe))
-
-typedef union
-{
-	void*		pointer;
-	int		number;
-	char*		string;
-	char**		vector;
-} ARG;
-
-static void*	dll;
-
-#if _lib_strerror
-
-#undef	strerror	/* otherwise it's _ast_strerror */
-
-#else
-
-extern int	sys_nerr;
-extern char*	sys_errlist[];
-
-char*
-strerror(int err)
-{
-	static char	msg[28];
-
-	if (err > 0 && err <= sys_nerr)
-		return sys_errlist[err];
-	sfsprintf(msg, sizeof(msg), "Error %d", err);
-	return msg;
-}
-
-#endif
-
-#define MAXBUF	128
-#define MAXLIN	79
-#define MAXOUT	2048
-
-static void
-buffer(char** buf, char* end, register char* s, int n)
-{
-	register char*	b;
-	register char*	be;
-	register char*	se;
-	register int	c;
-
-	if (n < 0)
-		bprintf(buf, end, " %p", s);
-	else
-	{
-		b = *buf;
-		be = end;
-		if (be - b > MAXBUF)
-			be = b + MAXBUF;
-		be -= 5;
-		be = be;
-		se = s + n;
-		if (b < be - 1)
-		{
-			*b++ = ' ';
-			*b++ = '"';
-			while (b < be && s < se)
-			{
-				if ((c = *((unsigned char*)s++)) < 040)
-				{
-					*b++ = '\\';
-					switch (c)
-					{
-					case '\007':
-						c = 'a';
-						break;
-					case '\b':
-						c = 'b';
-						break;
-					case '\f':
-						c = 'f';
-						break;
-					case '\n':
-						c = 'n';
-						break;
-					case '\r':
-						c = 'r';
-						break;
-					case '\t':
-						c = 't';
-						break;
-					case '\013':
-						c = 'v';
-						break;
-					case '\033':
-						c = 'E';
-						break;
-					default:
-						if (b < be - 3)
-						{
-							if (n = s < se && c >= '0' && c <= '9')
-								*b++ = '0';
-							if (n || ((c >> 3) & 07))
-								*b++ = '0' + ((c >> 3) & 07);
-							*b++ = '0' + (c & 07);
-						}
-						continue;
-					}
-					if (b < be)
-						*b++ = c;
-				}
-				else if (c < 0177)
-					*b++ = c;
-				else if (c == 0177)
-				{
-					*b++ = '^';
-					if (b >= be)
-						break;
-					*b++ = '?';
-				}
-				else if (b < be - 4)
-				{
-					*b++ = '\\';
-					*b++ = '0' + ((c >> 6) & 03);
-					*b++ = '0' + ((c >> 3) & 07);
-					*b++ = '0' + (c & 07);
-				}
-			}
-			if ((b >= be || s < se) && (be - *buf) >= 4)
-			{
-				b -= 4;
-				*b++ = '"';
-				*b++ = '.';
-				*b++ = '.';
-				*b++ = '.';
-			}
-			else if (b < be)
-				*b++ = '"';
-		}
-		*buf = b;
-	}
-}
-
-#if __gnu_linux__
-#undef	_no_exit_exit
-#endif
-
-#if _lib_syscall && _sys_syscall
-
-#include <sys/syscall.h>
-
-#ifdef SYS_exit
-
-static void
-sys_exit(int code)
-{
-	syscall(SYS_exit, code);
-}
-
-#define SYS_EXIT	sys_exit
-
-#endif
-
-#endif
-
-/*
- * initialize the 3d syscall table
- */
-
-void
-callinit(void)
-{
-	register Systrace_t*	cp;
-
-#if defined(__sgi) && defined(_ABIO32)
-	sys_trace[0].name = "_exit";
-#endif
-#if sun && !_sun && _lib_on_exit
-	sys_trace[0].name = "__exit";
-#endif
-	if (dll = dllnext(RTLD_LAZY))
-	{
-		for (cp = sys_trace; cp < &sys_trace[elementsof(sys_trace)]; cp++)
-			if (!(cp->func = (Sysfunc_t)dlsym(dll, cp->name)) && (*cp->name != '_' || !(cp->func = (Sysfunc_t)dlsym(dll, cp->name + 1)) || !*cp->name++))
-				cp->func = (Sysfunc_t)nosys;
-#if !defined(SYS_EXIT) && _no_exit_exit
-		state.libexit = (Exitfunc_t)dlsym(dll, "exit");
-#endif
-	}
-#ifdef SYS_EXIT
-	sys_trace[0].func = (Sysfunc_t)sys_exit;
-#endif
-}
-
-/*
- * dump the 3d syscall table
- */
-
-void
-calldump(char** b, char* e)
-{
-	register Systrace_t*	cp;
-	register int		m;
-
-	bprintf(b, e, "\nsystem calls total=%d nosys=%p exit=%p\n\n", elementsof(sys_trace), nosys,
-#if _no_exit_exit
-		state.libexit
-#else
-		(Sysfunc_t)0
-#endif
-		);
-	for (cp = sys_trace; cp < &sys_trace[elementsof(sys_trace)]; cp++)
-	{
-		bprintf(b, e, "  %03d%s %03d %12s", cp - sys_trace, (cp - sys_trace) == cp->index ? " " : "*", cp->call, cp->name);
-		for (m = state.trap.size - 1; m >= 0; m--)
-			if (MSG_MASK(cp->call) & state.trap.intercept[m].mask)
-				bprintf(b, e, " %p[%d]", state.trap.intercept[m].call, m);
-		bprintf(b, e, " %p\n", cp->func);
-	}
-}
-
-#if _no_exit_exit
-static int
-oksys(void)
-{
-	return 0;
-}
-
-void
-exit(int code)
-{
-	if (state.libexit)
-		sys_trace[SYS3D_exit].func = (Sysfunc_t)oksys;
-	_exit(code);
-	if (state.libexit)
-	{
-		(*state.libexit)(code);
-		state.libexit = 0;
-	}
-}
-#endif
-
-Sysfunc_t
-sysfunc(int call)
-{
-	initialize();
-	return sys_trace[call].func;
-}
-
-#if !_var_syscall
-long
-syscall3d(int call, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6)
-{
-#if 0 /* to convince proto */
-}
-#endif
-#else
-long
-syscall3d(int call, ...)
-{
-#endif
-	register int		n;
-	register long		r;
-	register Systrace_t*	cp;
-	register ARG*		ap;
-	register int		ac;
-	int			a;
-	int			m;
-	int			on;
-	char*			b;
-	char*			e;
-	char*			t;
-	char**			p;
-	int*			ip;
-	ARG			arg[7];
-	char			buf[MAXOUT];
-	Sysfunc_t		func;
-#if _var_syscall
-	va_list			vp;
-#endif
-
-	initialize();
-#if _var_syscall
-	va_start(vp, call);
-#endif
-	cp = sys_trace + call;
-#if _var_syscall
-	n = cp->args;
-	for (r = 1; r <= elementsof(arg); r++)
-		arg[r].pointer = (r <= n) ? va_arg(vp, void*) : (void*)0;
-	va_end(vp);
-#else
-	switch (cp->args)
-	{
-	case 6: arg[6].pointer = a6;
-	case 5: arg[5].pointer = a5;
-	case 4: arg[4].pointer = a4;
-	case 3: arg[3].pointer = a3;
-	case 2: arg[2].pointer = a2;
-	case 1: arg[1].pointer = a1;
-	}
-#endif
-	if (state.kernel || state.trace.pid <= 1 || (on = fsfd(&state.fs[FS_option])) <= 0 || !(state.test & 0100) && !(MSG_MASK(cp->call) & (state.trace.call & ~MSG_MASK(error_info.trace ? 0 : MSG_nop))))
-		on = 0;
-	else
-	{
-		state.kernel++;
-		if (!state.trace.count)
-		{
-			e = (b = buf) + elementsof(buf) - 1;
-			if (state.trace.pid > 2)
-				bprintf(&b, e, "[%d] ", state.trace.pid);
-			bprintf(&b, e, "%s (", cp->name);
-			a = A_INPUT;
-			if (call == SYS3D_write)
-			{
-				if ((m = arg[1].number) == on)
-					a = 0;
-				else if (m == 1 || m == 2)
-				{
-					struct stat	st;
-
-					n = errno;
-					if (!fstat(m, &st) && st.st_ino == state.fs[FS_option].st.st_ino && st.st_dev == state.fs[FS_option].st.st_dev)
-						a = 0;
-					errno = n;
-				}
-			}
-			if ((state.test & 020) && call == SYS3D_close) bprintf(&b, e, "%s%s%s", state.file[arg[1].number].reserved ? " [RESERVED]" : "", arg[1].number == TABLE_FD ? " [TABLE]" : "", arg[1].number == state.table.fd ? " [table]" : "");
-			for (ac = 1; ac <= cp->args && (n = cp->type[ac]) >= a; ac++)
-			{
-				ap = &arg[ac];
-				switch (n)
-				{
-				case A_INPUT:
-					if (a)
-					{
-						buffer(&b, e, ap->string, arg[ac + 1].number);
-						break;
-					}
-					/*FALLTHROUGH*/
-				case A_OUTPUT:
-				case A_POINTER:
-					bprintf(&b, e, " %p", ap->number);
-					break;
-				case A_MODE:
-					bprintf(&b, e, " 0%o", ap->number);
-					break;
-				case A_STRING:
-					if (t = ap->string)
-						buffer(&b, e, t, strlen(t));
-					else
-						bprintf(&b, e, " (null)");
-					break;
-				case A_VECTOR:
-					bprintf(&b, e, " [");
-					for (p = ap->vector; *p && p < ap->vector + 8; p++)
-						buffer(&b, e, *p, strlen(*p));
-					if (*p)
-						bprintf(&b, e, "...");
-					bprintf(&b, e, " ]");
-					break;
-				default:
-					bprintf(&b, e, " %d", ap->number);
-					break;
-				}
-			}
-			if (!a)
-				*b++ = '\n';
-			else if (MSG_MASK(cp->call) & C_EXIT)
-			{
-				bprintf(&b, e, " ) = ?\n");
-				state.kernel++;
-			}
-			n = errno;
-			write(on, buf, b - buf);
-			errno = n;
-		}
-		else
-		{
-			if (MSG_MASK(cp->call) & C_EXIT)
-			{
-				e = (b = buf) + elementsof(buf) - 1;
-				*b++ = '\n';
-				if (state.trace.pid > 2)
-					bprintf(&b, e, "         [%d] %s\n", state.trace.pid, state.cmd);
-				for (n  = 0; n < elementsof(sys_trace); n++)
-					if (sys_trace[n].count)
-					{
-						if (MSG_MASK(sys_trace[n].call) & C_IO)
-						{
-							bprintf(&b, e, "   %5d %-10s", sys_trace[n].count, sys_trace[n].name);
-							if (sys_trace[n].megs)
-								bprintf(&b, e, "%5lu.%dm", sys_trace[n].megs, (sys_trace[n].units * 10) >> 20);
-							else
-								bprintf(&b, e, "%5lu.%dk", sys_trace[n].units >> 10, ((sys_trace[n].units & ((1<<10)-1)) * 10) >> 10);
-						}
-						else
-							bprintf(&b, e, "   %5d %s", sys_trace[n].count, sys_trace[n].name);
-						if (b < e)
-							*b++ = '\n';
-					}
-				*b++ = '\n';
-				n = errno;
-				write(on, buf, b - buf);
-				errno = n;
-				state.kernel++;
-			}
-			cp->count++;
-		}
-	}
-	for (m = state.trap.size - 1; m >= 0; m--)
-		if (MSG_MASK(cp->call) & state.trap.intercept[m].mask)
-			break;
-	if (m >= 0)
-	{
-		n = state.trap.size;
-		state.trap.size = m;
-		r = (*state.trap.intercept[m].call)(&state.trap.intercept[m], cp->call, call, arg[1].pointer, arg[2].pointer, arg[3].pointer, arg[4].pointer, arg[5].pointer, arg[6].pointer);
-		state.trap.size = n;
-	}
-	else
-	{
-#if _dynamic_syscall || _static_syscall
-#if _dynamic_syscall
-		if (dll && cp->func)
-#else
-		if (dll && cp->func && cp->index < 0)
-#endif
-		{
-			switch (cp->active++)
-			{
-			case 0:
-				func = cp->func;
-				break;
-			case 1:
-				if (!(func = cp->last))
-				{
-					if (!(cp->last = (Sysfunc_t)dlsym(dll, cp->name)) && (*cp->name != '_' || !(cp->last = (Sysfunc_t)dlsym(dll, cp->name + 1)) || !*cp->name++))
-						cp->last = (Sysfunc_t)nosys;
-					func = cp->last;
-					if (func == cp->func)
-					{
-						/*
-						 * longjmp gets you here
-						 */
-
-						cp->active = 3;
-					}
-					else if (cp->func != (Sysfunc_t)nosys && func == (Sysfunc_t)nosys)
-					{
-						cp->active = 10;
-						e = (b = buf) + elementsof(buf) - 1;
-						bprintf(&b, e, "3d: %s: system call loop -- cannot determine the real system call\n", cp->name);
-						write(2, buf, b - buf);
-					}
-				}
-				break;
-			case 2:
-			case 3:
-				cp->active = 3;
-				func = cp->func;
-				break;
-			default:
-				cp->active = 10;
-				func = (Sysfunc_t)nosys;
-				break;
-			}
-			r = (*func)(arg[1].pointer, arg[2].pointer, arg[3].pointer, arg[4].pointer, arg[5].pointer, arg[6].pointer);
-			cp->active--;
-		}
-		else
-#endif
-#if _lib_syscall
-		if (cp->index >= 0)
-			r = syscall(cp->index, arg[1].pointer, arg[2].pointer, arg[3].pointer, arg[4].pointer, arg[5].pointer, arg[6].pointer);
-		else if (cp->nov >= 0)
-			r = syscall(cp->nov, arg[2].pointer, arg[3].pointer, arg[4].pointer, arg[5].pointer, arg[6].pointer, 0);
-		else
-#endif
-		{
-#ifndef ENOSYS
-#define ENOSYS	EINVAL
-#endif
-			errno = ENOSYS;
-			r = -1;
-		}
-	}
-#if !_mangle_syscall
-	if (r > 0 && (MSG_MASK(cp->call) & C_ZERO))
-		r = 0;
-#endif
-	if (on && state.kernel <= 1)
-	{
-		if (!state.trace.count)
-		{
-			if ((m = MAXLIN - (b - buf)) < 0)
-				m = 0;
-			b = buf;
-			for (; ac <= cp->args; ac++)
-			{
-				ap = &arg[ac];
-				switch (n = cp->type[ac])
-				{
-				case A_OUTPUT:
-					switch (call)
-					{
-					case SYS3D_fstat:
-#ifdef SYS3D_lstat
-					case SYS3D_lstat:
-#endif
-					case SYS3D_stat:
-						if (!r)
-						{
-							/*UNDENT...*/
-#ifdef _3D_STAT_VER
-	switch (arg[1].number)
-	{
-	case _3D_STAT_VER:
-#endif
-		{
-			struct stat*	sp = (struct stat*)ap->pointer;
-			bprintf(&b, e, " [ dev=%d ino=%d view=%d mode=0%o nlink=%d uid=%d gid=%d size=%u atime=%u mtime=%u ctime=%u ]", sp->st_dev, sp->st_ino, iview(sp), sp->st_mode, sp->st_nlink, sp->st_uid, sp->st_gid, sp->st_size, sp->st_atime, sp->st_mtime, sp->st_ctime);
-			continue;
-		}
-#ifdef _3D_STAT_VER
-#ifdef _3D_STAT64_VER
-	case _3D_STAT64_VER:
-		{
-			struct stat64*	sp = (struct stat64*)ap->pointer;
-			bprintf(&b, e, " [ dev=%d ino=%lld view=%d mode=0%o nlink=%d uid=%d gid=%d size=%llu atime=%u mtime=%u ctime=%u ]", sp->st_dev, sp->st_ino, iview(sp), sp->st_mode, sp->st_nlink, sp->st_uid, sp->st_gid, sp->st_size, sp->st_atime, sp->st_mtime, sp->st_ctime);
-			continue;
-		}
-#endif
-	}
-#endif
-						}
-						break;
-#ifdef SYS3D_getdents
-					case SYS3D_getdents:
-						if (r > 0)
-						{
-							struct DIRdirent*	dp = (struct DIRdirent*)ap->pointer;
-							struct DIRdirent*	de = (struct DIRdirent*)((char*)dp + r);
-
-							bprintf(&b, e, " [");
-							while (dp < de)
-							{
-#ifdef DIRdirent
-								bprintf(&b, e, " %lu \"%s\"", D_FILENO(dp), dp->d_name);
-#else
-								bprintf(&b, e, " %02d %lu \"%s\"", D_TYPE(dp), D_FILENO(dp), dp->d_name);
-#endif
-								dp = (struct DIRdirent*)((char*)dp + dp->d_reclen);
-							}
-							bprintf(&b, e, " ]");
-							continue;
-						}
-						break;
-#endif
-					case SYS3D_pipe:
-						if (!r)
-						{
-							ip = (int*)ap->pointer;
-							bprintf(&b, e, " [ %d %d ]", ip[0], ip[1]);
-							continue;
-						}
-						break;
-					}
-					/*FALLTHROUGH*/
-				case A_INPUT:
-					if (n == A_OUTPUT && cp->type[n = 0] == A_SIZE || ac < (elementsof(cp->type) - 1) && cp->type[n = ac + 1] == A_SIZE)
-					{
-						buffer(&b, e, ap->string, n ? arg[n].number : r);
-						break;
-					}
-					goto pointer;
-				case A_MODE:
-					bprintf(&b, e, " 0%o", ap->number);
-					break;
-				case A_POINTER:
-				pointer:
-					bprintf(&b, e, " %p", ap->pointer);
-					break;
-				case A_STRING:
-					if (r == -1)
-						goto pointer;
-					buffer(&b, e, ap->string, strlen(ap->string));
-					break;
-				default:
-					bprintf(&b, e, " %d", ap->number);
-					break;
-				}
-			}
-#if DEBUG_dirent
-			switch (call)
-			{
-#ifdef SYS3D_readdir
-#undef	DIRdirent
-			case SYS3D_readdir:
-				if (r && (state.test & 0100))
-				{
-					struct DIRdirent*	dp = (struct DIRdirent*)pointerof(r);
-
-					bprintf(&b, e, " ) = [ %02d %lu \"%s\" ]", D_TYPE(dp), D_FILENO(dp), dp->d_name);
-					break;
-				}
-				goto number;
-#endif
-#ifdef SYS3D_readdir64
-			case SYS3D_readdir64:
-				if (r && (state.test & 0100))
-				{
-					struct dirent64*	dp = (struct dirent64*)pointerof(r);
-
-					bprintf(&b, e, " ) = [ %02d %llu \"%s\" ]", D_TYPE(dp), D_FILENO(dp), dp->d_name);
-					break;
-				}
-				goto number;
-#endif
-			default:
-			number:
-				bprintf(&b, e, "%s) = %d", a ? " " : "\t", r);
-				break;
-			}
-#else
-			bprintf(&b, e, "%s) = %d", a ? " " : "\t", r);
-#endif
-			if (r == -1)
-				bprintf(&b, e, " [%s]", strerror(errno));
-			n = errno;
-			t = buf;
-			while ((b - t) >= m)
-			{
-				char*	w;
-				char*	x;
-				char*	z;
-				int	c1;
-				int	c2;
-
-				x = w = t + m;
-				z = t + m / 2;
-				while (x > z && *x != ' ') x--;
-				if (x <= z)
-					x = w;
-				c1 = *x;
-				*x++ = '\n';
-				c2 = *x;
-				*x++ = '\t';
-				write(on, t, x - t);
-				*--x = c2;
-				if ((*--x = c1) == ' ')
-					x++;
-				t = x;
-				m = MAXLIN - 8;
-			}
-			*b++ = '\n';
-			write(on, t, b - t);
-			errno = n;
-		}
-		else if (r >= 0 && (MSG_MASK(cp->call) & C_IO) && (cp->units += r) >= (1<<20))
-		{
-			cp->megs += cp->units >> 20;
-			cp->units &= ((1<<20)-1);
-		}
-		state.kernel--;
-	}
-	return r;
-}
-
-#else
-
-NoN(syscall)
-
-#endif

+ 0 - 47
src/cmd/3d/sysent3d.c

@@ -1,47 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * any 3d library function `declaring' PULL_IN_3D will pull in all of 3d
- * exit seems to be the best candidate
- *
- * guess where bsd4.4 puts the lseek prototype
- */
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide lseek
-#else
-#define lseek        ______lseek
-#endif
-
-#include <sys/types.h>
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide lseek
-#else
-#undef  lseek
-#endif
-
-#define SYSENT3D	1
-
-#include "FEATURE/syscall"

+ 0 - 194
src/cmd/3d/touch.c

@@ -1,194 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2012 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * NOTE: obsolete touch() for 3d private use
- *	 -last touch() handles subsecond times
- *	 via tvtouch()
- */
-
-/*
- * Glenn Fowler
- * AT&T Research
- *
- * touch file access and modify times of file
- * if force>0 then file will be created if it doesn't exist
- * if force<0 then times are taken verbatim
- * times have one second granularity
- *
- *	(time_t)(-1)	retain old time
- *	0		use current time
- */
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide utime
-#else
-#define utime		______utime
-#endif
-
-#include <ast.h>
-#include <ls.h>
-#include <times.h>
-#include <error.h>
-
-#if _hdr_utime && _lib_utime
-#include <utime.h>
-#endif
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide utime
-#else
-#undef	utime
-#endif
-
-#if _lib_utime
-#if _hdr_utime
-extern int	utime(const char*, const struct utimbuf*);
-#else
-extern int	utime(const char*, const time_t*);
-#endif
-#endif
-
-int
-touch(const char* file, time_t atime, time_t mtime, int force)
-{
-	int		n;
-	int		fd;
-	int		oerrno = errno;
-	int		mode;
-#if _lib_utime
-	time_t		now;
-	struct stat	st;
-#if _hdr_utime
-	struct utimbuf	ut;
-#else
-	time_t		ut[2];
-#endif
-
-	if (force >= 0)
-	{
-		if (atime == (time_t)(-1) || mtime == (time_t)(-1))
-		{
-			if (stat(file, &st)) st.st_atime = st.st_mtime = 0;
-			if (atime == (time_t)(-1)) atime = st.st_atime;
-			if (mtime == (time_t)(-1)) mtime = st.st_mtime;
-		}
-		if (!atime || !mtime)
-#if _hdr_utime && _lib_utime_now
-		if (atime || mtime)
-#endif
-		{
-			time(&now);
-			if (!atime) atime = now;
-			if (!mtime) mtime = now;
-		}
-	}
-#if _hdr_utime
-	ut.actime = atime;
-	ut.modtime = mtime;
-#if _lib_utime_now
-	n = utime(file, (force < 0 || atime || mtime) ? &ut : (struct utimbuf*)0);
-#else
-	n = utime(file, &ut);
-#endif
-#else
-	ut[0] = atime;
-	ut[1] = mtime;
-	n = utime(file, ut);
-#endif
-	if (n)
-#else
-	if (mtime)
-	{
-		/*
-		 * NOTE: the emulation allows atime to change
-		 *	 for mtime only requests
-		 */
-
-		errno = EINVAL;
-		return(-1);
-	}
-#endif
-	{
-#if _lib_utime
-		if (errno == ENOENT || errno == EPERM)
-#else
-
-		if (access(file, F_OK))
-#endif
-		{
-			if (!force) return(-1);
-			umask(mode = umask(0));
-			mode = (~mode) & (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
-			if ((fd = open(file, O_WRONLY|O_CREAT|O_TRUNC|O_cloexec, mode)) < 0) return(-1);
-			close(fd);
-			errno = oerrno;
-#if _lib_utime
-#if _hdr_utime
-#if _lib_utime_now
-			return((force < 0 || atime || mtime) ? utime(file, &ut) : 0);
-#else
-			return(0);
-#endif
-#else
-			return((atime != now || mtime != now) ? utime(file, ut) : 0);
-#endif
-#else
-			return(0);
-#endif
-		}
-#if !_hdr_utime || !_lib_utime
-#if _lib_utime
-		if (atime == now && mtime == now && (fd = open(file, O_RDWR|O_cloexec)) >= 0)
-#else
-		if ((fd = open(file, O_RDWR|O_cloexec)) >= 0)
-#endif
-		{
-			char	c;
-
-			if (read(fd, &c, 1) == 1)
-			{
-				if (lseek(fd, 0L, 0) == 0L && write(fd, &c, 1) == 1)
-				{
-					errno = oerrno;
-					n = 0;
-				}
-				close(fd);
-			}
-			else
-			{
-				close(fd);
-				umask(mode = umask(0));
-				mode = (~mode) & (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
-				if ((fd = open(file, O_WRONLY|O_CREAT|O_TRUNC|O_cloexec, mode)) >= 0)
-				{
-					close(fd);
-					errno = oerrno;
-					n = 0;
-				}
-			}
-		}
-#endif
-	}
-	return(n);
-}

+ 0 - 113
src/cmd/3d/truncate3d.c

@@ -1,113 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#ifdef truncate3d
-
-#if !_nosys_truncate64 && _typ_off64_t
-
-#undef	off_t
-#undef	ftruncate
-
-typedef int (*Real_f)(const char*, off64_t);
-
-int
-truncate643d(const char* path, off64_t size)
-{
-	register char*	sp;
-	register int	r;
-	int		n;
-	int		m;
-	static Real_f	realf;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_truncate, 0, path, size))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_TOP, NiL)))
-		return -1;
-	if (!realf)
-		realf = (Real_f)sysfunc(SYS3D_truncate64);
-	for (m = state.trap.size - 1; m >= 0; m--)
-		if (MSG_MASK(MSG_truncate) & state.trap.intercept[m].mask)
-			break;
-	if (m >= 0)
-	{
-		n = state.trap.size;
-		state.trap.size = m;
-		r = (*state.trap.intercept[m].call)(&state.trap.intercept[m], MSG_truncate, SYS3D_truncate64, (void*)sp, (void*)&size, NiL, NiL, NiL, NiL);
-		state.trap.size = n;
-	}
-	else
-		r = (*realf)(sp, size);
-#if FS
-	if (!r)
-	{
-		if (mp)
-			fscall(mp, MSG_truncate, 0, path, size);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_truncate))
-				fscall(NiL, MSG_truncate, 0, path, size);
-	}
-#endif
-	return r;
-}
-
-#endif
-
-int
-truncate3d(const char* path, off_t size)
-{
-	register char*	sp;
-	register int	r;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_truncate, 0, path, size))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_TOP, NiL)))
-		return -1;
-	r = TRUNCATE(sp, size);
-#if FS
-	if (!r)
-	{
-		if (mp)
-			fscall(NiL, MSG_truncate, 0, path, size);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_truncate))
-				fscall(NiL, MSG_truncate, 0, path, size);
-	}
-#endif
-	return r;
-}
-
-#else
-
-NoN(truncate)
-
-#endif

+ 0 - 77
src/cmd/3d/unlink3d.c

@@ -1,77 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-int
-unlink3d(register const char* path)
-{
-	register char*	sp;
-	register int	r;
-#if FS
-	Mount_t*	mp;
-
-	if (!fscall(NiL, MSG_remove, 0, path))
-		return state.ret;
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_PATHONLY|P_SAFE, NiL)))
-		return -1;
-	if (state.path.level)
-		return 0;
-	if (!(r = LSTAT(sp, &state.path.st)))
-	{
-		if (S_ISLNK(state.path.st.st_mode) && !checklink(sp, &state.path.st, P_PATHONLY|P_LSTAT) && state.path.linksize > 0)
-		{
-			/*
-			 * remove instance if not default
-			 */
-
-			r = strlen(sp) - (sizeof(state.vdefault) - 1);
-			if (r > 3 && streq(sp + r, state.vdefault))
-				return 0;
-		}
-		r = UNLINK(sp);
-	}
-	if (!r)
-	{
-#if FS
-		if (mp)
-			fscall(mp, MSG_remove, 0, path);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_remove))
-				fscall(mp, MSG_remove, 0, path);
-#endif
-	}
-	else if (errno == ENOENT && pathreal(path, 0, NiL))
-		r = 0;
-	return r;
-}
-
-#undef	remove
-
-int
-remove(const char* path)
-{
-	return unlink(path);
-}

+ 0 - 93
src/cmd/3d/utime3d.c

@@ -1,93 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide utime
-#else
-#define utime        ______utime
-#endif
-#define _def_syscall_3d	1
-
-#include "3d.h"
-
-#if _hdr_utime
-#include <utime.h>
-#else
-struct utimbuf
-{
-	time_t		actime;
-	time_t		modtime;
-};
-#endif
-
-#undef	_def_syscall_3d
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide utime
-#else
-#undef  utime
-#endif
-
-#include "FEATURE/syscall"
-
-#define atimeof(p)	((p)->actime)
-#define mtimeof(p)	((p)->modtime)
-
-int
-utime3d(const char* path, const struct utimbuf* tms)
-{
-	register char*	sp;
-	register int	r;
-	time_t		atime;
-	time_t		mtime;
-#if FS
-	Mount_t*	mp;
-#endif
-
-	if (state.in_2d)
-		return(UTIME(path, tms));
-	if (tms)
-	{
-		atime = atimeof(tms);
-		mtime = mtimeof(tms);
-	}
-	else atime = mtime = time((time_t*)0);
-#if FS
-	if (!fscall(NiL, MSG_utime, 0, path, atime, mtime))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_TOP, NiL)))
-		return(-1);
-	r = UTIME(sp, tms);
-#if FS
-	if (!r)
-	{
-		if (mp)
-			fscall(mp, MSG_utime, 0, path, atime, mtime);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_utime))
-				fscall(mp, MSG_utime, 0, path, atime, mtime);
-	}
-#endif
-	return(r);
-}

+ 0 - 77
src/cmd/3d/utimensat3d.c

@@ -1,77 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2012 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if _nosys_utimensat
-
-NoN(utimensat)
-
-#else
-
-#define atimeof(p)	(((p)+0)->tv_sec)
-#define mtimeof(p)	(((p)+1)->tv_sec)
-
-int
-utimensat3d(int dir, const char* path, const struct timespec* tms, int flags)
-{
-	register char*	sp;
-	register int	r;
-	time_t		atime;
-	time_t		mtime;
-#if FS
-	Mount_t*	mp;
-#endif
-
-	if (state.in_2d)
-		return(UTIMETS(path, tms));
-	if (tms)
-	{
-		atime = atimeof(tms);
-		mtime = mtimeof(tms);
-	}
-	else atime = mtime = time((time_t*)0);
-#if FS
-	if (!fscall(NiL, MSG_utime, 0, path, atime, mtime))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (dir != AT_FDCWD && *path != '/')
-		sp = (char*)path;
-	else if (!(sp = pathreal(path, P_TOP, NiL)))
-		return(-1);
-	r = UTIMENSAT(dir, sp, tms, flags);
-#if FS
-	if (!r)
-	{
-		if (mp)
-			fscall(mp, MSG_utime, 0, path, atime, mtime);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_utime))
-				fscall(mp, MSG_utime, 0, path, atime, mtime);
-	}
-#endif
-	return(r);
-}
-
-#endif

+ 0 - 67
src/cmd/3d/utimes3d.c

@@ -1,67 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#define atimeof(p)	(((p)+0)->tv_sec)
-#define mtimeof(p)	(((p)+1)->tv_sec)
-
-int
-utimes3d(const char* path, const struct timeval* tms)
-{
-	register char*	sp;
-	register int	r;
-	time_t		atime;
-	time_t		mtime;
-#if FS
-	Mount_t*	mp;
-#endif
-
-	if (state.in_2d)
-		return(UTIMES(path, tms));
-	if (tms)
-	{
-		atime = atimeof(tms);
-		mtime = mtimeof(tms);
-	}
-	else atime = mtime = time((time_t*)0);
-#if FS
-	if (!fscall(NiL, MSG_utime, 0, path, atime, mtime))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_TOP, NiL)))
-		return(-1);
-	r = UTIMES(sp, tms);
-#if FS
-	if (!r)
-	{
-		if (mp)
-			fscall(mp, MSG_utime, 0, path, atime, mtime);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_utime))
-				fscall(mp, MSG_utime, 0, path, atime, mtime);
-	}
-#endif
-	return(r);
-}

+ 0 - 75
src/cmd/3d/utimets3d.c

@@ -1,75 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-#include "3d.h"
-
-#if _nosys_utimets
-
-NoN(utimets)
-
-#else
-
-#define atimeof(p)	(((p)+0)->tv_sec)
-#define mtimeof(p)	(((p)+1)->tv_sec)
-
-int
-utimets3d(const char* path, const struct timespec* tms)
-{
-	register char*	sp;
-	register int	r;
-	time_t		atime;
-	time_t		mtime;
-#if FS
-	Mount_t*	mp;
-#endif
-
-	if (state.in_2d)
-		return(UTIMETS(path, tms));
-	if (tms)
-	{
-		atime = atimeof(tms);
-		mtime = mtimeof(tms);
-	}
-	else atime = mtime = time((time_t*)0);
-#if FS
-	if (!fscall(NiL, MSG_utime, 0, path, atime, mtime))
-		return(state.ret);
-	mp = monitored();
-#endif
-	if (!(sp = pathreal(path, P_TOP, NiL)))
-		return(-1);
-	r = UTIMETS(sp, tms);
-#if FS
-	if (!r)
-	{
-		if (mp)
-			fscall(mp, MSG_utime, 0, path, atime, mtime);
-		for (mp = state.global; mp; mp = mp->global)
-			if (fssys(mp, MSG_utime))
-				fscall(mp, MSG_utime, 0, path, atime, mtime);
-	}
-#endif
-	return(r);
-}
-
-#endif

+ 0 - 501
src/cmd/3d/vcs.c

@@ -1,501 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2012 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped 
-/*
- * Herman Rao
- * AT&T Research
- * 3d version control system interface
- */
-
-#include "3d.h"
-
-#if VCS
-
-#define MAXVID		256
-
-#define MAGIC_STRING	"\026\003\023\006"
-#define MAGIC_LEN	4
-
-#define DELTA		(1 << 0)
-#define COMPRESS	(1 << 1)
-#define CPIO		(1 << 2)
-
-typedef struct			/* unique id for a sfile in WAN */
-{
-	unsigned long	host;
-	dev_t		dev;
-	ino_t		ino;
-} Rno_t;
-
-/*
- *	structure of sfile 
- *
- *	attr	tags_region	delta_region	log_region
- *	__________________________________________________________
- *	|      |T|T|T|T| ......|D  |D  |.....   |T|D    |T|D     |
- *	----------------------------------------------------------
- *             
- */
-
-typedef struct
-{
-	char		magic[4];
-	int		type;		/* type of file, i.e., DELTA */
-	int		version;	/* RSCS version number */
-	Rno_t		rno;		/* rnode */
-	int		tag_reg;	/* tags region		*/
-	int		del_reg;	/* delta region		*/
-	int		log_reg;	/* log region		*/
-	int		basetag;	/* base tag 		*/
-	int		base;		/* base delta 		*/
-	int		basesize;	/* base delta size	*/
-} Attr_t;
-
-#define LOG		(1<<0)
-#define HASH		(1<<1)
-#define VCSLINK		(1<<2)
-#define VOBJ		(1<<3)
-#define BASE		(1<<4)
-#define MARKER		(1<<5)
-
-typedef struct
-{
-	int		length;			/* length of tag */
-	int		type;			/* type of data */
-	int		del;			/* addr of data */
-	int		dsize;			/* size of data */
-	struct stat 	stat;			/* stat info    */
-	int		domain;			/* domain of the creator */
-	char 		version[MAXVID];	/* version id */
-} Tag_t;
-
-#define ISBASE(tp)	(((tp)->type) & BASE)
-#define ISROOT(me)	(me == (uid_t)(0))
-#define R_ISLINK(tp)	(((tp)->type) & VCSLINK)
-#define R_ISMARKER(tp)	(((tp)->type) & MARKER)
-
-#define CHRLINK		'>'
-#define CHRMARKER	'<'
-#define MAXLINKS	10
-
-/*
- * used by lookup_tag()
- */
-
-#define L_LOG		(1<<0)
-#define L_HASH		(1<<1)
-#define G_LINK		(1<<2)
-
-typedef struct Rdirent
-{
-	Tag_t*	 		tag;
-	int			oldaddr;	/* for reconf used */
-	char*			link;		/* used by the link */
-	struct Rdirent*		next;
-} Rdirent_t;
-
-#define ISRSCS(ap)	(!strncmp(ap->magic, MAGIC_STRING, MAGIC_LEN))
-#define KEYEQ(t,v,r)	(streq(t->version, v) && (!r || t->domain == r))
-
-/* 
- *	list of error codes
- */
-
-#define ERRARG		1
-#define NOVFILE		2
-#define NOTRSCS		3
-#define NOVERSION	4
-#define NOBASE		5
-#define ERRSTRUCT	6
-#define ERRBASE		7
-#define ERRDELTA	8
-#define NOMEM 		9
-#define ERRUPDATE	10
-#define ERRACCESS	11
-#define ERRWRITE	12
-#define NOENTIES	13
-
-#define DEFAULT		"default"
-#define LATEST		"latest"
-
-#define VCS_RDIR	"VCS"
-#define VCS_MDIR	"..."
-#define VCS_MDIRLEN	(sizeof(VCS_MDIR)-1)
-
-int
-vcs_checkout(const char* path, struct stat* st)
-{
-	char*		b;
-	char*		e;
-	int 		fd;
-	int		n;
-	char		buf[3 * PATH_MAX];
-	int		synfd;
-	char		synpath[PATH_MAX];
-
-	NoP(st);
-	message((-2, "vcs: checkout: %s", path));
-	if ((fd = fsfd(state.vcs.fs)) < 0)
-	{
-		message((-2, "vcs: connect error"));
-		return(-1);
-	}
-	e = (b = buf) + elementsof(buf) - 1;
-	bprintf(&b, e, "out %s %s %s\n", state.path.vcs.rfile, state.path.vcs.version, state.path.vcs.rfile);
-	n = b - buf;
-	message((-2, "vsc: sendout msg %s", buf));
-	cancel(&state.vcs.fd);
-	if (WRITE(fd, buf, n) != n)
-	{
-		message((-2, "vcs: checkout: can't send the message %s", buf));
-		return(-1);
-	}
-	e = (b = synpath) + elementsof(synpath) - 1;
-	bprintf(&b, e, "%s__%d", state.path.vcs.rfile, state.pid);
-	if ((synfd = OPEN(synpath, O_CREAT | O_WRONLY, 0666)) < 0)
-		return(-1);
-	CLOSE(synfd);
-	if ((n = READ(fd, buf, sizeof(buf) - 1)) > 0)
-	{
-		buf[n - 1] = 0;
-		message((-2, "vcs: checkout return msg %s", buf));
-		UNLINK(synpath);
-		return(0);
-	}
-	return(-1);
-}
-
-/*
- *	path:		prefix/.../file_name/version_name
- *	rfile:		prefix/.../file_name/default
- *	version:	version_name
- */
-
-static int
-vcs_map(const char* path, char* rfile, char* version)
-{
-	register const char*	s;
-	const char*		p[3];
-	int			i;
-
-	for (s = path; *s; s++);
-	for (i = 0; s != path && i < 3; s--)
-		if (*s == '/')
-			p[i++] = s + 1;
-	s++;
-	if (i < 3 || s == path || !strneq(p[2], VCS_MDIR, VCS_MDIRLEN))
-		return(-1);
-	strcpy(version, p[0]);
-	strcpy(rfile, path);
-	message((-2, "vcs: map path=%s rfile=%s version=%s", path, rfile, version));
-	return(0);
-}
-
-static Rdirent_t* 
-add_entry(Rdirent_t* head, Tag_t* tp)
-{
-	register Rdirent_t*	ndp;
-	register Rdirent_t*	dp;
-	register Rdirent_t**	prev_posn;
-	int			result;
-	Tag_t*			ntp;
-	char*			link = 0;
-	int			marker;
-	
-
-	if (R_ISLINK(tp) && (link = strrchr(tp->version, CHRLINK)))
-		*link++ = 0;		
-	marker = R_ISMARKER(tp) ? 1 : 0;
-	dp = head;
-	prev_posn = &head;
-	while (dp)
-	{
-		/*
-		 *	no marker as this point
-		 */
-
-#if 0
-		if (!marker && R_ISMARKER(dp->tag))
-		{
-			if ((dp->tag->stat.st_ctime < tp->stat.st_ctime) && markermatch(dp->tag->version, tp->version))
-			{
-				*prev_posn = dp->next;
-				ndp = dp->next;
-				free(dp->tag);
-				free(dp);
-				dp = ndp;
-				continue;
-			}
-		}
-#endif
-		if ((result = strcmp(dp->tag->version, tp->version)) == 0)
-		{
-			/*
-			 * check if the minor key (domain) is the same
-			 */
-
-			if (dp->tag->domain == tp->domain)
-			{
-				if (dp->tag->stat.st_ctime > tp->stat.st_ctime)
-					return(head);
-				ntp = newof(0, Tag_t, 0, tp->length);
-				memcpy((char*)ntp, (char*)tp, tp->length);
-				free(dp->tag);
-				dp->tag = ntp;
-				if (R_ISLINK(tp) && link)
-					dp->link = strdup(link);
-				return(head);
-			}
-		}
-		else if (result > 0)
-		{
-			ndp = newof(0, Rdirent_t, 1, 0);
-			ntp = newof(0, Tag_t, 0, tp->length);
-			memcpy((char*)ntp, (char*)tp, tp->length);
-			ndp->tag = ntp;
-			ndp->next = dp;
-			if (R_ISLINK(tp) && link)
-				ndp->link = strdup(link);
-			*prev_posn = ndp;
-			return(head);
-		}
-		prev_posn = &(dp->next);
-		dp = dp->next;
-	}
-	ndp = newof(0, Rdirent_t, 1, 0);
-	ntp = newof(0, Tag_t, 0, tp->length);
-	memcpy((char*)ntp, (char*)tp, tp->length);
-	ndp->tag = ntp;
-	ndp->next = 0;
-	if (R_ISLINK(tp) && link)
-		ndp->link = strdup(link);
-	*prev_posn = ndp;
-	return(head);
-}
-
-static Tag_t*	
-get_tag(int f, register Tag_t* tp)
-{
-	register char*	s;
-	int		len;
-
-	s = (char *)tp + sizeof(int);
-	memset((char *)tp, 0, sizeof(Tag_t));
-	if (!READ(f, (char *)&(tp->length), sizeof(int)) || (len = tp->length - sizeof(int)) && READ(f, (char *)s, len) != len)
-		return(0);
-	if (tp->type & LOG)
-	{
-		tp->del = lseek(f, 0, SEEK_CUR);
-		lseek(f, tp->dsize, SEEK_CUR);
-	}
-	return(tp);
-}
-
-static Rdirent_t* 
-rs_dir(register int fd, register Attr_t* ap)
-{
-	Tag_t			tag;
-	register Tag_t*		tp;
-	Rdirent_t*		head;
-	register Rdirent_t*	dp;
-	register Rdirent_t*	ndp;
-	register Rdirent_t**	prev_posn;
-
-	state.vcs.now = time(NiL);
-	
-	tp = &tag;
-	head = 0;
-	lseek(fd, ap->log_reg, SEEK_SET);
-	while(get_tag(fd, tp))
-		head = add_entry(head, tp);
-
-	lseek(fd, ap->tag_reg, SEEK_SET);
-	while((lseek(fd, 0, SEEK_CUR)<ap->del_reg) && get_tag(fd, tp))
-		head = add_entry(head, tp);
-
-	/*
-	 * remove expired marker 
-	 */
-
-	dp = head;
-	prev_posn = &head;
-	while (dp)
-	{
-		if (R_ISMARKER(dp->tag) && dp->tag->stat.st_mtime < state.vcs.now)
-		{
-			*prev_posn = dp->next;
-			ndp = dp->next;
-			free(dp->tag);
-			free(dp);
-			dp = ndp;
-		}
-		else
-		{
-			prev_posn = &(dp->next);
-			dp = dp->next;
-		}
-
-	}
-	
-	return(head);
-}
-
-static Tag_t* 
-locate(register Rdirent_t* rdir, register char* version, int level)
-{
-
-	register Rdirent_t* rd;
-	register time_t	    mtime;
-	register Rdirent_t* p;
-
-	if (level > MAXLINKS)
-		return(0);
-
-	if (streq(version, DEFAULT) || streq(version, LATEST))
-	{
-		for (rd = rdir, mtime = 0L; rd; rd = rd->next)
-		{
-			if (rd->tag->stat.st_mtime > mtime)
-			{
-				p = rd;
-				mtime = rd->tag->stat.st_mtime;
-			}
-		}
-		if (mtime)
-			return(p->tag);
-	}
-
-	rd = rdir;
-	for (rd = rdir; rd; rd = rd->next)
-	{
-		if (streq(rd->tag->version, version))
-		{
-			if (R_ISLINK(rd->tag))
-				return(locate(rdir, rd->link, level +1));
-			return(rd->tag);
-		}
-	}
-	return(0);
-}
-
-static void 
-free_dir(register Rdirent_t* rdir)
-{
-	Rdirent_t* rnext;
-
-	while(rdir)
-	{
-		rnext = rdir->next;
-		free(rdir->tag);
-		if (rdir->link)
-			free(rdir->link);
-		free(rdir);
-		rdir = rnext;
-	}
-	return;
-}
-
-/*
- *	return 	 0 if found it;
- *		-1 if error
- *		 1 if not found.
- */
-
-static int
-vcs_stat(int fd, char* version, struct stat* st, off_t size)
-{
-	static Attr_t*		ap = 0;
-	static Attr_t		apbuf;
-	static Rdirent_t*	rdir = 0;
-	register Tag_t*		tag;
-
-	NoP(size);
-	if (fd != state.vcs.fd || !ap)
-	{
-		ap = &apbuf;
-		if (READ(fd, (char *)ap, sizeof(Attr_t)) != sizeof(Attr_t))
-			return(-1);
-		if (!rdir)	
-			free_dir(rdir);
-		if (!(rdir = rs_dir(fd, ap)))
-			return(1);
-	}
-	if (tag = locate(rdir, version, 0))
-	{
-		*st = tag->stat;
-		return(0);
-	}
-	return(1);
-
-}
-
-int
-vcs_real(const char* path, struct stat* st)
-{
-	int	n;
-	int	fd;
-
-	message((-2, "vcs: path=%s", path));
-	if (st->st_nlink <= 1 || vcs_map(path, state.path.vcs.rfile, state.path.vcs.version))
-		return(-1);
-
-	message((-2, "vcs: real  path=%s rfile=%s version=%s", path, state.path.vcs.rfile, state.path.vcs.version));
-
-	if (state.vcs.fd && state.vcs.dev == st->st_dev && state.vcs.ino == st->st_ino)
-		fd = state.vcs.fd;
-	else if ((fd = OPEN(path, O_RDONLY, 0)) < 0)
-		return(-1);
-	if (n = vcs_stat(fd, state.path.vcs.version, st, st->st_size))
-	{
-		if (fd != state.vcs.fd) CLOSE(fd);
-		else if (n == -1) cancel(&state.vcs.fd);
-		return(-1);
-	}
-	if (fd != state.vcs.fd)
-	{
-		cancel(&state.vcs.fd);
-		state.vcs.fd = fd;
-		reserve(&state.vcs.fd);
-		state.vcs.dev = st->st_dev;
-		state.vcs.ino = st->st_ino;
-		FCNTL(fd, F_SETFD, FD_CLOEXEC);
-	}
-	return(0);
-}
-
-int
-vcs_set(Fs_t* fs, const char* arg, int argsize, const char* op, int opsize)
-{
-	NoP(arg);
-	NoP(argsize);
-	NoP(op);
-	NoP(opsize);
-	state.vcs.fs = fs;
-	return(0);
-}
-
-
-#else
-
-NoN(vcs)
-	
-#endif

+ 0 - 78
src/cmd/3d/vcs_3d.h

@@ -1,78 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-/*
- * 3D interface to version control system
- *
- * Herman Rao
- * AT&T Research
- */
-
-#ifndef _VCS3D_H
-#define _VCS3D_H
-
-#define vcs_checkout	_3d_vcs_checkout
-#define vcs_real	_3d_vcs_real
-#define vcs_set		_3d_vcs_set
-
-#define VCS_STATE				\
-	struct					\
-	{					\
-	dev_t		dev;			\
-	ino_t		ino;			\
-	Fs_t*		fs;			\
-	short		fd;			\
-	time_t		now;			\
-	}		vcs
-
-#define VCS_PATH_STATE				\
-	struct					\
-	{					\
-	char 		rfile[PATH_MAX]; 	\
-	char		version[PATH_MAX];	\
-	}		vcs
-
-#define VCS_FS							\
-	FSINIT("vcs", 0, vcs_set, FS_CLOSE, HASHKEY3('v','c','s'))
-
-#define VCS_OPEN(p,f,m,s) 					\
-	do 							\
-	{ 							\
-		if (!(f & O_CREAT) && (f & O_ACCMODE != O_WRONLY) && state.vcs.fd)\
-		{						\
-			if (vcs_checkout(p, s) < 0) 		\
-			{ 					\
-				errno = ENOENT; 		\
-				return(-1); 			\
-			}					\
-			p = state.path.name;			\
-		} 						\
-	} while (0)
-
-#define VCS_REAL(p,s) 						\
-	(fson(state.vcs.fs) ? vcs_real(p,s) : 0)
-
-extern int	vcs_checkout(const char*, struct stat*);
-extern int	vcs_real(const char*, struct stat*);
-extern int	vcs_set(Fs_t*, const char*, int, const char*, int);
-
-#endif

+ 0 - 54
src/cmd/3d/vex.sh

@@ -1,54 +0,0 @@
-########################################################################
-#                                                                      #
-#               This software is part of the ast package               #
-#          Copyright (c) 1989-2011 AT&T Intellectual Property          #
-#                      and is licensed under the                       #
-#                 Eclipse Public License, Version 1.0                  #
-#                    by AT&T Intellectual Property                     #
-#                                                                      #
-#                A copy of the License is available at                 #
-#          http://www.eclipse.org/org/documents/epl-v10.html           #
-#         (with md5 checksum b35adb5213ca9657e911e9befb180842)         #
-#                                                                      #
-#              Information and Software Systems Research               #
-#                            AT&T Research                             #
-#                           Florham Park NJ                            #
-#                                                                      #
-#                 Glenn Fowler <gsf@research.att.com>                  #
-#                  David Korn <dgk@research.att.com>                   #
-#                   Eduardo Krell <ekrell@adexus.cl>                   #
-#                                                                      #
-########################################################################
-: vex skip expand command ...
-# vpath expand args matching pattern
-# @(#)vex (AT&T Bell Laboratories) 04/01/93
-case $# in
-[012])	print -u2 "Usage: $0 skip expand command ..."; exit 1 ;;
-esac
-skip=$1
-shift
-expand=$1
-shift
-command=$1
-shift
-integer argc=0 noexpand=0
-for arg
-do	if	((noexpand))
-	then	noexpand=0
-	else	case $arg in
-		-[$skip])
-			noexpand=1
-			;;
-		-*)	;;
-		$expand)
-			x=$(vpath "$arg" 2>/dev/null)
-			case $x in
-			?*)	arg=${x#$PWD/} ;;
-			esac
-			;;
-		esac
-	fi
-	argv[argc]=$arg
-	((argc+=1))
-done
-"$command" "${argv[@]}"

+ 0 - 52
src/cmd/3d/vfork3d.c

@@ -1,52 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*          Copyright (c) 1989-2011 AT&T Intellectual Property          *
-*                      and is licensed under the                       *
-*                 Eclipse Public License, Version 1.0                  *
-*                    by AT&T Intellectual Property                     *
-*                                                                      *
-*                A copy of the License is available at                 *
-*          http://www.eclipse.org/org/documents/epl-v10.html           *
-*         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf@research.att.com>                  *
-*                  David Korn <dgk@research.att.com>                   *
-*                   Eduardo Krell <ekrell@adexus.cl>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * vfork == fork
- * cross your fingers
- * csh loses
- */
-
-#include <ast_lib.h>
-
-#if _lib_vfork && 0
-
-extern int	fork(void);
-
-int
-_vfork(void)
-{
-	return(fork());
-}
-
-int
-vfork(void)
-{
-	return(fork());
-}
-
-#else
-
-int	_STUB_vfork;
-
-#endif

Some files were not shown because too many files changed in this diff