Compare commits

..
Author SHA1 Message Date
Ken Smith 3d215489fe MFC v1.7
> date: 2005/11/03 00:23:13;  author: kensmith;  state: Exp;  lines: +1 -6
> It had been noticed disc2 was overflowing earlier but committing the
> fix slipped through a crack.  Remove the apache and php packages under
> the assumption someone installing a Web server has network access and
> doesn't *need* the packages on disc2.

Approved by:	re (scottl)
2005-11-03 00:35:25 +00:00
Scott Long da2cd746e7 Welcome to 6.0-RELEASE.
Approved by: re
2005-11-02 02:00:46 +00:00
Scott Long 52b835344d MFC: FreeBSD 6.0
Approved by: re
2005-11-02 00:01:08 +00:00
Scott Long ffdda74401 Grrr, Nov = 11
Approved by:	re
2005-11-01 23:43:49 +00:00
Scott Long d78cc8da72 Note that 6.0-RELEASE is about to happen.
Approved by:	re
2005-11-01 23:40:38 +00:00
Scott Long 957f5ead91 MFC: Tell gcc about FreeBSD 6.
Approved by: re
2005-11-01 23:10:08 +00:00
SUZUKI Shinsuke c0a7104606 MFC 1.59
statically configured IPv6 address is properly added/deleted now

Approved by: re(scottl)
2005-11-01 22:42:05 +00:00
John Baldwin 3d888e5914 MF6: Add a deprecation warning.
Approved by:	re (scottl)
2005-10-31 20:17:14 +00:00
Yoshihiro Takahashi 35738380af MFC: Enable beastie.4th.
Approved by:	re (scottl)
2005-10-30 16:36:00 +00:00
Scott Long e658bb489d MFC
Approved by: re
2005-10-30 14:40:40 +00:00
cvs2svn 21f0307211 This commit was manufactured by cvs2svn to create branch 'RELENG_6_0'. 2005-10-30 05:41:44 +00:00
Kirill Ponomarev 887d355270 MFC: perform.c:1.14 test-pkg_version.sh:1.6
date: 2005/10/10 12:35:30;  author: krion;  state: Exp;  lines: +9 -4
  * pkg_version(1) exits if INDEX files is not found and -I is not
    specified.  The result is that the package will be listed with a '?'
    as if it was not found within the INDEX file, so fix this behaviour.
  * Remove trailing spaces.

  PR:             bin/87136
  Submitted by:   Sean Farley <sean-freebsd at farley dot org>

Approved by:	re
2005-10-29 15:49:01 +00:00
Kirill Ponomarev 6636f48868 MFC: delete/main.c:1.27 info/main.c:1.48
Fix pkg_info(1) and pkg_delete(1) to handle properly packages which
  names start with a digit.

  PR:             bin/76858
  Submitted by:   Matthew D. Fuller <fullermd@over-yonder dot net>

Approved by:	re
2005-10-29 15:27:12 +00:00
Scott Long 66308c6270 MFC rev 1.113
Submitted by delphij
Approved by: re
2005-10-29 15:13:07 +00:00
Scott Long 087ac34ec2 Sync RELENG_6_0 with all of the FFS fixes from Tor.
Submitted by:	tegge
Approved by:	re
2005-10-29 07:00:45 +00:00
Tai-hwa Liang ede84755f3 MFC: (1.16) Fixing a name collision in module declaration by renaming
"firewire" to "if_firewire."  According to the PR originator and Cai's
testing result, this bug prevents a RELENG_6 GENERIC kernel from loading
if_fwip.ko and will panic the kernel if users compile "device fwip" into
their GENERIC kernel.

Approved by:	re (scottl)
2005-10-28 22:52:31 +00:00
Pawel Jakub Dawidek c5e3056011 Fix possible live-lock under heavy load where we can't allocate more
memory for request.
I was sure graid3 should handle such situations well, but green@ reported
it is not and we want to fix it before 6.0.

Submitted by:	green
Approved by:	re (scottl)
2005-10-28 20:27:53 +00:00
John Baldwin abf809c118 MF6: Sync with HEAD updating examples for 6.x.
Approved by:	re (scottl)
2005-10-28 19:24:41 +00:00
John Baldwin 96fb3ac3fc MF6: Add DEFAULTS files for amd64, i386, and pc98.
Approved by:	re (scottl)
2005-10-28 19:22:41 +00:00
John Baldwin 17fc0cbcdb MF6: config -V and support for DEFAULTS.
Approved by:	re (scottl)
2005-10-28 19:20:53 +00:00
John Baldwin 01b1c3795a MF6: Add COMPAT_FREEBSD5.
Approved by:	re (scottl)
2005-10-28 19:20:00 +00:00
Martin Cracauer 95dfc0a1cc Fix this:
kern/87959      cracauer        ext2fs: no cp(1) possible, mmap returns EINVAL

ext2fs was missing vnode_create_vobject.

(Reisefs probably has the same problem but I want to get this in quick
for 6-release)

releng-6 branches commits approved by Scott Long.

Approved by: re
2005-10-28 18:44:26 +00:00
Scott Long 5e4677ca87 MFC: Fix regression in Dell PERC/ROMB systems.
Approved by: re
2005-10-28 16:31:34 +00:00
cvs2svn 218f2e0ec5 This commit was manufactured by cvs2svn to create branch 'RELENG_6_0'. 2005-10-28 15:30:53 +00:00
SUZUKI Shinsuke 527ef1908a MFC Rev 1.60
perform NUD on an IPv6-aware point-to-point interface

Approved by: re(scottl)
2005-10-28 14:38:56 +00:00
Ade Lovett b7217bb7d0 MFC:
Specifically panic() in the case where pmap_insert_entry() fails to
get a new pv under high system load where the available pv entries
have been exhausted before the pagedaemon has a chance to wake up
to reclaim some.

Approved by:	re (scottl)
2005-10-28 06:49:49 +00:00
Xin LI 628f5eef34 MFRELENG_6 1.416.2.4: Some changes to reflect 6.0-STABLE/RELEASE.
Approved by:	re (scottl)
2005-10-28 02:59:51 +00:00
Peter Grehan e6d8fd44a4 MF RELENG_6 r1.34.2.1
> The BCM5401 dspcode load on media changes also applies
  > to the 100/1000 BCM5400 phy. This fixes the problem with
  > the GEM port not syncing up on Sawtooth G4's.
  >
  > Obtained from:  NetBSD
  > Reported by:    Ben Rosengart <ben + freebsd org at narcissus net>

Approved by:    re (scottl)
2005-10-28 01:07:54 +00:00
Stephan Uphoff 5f37fe5bda MFC vfs_cluster.c Revision 1.168
Only set B_RAM (Read ahead mark) on an incore buffers if we can lock it.
This fixes a race condition caused by the unlocked write access to the
b_flags field.

Approved by:    re (scottl)
2005-10-28 01:03:26 +00:00
Ken Smith 18d2ca12a1 MFC of Rev. 1.6.2.1:
> Temporary hack to get the hme network interface on Sun E250 servers to
> work.  The code comment describes the issue, basically an as yet not
> totally understood interrupt routing problem.  This hack is being done
> to RELENG_6 so that the hme interface works on E250's for the release,
> but is not being done in HEAD so more work on the interrupt routing
> issue can be done.
>
> Requested by:	marius

Approved by:	re (scottl)
2005-10-27 20:58:50 +00:00
Joel Dahl 8cb3b5729f MFC r1.59:
Add support for ATI IXP[234]00.

Requested by:	delphij
Approved by:	re (scottl)
2005-10-27 20:47:03 +00:00
Joel Dahl e8d38e80bb MFC r1.1334:
snd_ess needs snd_sbc, so add a note about that.

Requested by:	delphij
Approved by:	re (scottl)
2005-10-27 20:39:37 +00:00
Andrew Thompson 905dbf6afa MFC if_bridge r1.30
> If we have been called from ether_ifdetach() then do not try and clear the
> promisc flag from the member interface, this is a no-op anyway since the
> interface is disappearing. The driver may have already released
> its resources such as miibus and this is likely to panic the kernel.

Approved by:    re (scottl)
2005-10-27 19:43:07 +00:00
Scott Long 71c60dd1de MFC: Sync the mpt driver to pick up license refinement and INVARIANTS error.
Approved by: re
2005-10-27 18:58:37 +00:00
Murray Stokely d26e5dee60 MFC: Use packages-6-release directory for packages, as appropriate.
Approved by:	re
2005-10-27 18:38:48 +00:00
Gleb Smirnoff 020ec29a79 MFC:
- Fix leak of struct nlminfo on process exit.
  - Fix malloc type collision, that made the above problem
    difficult to understand.

  Reported by:	Vladimir Sharun <sharun ukr.net>

Approved by:	re (scottl)
2005-10-27 18:35:19 +00:00
Xin LI 5dd20217a6 MFRELENG_6 1.5.2.3: Update to sync up with latest RELENG_6 documentation.
Approved by:	re (scottl)
2005-10-27 17:54:31 +00:00
Bill Paul d2854f8b92 MFC: add the driver_ndis support files to the wpa_supplicant distribution
for -D ndis support with the NDISulator

Approved by:	re
2005-10-27 17:15:47 +00:00
Bill Paul 0dbb2e0f34 MFC: synchronize the NDISulator with the head and RELENG_5 branches,
add -D ndis support to wpa_supplicant

Approved by:	re
2005-10-27 17:08:57 +00:00
Bill Paul fd47f7362f MFC: add 1 microsecond delay to pci_add_children() bus enumeration loop
Approved by:	re
2005-10-27 16:44:06 +00:00
Søren Schmidt b75aec04ff MFC:
Enclose the delayed attach in Giant so we dont loose the race with other
	drivers trying to attach ATA devices like pccard.
	Dont clear the delayed flag before we are acutally finished.

Approved by: re@ (scottl)
2005-10-27 16:41:39 +00:00
Jung-uk Kim 99c293401c MFRELENG_6: Fix 'grep -Fw' for encodings other than UTF-8 (RH bug #161700).
PR:		87969
Approved by:	re (scottl)
Obtained from:	Fedora (Tim Waugh)
2005-10-27 16:29:02 +00:00
SUZUKI Shinsuke fe1746fb90 MFC rev 1.34
fixed a kernel crash when IPv6 PIM-SM routing is enabled and a PIM register message is received

Approved by: re(scottl)
2005-10-27 14:04:03 +00:00
Peter Wemm 2e2bc37c17 MFC: 1.2: don't set segment registers yet.
Approved by:  re
2005-10-26 22:07:03 +00:00
Christian S.J. Peron 3b30fd6060 MFC notes about ucred based rules and debug.mpsafenet requirements.
Approved by:	re (scottl)
2005-10-26 21:58:42 +00:00
Ariff Abdullah 22ff0d37be Virtual channel default speed should be based on soundcard
capabilities. This solve various mysterious slowdown especially
for fixed-rate ac97 soundcards.

Approved by:	re (scottl), netchild (mentor)
Reviewed by:	andreas
2005-10-26 21:18:41 +00:00
Ariff Abdullah f66ce35e97 Rearrange sound unregister procedure to detect mixer busy
state and destroy it before anything else. This solve panic issue
during sound module unloading if the sound / mixer device being
held by external processes.

Approved by:	re (scottl), netchild (mentor)
Reviewed by:	andreas
2005-10-26 21:18:09 +00:00
Ariff Abdullah ff7bd1bebf Track every mixer device closing for proper refcount calculation.
This solve device busy and panic issues during sound module
unloading.

Approved by:	re (scottl), netchild (mentor)
Reviewed by:	andreas
2005-10-26 21:17:40 +00:00
Jung-uk Kim 3aafcdb5aa MFRELENG_6: Fix a longstanding buglet in bz-prefixed grep(1).
PR:		gnu/72200
Approved by:	re
2005-10-26 21:15:51 +00:00
Xin LI 0fcef6909b MFRELENG_6 (by alc) changesets that addresses several race conditions that
can cause a kernel compiled with ZERO_COPY_SOCKETS to panic under certain
circumstances:
	sys/kern/uipc_cow.c:	1.24 - 1.26
	sys/vm/vm_object.c:	1.351

Approved by:	re (scottl)
2005-10-26 20:22:00 +00:00
Pawel Jakub Dawidek b79874b1ac Call if_clone_detach() after vlan_clone_destroy() loop, as if_clone_detach()
is freeing ifc_units field, which is used in
vlan_clone_destroy()->ifc_free_unit().

This fixes panic: ifc_free_unit: bit is already cleared

The fix introduces a small race in that a new interface could be created
between the vlan_clone_destroy() loop and the call to if_clone_detach().
The race is probably too hard to trigger to be worry about it.

This is not an MFC, because better fix was committed to HEAD.
We decided to use this fix, as it is a low-risk fix, which fits just fine
for 6.0 at this stage.

Discussed with:	brooks, thompsa
Approved by:	re (scottl)
2005-10-26 19:57:04 +00:00
Peter Wemm 9a8c805f4e MFC: Fix fencepost error that made libkvm fail to read crashdumps.
Approved by: re
2005-10-26 00:07:25 +00:00
Nate Lawson ae4c6d68b3 MFC rev 1.11.2.1: set to 100% on boot
Approved by:	re (scottl)
2005-10-25 20:53:22 +00:00
Nate Lawson 75609203af MFC rev 1.214.2.1: Don't disable PCI link devices even when they're !enabled
Approved by:	re (scottl)
2005-10-25 20:51:58 +00:00
Kris Kennaway 9792749811 MFC r1.650:
Default to mpsafevfs=1 on sparc64

Approved by:    re (scottl)
2005-10-25 20:43:25 +00:00
Kris Kennaway a42a37b2b1 MFC 1.73:
Reflect mpsafety of the underlying filesystem in the nullfs image.

Approved by:    re (scottl)
2005-10-25 20:33:59 +00:00
John Baldwin a09f52b5b4 MF6: Don't panic if a spin lock is initialized that isn't in our static
order list.  Just warn about it instead.

Approved by:	re (scottl)
2005-10-25 20:17:11 +00:00
John Baldwin 12abcec092 MF6: Rename 'traceall' to 'alltrace' and add a 'bt' alias for 'trace'.
Approved by:	re (scottl)
2005-10-25 20:11:58 +00:00
Nate Lawson c46ee19798 MFC: powerd.c rev 1.6.2.3, powerd.8 rev 1.5.2.1
Approved by:	re (scottl)
2005-10-25 20:07:51 +00:00
Warner Losh a21bfc1306 MFC: 1.26
Approved by: re@ (scottl)
2005-10-25 20:07:47 +00:00
cvs2svn cfb0cdce75 This commit was manufactured by cvs2svn to create branch 'RELENG_6_0'. 2005-10-24 05:35:42 +00:00
Warner Losh 3e0b8fb346 MF RELENG_6: (1.2) reduce the memory page size to 1k. 2005-10-23 18:23:27 +00:00
Xin LI 1d64cdbb8b MFR6: Remove the "6.x is slow" note to reflect reality.
Approved by:	re (scottl)
2005-10-23 03:36:03 +00:00
Andrew Thompson 92ad66505c MFC ng_ether support for if_bridge and cleanup of bridge hooks.
bridgestp.c; r1.8
 if_bridge.c; r1.25, 1.27
 if_bridgevar.h; r1.5
 if_ethersubr.c; r1.201, 1.202, 1.206
 ng_ether.c; r1.52 - 1.54

Approved by:    re (scottl)
2005-10-23 02:37:28 +00:00
Gleb Smirnoff 38104e8617 Sync with HEAD. Revisions merged:
- rev. 1.76. Removed FreeBSD 4.x code.
  - rev. 1.77, 1.79. Together with rev. 1.71 (already merged) this
    fixes problems when some code is executed in driver when
    em_process_receive_interrupts() drops lock. This can occur
    at runtime, when polling(4) mode is changed to interrupt driver
    or vise versa, but more likely this can happen when administrator
    issues some ifconfig commands.
  - rev. 1.78. In em_process_receive_interrupts(), call bus_dmamap_sync()
    for the descriptors set each time we modify one descriptor, instead
    of doing it only at the function exit.
  - rev. 1.80. Loop in em_intr() until interrupt cause register is clear,
    don't mask overrun interrupt.
  - rev. 1.81. Several locking and other fixes.

See particular revision logs for more detailed information.

Approved by:	re
2005-10-22 22:07:20 +00:00
Yaroslav Tykhiy 34ffcac9fd MFC notes on ifconfig(8): -tunnel, -vlandev.
Approved by:    re (hrs)
2005-10-21 16:01:46 +00:00
SUZUKI Shinsuke a851385207 MFC 1.56 (added a missing unlock)
Approved by: re(scottl)
2005-10-21 11:10:46 +00:00
Stephan Uphoff fdd3ac39c8 MFC vm_machdep.c 1.261-1.263
Rev: 1.261

  Ensure that a thread stays on same CPU when calculating per CPU
  TLB shootdown requirements. Otherwise a CPU may not get the needed
  TLB invalidation.

  The PTE valid and access flags can not be used here to avoid TLB
  shootdowns unless sf->cpumask == all_cpus.
  ( Otherwise some CPUs may still hold an even older entry in the TLB)
  Since sf_buf_alloc mappings are normally always used this is
  also not really useful and presetting accessed and modified
  allows the CPU to speculatively load the entry into the TLB.

  Both bugs can cause random data corruption.

Rev: 1.262

  Restore optimizations to reduce TLB shootdowns.
  Alan Cox pointed out that they are really useful for
  sendfile().

Rev: 1.263
  Restore the UP optimization to reduce the number of TLB
  invalidations.  The
  previous revision only restored the MP optimization.

  Describe the optimization strategy for TLB invalidations in a comment.

Approved by:	re@ (scottl)
2005-10-20 01:03:23 +00:00
Poul-Henning Kamp 2ca115c41b MFC:
Use correct criteria to determine if dirent can be removed
        right away.

Approved by:	re@ (scottl)
2005-10-19 21:26:02 +00:00
Andrew Thompson 1101e1b905 MFC: if_bridge.c r1.26, if_ethersubr.c r1.205
>   Use bridge_ifdetach() to notify the bridge that a member has been detached.
>   The bridge can then remove it from its interface list and not try to send
>   out via a dead pointer.

Approved by:	re (scottl)
2005-10-19 20:46:16 +00:00
Don Lewis 063395a5a5 MFC ufs_lookup.c 1.78 and 1.79.
Original commit messages:
  Modified files:
    sys/ufs/ufs          ufs_lookup.c
  Log:
  Close a race in the ufs_lookup() code that handles the ISDOTDOT
  case by saving the value of dp->i_ino before unlocking the vnode
  for the current directory and passing the saved value to VFS_VGET().

  Without this change, another thread can overwrite dp->i_ino after
  the current directory is unlocked, causing  ufs_lookup() to lock
  and return the wrong vnode in place of the vnode for its parent
  directory.  A deadlock can occur if dp->i_ino was changed to a
  subdirectory of the current directory because the root to leaf vnode
  lock ordering will be violated.  A vnode lock can be leaked if
  dp->i_ino was changed to point to the current directory, which
  causes the current vnode lock for the current directory to be
  recursed, which confuses lookup() into calling vrele() when it
  should be calling vput().

  The probability of this bug being triggered seems to be quite low
  unless the sysctl variable debug.vfscache is set to 0.

  Reviewed by:    jhb
  MFC after:      2 weeks

  Revision  Changes    Path
  1.78      +3 -1      src/sys/ufs/ufs/ufs_lookup.c

  Modified files:
    sys/ufs/ufs          ufs_lookup.c
  Log:
  Correct the type of the temporary variable used by ufs_lookup.c:1.78
  to fix the race condition in the ufs_lookup() ISDOTDOT code.

  Noticed by:     bde
  MFC after:      12 days

  Revision  Changes    Path
  1.79      +1 -1      src/sys/ufs/ufs/ufs_lookup.c

Approved by:	re (scottl)
2005-10-19 20:31:45 +00:00
Don Lewis 1b3663cbaa MFC nwfs_lookup.c 1.42
Original commit message:
  Modified files:
    sys/fs/nwfs          nwfs_vnops.c
  Log:
  Update nwfs_lookup() to match the current cache_lookup() API.
  cache_lookup() has returned a ref'ed and locked vnode since
  vfs_cache.c:1.96, dated Tue Mar 29 12:59:06 2005 UTC.  This change
  is similar to the change made to smbfs_lookup() in smbfs_vnops.c:1.58.

  Tested by:      "Antony Mawer" ant AT mawer.org
  MFC after:      2 weeks

  Revision  Changes    Path
  1.42      +11 -26    src/sys/fs/nwfs/nwfs_vnops.c

Approved by:	re (scottl)
2005-10-19 20:20:42 +00:00
John Baldwin ede7fe23cb MF6: Update critical(9) with recently reality.
Approved by:	re (kensmith)
2005-10-17 18:52:50 +00:00
Poul-Henning Kamp daab09ff7d MF6: nanobsd.sh fixes
Approved by:	re@ (scottl)
2005-10-17 07:58:05 +00:00
Warner Losh 385a4b0a41 MF-RELENG_6: rtl8029 and qemu fixes.
>   1.2       +6 -5      src/sys/dev/ed/if_ed_rtl80x9.c
>   1.48      +9 -2      src/sys/dev/ed/if_ed_pci.c
Approved by: re@ (kensmith)
2005-10-17 02:25:26 +00:00
Kris Kennaway 191bfb282f MFC r1.20:
Add a default value for VM_BCACHE_SIZE_MAX of 400MB.  This is copied from
amd64, and is a factor of 3 less than the value previously auto-sized on
a 12GB machine, which would cause an overflow in calculations involving the
maxbcache int, causing bufinit() to loop forever at boot.

Approved by:	re (kensmith)
2005-10-17 00:19:30 +00:00
Kris Kennaway 5a02e2d3f6 MFC r1.72: Partially revert r1.67 which changed maxbcache and maxswzone
from int to long without updating the <sys/buf.h> version.  This broke the
corresponding tunables on sparc.

Approved by:    re (kensmith)
2005-10-17 00:17:22 +00:00
Robert Watson 3d0f46b8df Merge in.c:1.89,1.90 from HEAD to RELENG_6_0:
Acquire Giant conditionally in in_addmulti() and in_delmulti() based on
  whether the interface being accessed is IFF_NEEDSGIANT or not.  This
  avoids lock order reversals when calling into the interface ioctl
  handler, which could potentially lead to deadlock.

  The long term solution is to eliminate non-MPSAFE network drivers.

  Discussed with: jhb

  Unlock Giant symmetrically with respect to lock acquire order as that's
  generally nicer.

  Spotted by:     johan

Approved by:    re (kensmith)
2005-10-16 17:12:18 +00:00
Robert Watson 741347619e Merge ufs_extattr.c:1.82 from RELENG_6 to RELENG_6_0:
When performing a VOP_LOOKUP() as part of UFS1 extended attribute
  auto-start, set cnp.cn_lkflags to LK_EXCLUSIVE.  This flag must now
  be set so that lockmgr knows what kind of lock to acquire, and it
  will panic if not specified.  This resulted in a panic when using
  extended attributes on UFS1 as of locking work present in the 6.x
  branch.

  Reported by:    lofi

Approved by:    re (kensmith)
2005-10-16 16:52:14 +00:00
Hiroki Sato 07d746f573 Update version numbers for upcoming 6.0-RELEASE.
Approved by:	re (implicitly)
2005-10-16 14:07:44 +00:00
Hiroki Sato 32dc657349 Update various version numbers and entities
for upcoming 6.0-RELEASE.

Approved by:	re (implicitly)
2005-10-16 08:28:10 +00:00
Hiroki Sato 8051874cd7 Use RELENG_6_0 for standard-supfile.
Approved by:	re (implicitly)
2005-10-16 08:15:29 +00:00
Xin LI a8e6180850 MFR6 Release Notes Language Improvements
Approved by:	re (hrs)
2005-10-16 07:35:40 +00:00
Gleb Smirnoff 8b7a63f7e1 Merge the 'kldstat -q' functionality, that is required for proper
operation of the /etc/rc.d/pfsync script, that was merged before
the RELENG_6_0 has been forked.

Approved by:	re (kensmith)
2005-10-14 14:38:56 +00:00
Scott Long 75c7560dfb MFC: Sync the driver with RELENG_6 to pick up critical atapi-cd and ata-raid
fixes, as well as ATI support.

Submitted by:	sos
Approved by:	re
2005-10-14 09:34:50 +00:00
Xin LI f2adbc2073 MFC (by gibbs):
| Correct bug that caused the completed "recovery" scb to have its
| timer reset rather than the timer of an SCB still pending on the
| controller after recovery completed.  This should correct timeout
| loops seen in the field.
|
| Revision  Changes    Path
| 1.22      +2 -1      src/sys/dev/aic7xxx/aic79xx_osm.c
| 1.43      +2 -1      src/sys/dev/aic7xxx/aic7xxx_osm.c

Approved by:	re (kensmith)
2005-10-14 02:19:02 +00:00
Xin LI 4c096043ce MFRELENG_6 Simplified Chinese translation of Release Documentations
Approved by:	re (hrs)
2005-10-13 17:32:39 +00:00
David Xu e9c4c22b54 MFC revision 1.24:
> The pthread_attr_set_createsuspend_np was broken, fix it by
 > replacing THR_FLAGS_SUSPENDED with THR_FLAGS_NEED_SUSPEND.

Approved by: re (scottl)
2005-10-11 23:24:25 +00:00
Colin Percival 0f88086d1a Correct a man-in-the-middle SSL version rollback vulnerability.
Security:       FreeBSD-SA-05:21.openssl
Approved by:    re@ (scottl)
2005-10-11 11:53:03 +00:00
cvs2svn bdc8787cc2 This commit was manufactured by cvs2svn to create branch 'RELENG_6_0'. 2005-10-09 17:28:13 +00:00
cvs2svn 968d7a6a6d This commit was manufactured by cvs2svn to create branch 'RELENG_6_0'. 2005-10-07 14:00:07 +00:00
cvs2svn 4f345d81ac This commit was manufactured by cvs2svn to create branch 'RELENG_6_0'. 2005-07-11 04:14:44 +00:00
11109 changed files with 743773 additions and 1729393 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
The compilation of software known as FreeBSD is distributed under the
following terms:
Copyright (c) 1992-2013 The FreeBSD Project. All rights reserved.
Copyright (C) 1992-2005 The FreeBSD Project. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
-1
View File
@@ -9,4 +9,3 @@ subsystem login expires notes
Special cases:
src/* RELENG_4_* Requires Security Officer approval.
src/* RELENG_5_* Requires Security Officer approval.
src/* RELENG_6_* Requires Security Officer approval.
+29 -18
View File
@@ -20,26 +20,34 @@ It is not a registry of 'turf' or private property.
subsystem login notes
-----------------------------
kqueue jmg Pre-commit review requested.
mergemaster dougb Prefers to pre-approve commits
libc/posix1e rwatson Pre-commit review requested.
POSIX.1e ACLs rwatson Pre-commit review requested.
UFS EAs rwatson Pre-commit review requested.
MAC Framework rwatson Pre-commit review requested.
MAC Modules rwatson Pre-commit review requested.
contrib/openbsm rwatson Pre-commit review requested.
sys/security/audit rwatson Pre-commit review requested.
ATA/IDE sos Pre-commit review requested.
ahc(4) gibbs Pre-commit review requested.
ahd(4) gibbs Pre-commit review requested.
NEWCARD imp Pre-commit review requested.
OLDCARD imp Pre-commit review requested.
pci bus imp,jhb Pre-commit review requested.
telnet markm Heads-up appreciated. Try not to break it.
secure/* markm Heads-up appreciated. Try not to break it.
kerberos5 nectar Pre-commit review requested.
heimdal nectar Pre-commit review requested.
cdboot jhb Pre-commit review requested.
pxeboot jhb Pre-commit review requested.
witness jhb Pre-commit review requested.
twe [email protected] Pre-commit review requested
twa [email protected] Pre-commit review requested
twe vkashyap Pre-commit review requested
twa vkashyap Pre-commit review requested
aac scottl Pre-commit review requested
udf scottl Pre-commit review requested.
ips scottl Pre-commit review requested.
iir scottl Pre-commit review requested.
mlx scottl Pre-commit review requested.
mly scottl Pre-commit review requested.
maestro3 scottl Pre-commit review requested.
CAM gibbs,
ken Pre-commit review requested. send to [email protected]
devstat(9) ken Pre-commit review requested.
@@ -59,6 +67,8 @@ etc/mail gshapiro Pre-commit review requested.
Keep in sync with -STABLE.
etc/sendmail gshapiro Pre-commit review requested.
Keep in sync with -STABLE.
dhcp mbr Needs to pre-approve commits to contrib/isc-dhcp, so
changes can be made to the isc.org CVS repository.
libfetch des Advance notification requested.
fetch des Advance notification requested.
libpam des Pre-commit review requested.
@@ -73,6 +83,7 @@ pkill gad Heads-up appreciated.
ps gad I am working on a number of changes to this. Would
like advance notice of major changes planned to it.
cvs peter Heads-up appreciated, try not to break it.
ncurses peter Heads-up appreciated, try not to break it.
nvi peter Try not to break it.
libz peter Try not to break it.
pppd/chat peter Try not to break it.
@@ -84,6 +95,8 @@ drm anholt Just keep me informed of changes, try not to break it.
libufs jmallett Willing to handle problems, help with work.
fdc(4) joerg Just keep me informed of changes, try not to break it.
sppp(4) joerg Just keep me informed of changes, try not to break it.
libc nectar Opportuntity for pre-commit review appreciated for
nsdispatch(3) and its consumers.
unifdef(1) fanf Pre-commit review requested.
ntp roberto Pre-commit review requested.
inetd dwmalone Recommends pre-commit review.
@@ -98,7 +111,6 @@ file obrien Insists to keep file blocked from other's unapproved
contrib/bzip2 obrien Pre-commit review required.
lukemftpd obrien Pre-commit review required.
geom_concat pjd Pre-commit review preferred.
geom_eli pjd Pre-commit review preferred.
geom_gate pjd Pre-commit review preferred.
geom_label pjd Pre-commit review preferred.
geom_mirror pjd Pre-commit review preferred.
@@ -106,25 +118,13 @@ geom_nop pjd Pre-commit review preferred.
geom_raid3 pjd Pre-commit review preferred.
geom_shsec pjd Pre-commit review preferred.
geom_stripe pjd Pre-commit review preferred.
geom_zero pjd Pre-commit review preferred.
sbin/geom pjd Pre-commit review preferred.
nfs alfred Will be happy to review code, but not mandatory.
rpc.lockd alfred Will be happy to review code, but not mandatory.
truss alfred Will be happy to review code, but not mandatory.
rpc alfred Pre-commit review requested.
xfs [email protected],[email protected],[email protected]
Pre-commit review preferred.
pkg_install krion Pre-commit review or approval from portmgr@ requested.
linux emul emulation Please discuss changes here.
bs{diff,patch} cperciva Pre-commit review requested.
portsnap cperciva Pre-commit review requested.
sys/netgraph/bluetooth emax Pre-commit review preferred.
lib/libbluetooth emax Pre-commit review preferred.
lib/libsdp emax Pre-commit review preferred.
usr.bin/bluetooth emax Pre-commit review preferred.
usr.sbin/bluetooth emax Pre-commit review preferred.
gnu/usr.bin/send-pr bugmaster Pre-commit review requested.
ncurses rafan Heads-up appreciated, try not to break it.
Following are the entries from the Makefiles, and a few other sources.
Please remove stale entries from both their origin, and this file.
@@ -135,7 +135,18 @@ stating your preferences here instead.
List below generated with:
$ cd /usr/src; find */* -type f|xargs egrep 'MAINTAINER[ <tab>]*='
bin/dd/Makefile:MAINTAINER= [email protected]
games/fortune/datfiles/Makefile:MAINTAINER= jkh
gnu/usr.bin/man/apropos/Makefile:MAINTAINER= wosch
sbin/dhclient/Makefile.inc:MAINTAINER= mbr
sys/compat/svr4/Makefile:MAINTAINER= [email protected]
sys/dev/asr/MAINTAINER:MAINTAINER = obrien@freebsd, [email protected], [email protected]
sys/dev/bktr/CHANGELOG.TXT: * MAINTAINER = Roger Hardiman <[email protected]>
sys/modules/3dfx/Makefile:MAINTAINER= [email protected]
sys/modules/bktr/bktr_mem/Makefile:MAINTAINER= [email protected]
sys/modules/streams/Makefile:MAINTAINER= [email protected]
sys/modules/svr4/Makefile:MAINTAINER= [email protected]
sys/modules/urio/Makefile:MAINTAINER= Iwasa Kazmi <[email protected]>
tools/tools/sysdoc/Makefile:MAINTAINER= [email protected]
usr.bin/locate/Makefile:MAINTAINER= wosch
usr.sbin/zic/Makefile:MAINTAINER= [email protected]
+43 -46
View File
@@ -16,9 +16,6 @@
# reinstallkernel.debug
# kernel - buildkernel + installkernel.
# update - Convenient way to update your source tree (cvs).
# check-old - Print a list of old files/directories in the system.
# delete-old - Delete obsolete files and directories interactively.
# delete-old-libs - Delete obsolete libraries interactively.
#
# This makefile is simple by design. The FreeBSD make automatically reads
# the /usr/share/mk/sys.mk unless the -m argument is specified on the
@@ -41,22 +38,20 @@
# For individuals wanting to upgrade their sources (even if only a
# delta of a few days):
#
# 1. `cd /usr/src' (or to the directory containing your source tree).
# 2. `make buildworld'
# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
# 5. `reboot' (in single user mode: boot -s from the loader prompt).
# 6. `mergemaster -p'
# 7. `make installworld'
# 8. `make delete-old'
# 9. `mergemaster'
# 10. `reboot'
# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
# 1. `cd /usr/src' (or to the directory containing your source tree).
# 2. `make buildworld'
# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
# 5. `reboot' (in single user mode: boot -s from the loader prompt).
# 6. `mergemaster -p'
# 7. `make installworld'
# 8. `mergemaster'
# 9. `reboot'
#
# See src/UPDATING `COMMON ITEMS' for more complete information.
#
# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
# cross build world for other machine types using the buildworld target,
# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can
# cross build world for other architectures using the buildworld target,
# and once the world is built you can cross build a kernel using the
# buildkernel target.
#
@@ -67,11 +62,9 @@
# developer convenience only. They are intentionally not documented and
# completely subject to change without notice.
#
# For more information, see the build(7) manual page.
#
TGTS= all all-man buildenv buildkernel buildworld check-old checkdpadd \
clean cleandepend cleandir delete-old delete-old-libs depend \
distribute distributeworld distrib-dirs distribution everything \
TGTS= all all-man buildenv buildkernel buildworld checkdpadd clean \
cleandepend cleandir depend distribute distributeworld \
distribution everything \
hierarchy install installcheck installkernel installkernel.debug\
reinstallkernel reinstallkernel.debug installworld \
kernel-toolchain libraries lint maninstall \
@@ -95,11 +88,11 @@ TGTS+= ${BITGTS}
PATH= /sbin:/bin:/usr/sbin:/usr/bin
MAKEOBJDIRPREFIX?= /usr/obj
_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} \
-f /dev/null -V MAKEOBJDIRPREFIX dummy
.if !empty(_MAKEOBJDIRPREFIX)
.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
(in make.conf(5)) or command-line variable.
(in /etc/make.conf) or command-line variable.
.endif
MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
BINMAKE= \
@@ -261,38 +254,31 @@ make: .PHONY
# with a reasonable chance of success, regardless of how old your
# existing system is.
#
.if make(universe)
universe: universe_prologue
universe_prologue:
@echo "--------------------------------------------------------------"
@echo ">>> make universe started on ${STARTTIME}"
@echo "--------------------------------------------------------------"
.for target in alpha amd64 i386 ia64 pc98 powerpc sparc64
KERNCONFS!= cd ${.CURDIR}/sys/${target}/conf && \
find [A-Z]*[A-Z] -type f -maxdepth 0 \
! -name DEFAULTS ! -name LINT
KERNCONFS:= ${KERNCONFS:S/^NOTES$/LINT/}
universe: universe_${target}
.ORDER: universe_prologue universe_${target} universe_epilogue
universe_${target}:
@echo ">> ${target} started on `LC_ALL=C date`"
.for target in i386 i386:pc98 sparc64 alpha ia64 amd64
.for arch in ${target:C/:.*$//}
.for mach in ${target:C/^.*://}
universe: universe_${mach}
.ORDER: universe_prologue universe_${mach} universe_epilogue
universe_${mach}:
@echo ">> ${mach} started on `LC_ALL=C date`"
-cd ${.CURDIR} && ${MAKE} ${JFLAG} buildworld \
TARGET=${target} \
TARGET_ARCH=${arch} TARGET=${mach} \
__MAKE_CONF=/dev/null \
> _.${target}.buildworld 2>&1
@echo ">> ${target} buildworld completed on `LC_ALL=C date`"
.if exists(${.CURDIR}/sys/${target}/conf/NOTES)
-cd ${.CURDIR}/sys/${target}/conf && ${MAKE} LINT \
> ${.CURDIR}/_.${target}.makeLINT 2>&1
> _.${mach}.buildworld 2>&1
@echo ">> ${mach} buildworld completed on `LC_ALL=C date`"
.if exists(${.CURDIR}/sys/${mach}/conf/NOTES)
-cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \
> ${.CURDIR}/_.${mach}.makeLINT 2>&1
.endif
.for kernel in ${KERNCONFS}
-cd ${.CURDIR} && ${MAKE} ${JFLAG} buildkernel \
TARGET=${target} \
KERNCONF=${kernel} \
__MAKE_CONF=/dev/null \
> _.${target}.${kernel} 2>&1
cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach}
@echo ">> ${mach} completed on `LC_ALL=C date`"
.endfor
.endfor
@echo ">> ${target} completed on `LC_ALL=C date`"
.endfor
universe: universe_epilogue
universe_epilogue:
@@ -300,4 +286,15 @@ universe_epilogue:
@echo ">>> make universe completed on `LC_ALL=C date`"
@echo " (started ${STARTTIME})"
@echo "--------------------------------------------------------------"
.if make(buildkernels)
KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \
find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES
buildkernels:
.for kernel in ${KERNCONFS}
-cd ${.CURDIR} && ${MAKE} ${JFLAG} buildkernel \
KERNCONF=${kernel} \
__MAKE_CONF=/dev/null \
> _.${TARGET}.${kernel} 2>&1
.endfor
.endif
+70 -209
View File
@@ -22,7 +22,7 @@
# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
# -DNO_DOCUPDATE do not update doc in ${MAKE} update
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
# TARGET="machine" to crossbuild world for a different machine type
# TARGET_ARCH="arch" to crossbuild world to a different arch
#
# The intended user-driven targets are:
@@ -87,9 +87,9 @@ CLEANDIR= cleandir
.endif
CVS?= cvs
CVSFLAGS?= -r RELENG_6 -P -d -I!
SUP?= /usr/bin/csup
SUPFLAGS?= -g -L 2
CVSFLAGS?= -r RELENG_6_0 -P -d -I!
SUP?= /usr/local/bin/cvsup
SUPFLAGS?= -g -L 2 -P -
.if defined(SUPHOST)
SUPFLAGS+= -h ${SUPHOST}
.endif
@@ -103,36 +103,14 @@ OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
OSRELDATE= 0
.endif
.endif
# Guess machine architecture from machine type, and vice versa.
.if !defined(TARGET_ARCH) && defined(TARGET)
TARGET_ARCH= ${TARGET:S/pc98/i386/}
.elif !defined(TARGET) && defined(TARGET_ARCH) && \
${TARGET_ARCH} != ${MACHINE_ARCH}
TARGET= ${TARGET_ARCH}
.endif
# Otherwise, default to current machine type and architecture.
TARGET?= ${MACHINE}
TARGET_ARCH?= ${MACHINE_ARCH}
KNOWN_ARCHES?= alpha amd64 arm i386 i386/pc98 ia64 powerpc sparc64
.if ${TARGET} == ${TARGET_ARCH}
_t= ${TARGET}
.else
_t= ${TARGET_ARCH}/${TARGET}
.endif
.for _t in ${_t}
.if empty(KNOWN_ARCHES:M${_t})
.error Unknown target ${TARGET_ARCH}:${TARGET}.
.endif
.endfor
.if ${TARGET} == ${MACHINE}
.if ${TARGET_ARCH} == ${MACHINE_ARCH}
TARGET?= ${MACHINE}
TARGET_CPUTYPE?=${CPUTYPE}
.else
TARGET?= ${TARGET_ARCH}
TARGET_CPUTYPE?=
.endif
.if !empty(TARGET_CPUTYPE)
_TARGET_CPUTYPE=${TARGET_CPUTYPE}
.else
@@ -144,7 +122,7 @@ _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
.error CPUTYPE global should be set with ?=.
.endif
.if make(buildworld)
BUILD_ARCH!= uname -p
BUILD_ARCH!= sysctl -n hw.machine_arch
.if ${MACHINE_ARCH} != ${BUILD_ARCH}
.error To cross-build, set TARGET_ARCH.
.endif
@@ -214,14 +192,11 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
# build-tools stage
TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
${BMAKEENV} ${MAKE} -f Makefile.inc1 \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
# cross-tools stage
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
-DNO_FORTRAN -DNO_GDB
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
# world stage
WMAKEENV= ${CROSSENV} \
@@ -234,35 +209,41 @@ WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
# 32 bit world
LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
.if empty(TARGET_CPUTYPE)
LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
.else
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
.endif
LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -mfancy-math-387 -DCOMPAT_32BIT \
-iprefix ${LIB32TMP}/usr/ \
LIB32PREFLAGS= -m32 -march=athlon-xp -msse2 -mfancy-math-387 -DCOMPAT_32BIT
LIB32POSTFLAGS= -I${LIB32TMP}/usr/include \
-L${LIB32TMP}/usr/lib32 \
-B${LIB32TMP}/usr/lib32
LIB32CC= ${LIB32PREFLAGS} \
${LIB32POSTFLAGS}
LIB32CXX= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/c++/3.4 \
${LIB32POSTFLAGS}
LIB32OBJC= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/objc \
${LIB32POSTFLAGS}
# Yes, the flags are redundant.
LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
LIB32MAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
_SHLIBDIRPREFIX=${LIB32TMP} \
MACHINE=i386 \
MACHINE_ARCH=i386 \
INSTALL="sh ${.CURDIR}/tools/install.sh" \
PATH=${TMPPATH} \
CC="${CC} ${LIB32FLAGS}" \
CXX="${CXX} ${LIB32FLAGS}" \
OBJC="${OBJC} ${LIB32FLAGS}" \
CC="${CC} ${LIB32CC}" \
CXX="${CXX} ${LIB32CXX}" \
OBJC="${OBJC} ${LIB32OBJC}" \
LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
AS="${AS} --32" \
LIBDIR=/usr/lib32 \
SHLIBDIR=/usr/lib32
LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
LIB32MAKE= ${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
-DNO_BIND -DNO_MAN -DNO_NLS -DNO_INFO -DNO_HTML \
DESTDIR=${LIB32TMP}
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
CC="${CC} ${LIB32CC}" \
CXX="${CXX} ${LIB32CXX}" \
OBJC="${OBJC} ${LIB32OBJC}" \
LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
AS="${AS} --32" \
LIBDIR=/usr/lib32 \
SHLIBDIR=/usr/lib32
.endif
# install stage
@@ -299,9 +280,6 @@ _worldtmp:
@echo "--------------------------------------------------------------"
.if !defined(NO_CLEAN)
rm -rf ${WORLDTMP}
.if ${TARGET_ARCH} == "amd64"
rm -rf ${LIB32TMP}
.endif
.else
rm -rf ${WORLDTMP}/legacy/usr/include
# XXX - These two can depend on any header file.
@@ -360,9 +338,6 @@ _cleanobj:
@echo ">>> stage 2.1: cleaning up the object tree"
@echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
.if ${TARGET_ARCH} == "amd64"
${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
.endif
.endif
_obj:
@echo
@@ -422,7 +397,6 @@ build32:
.endfor
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${LIB32TMP}/usr/include >/dev/null
mkdir -p ${WORLDTMP}
ln -sf ${.CURDIR}/sys ${WORLDTMP}
.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
.for _t in obj depend all
@@ -431,28 +405,34 @@ build32:
.endfor
.endif
.for _t in obj includes
cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t}
cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t}
cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t}
cd ${.CURDIR}/include; \
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
cd ${.CURDIR}/lib; \
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
cd ${.CURDIR}/gnu/lib; \
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
.if !defined(NO_CRYPT)
cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t}
cd ${.CURDIR}/secure/lib; \
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
.endif
.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t}
cd ${.CURDIR}/kerberos5/lib; \
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
.endif
.endfor
.for _dir in usr.sbin/pcvt/keycap usr.bin/lex/lib
cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj
cd ${.CURDIR}/${_dir}; \
${LIB32MAKE} DESTDIR=${LIB32TMP} obj
.endfor
.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
.for _dir in lib/libncurses lib/libmagic
cd ${.CURDIR}/${_dir}; \
MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools
.endfor
cd ${.CURDIR}; \
${LIB32WMAKE} -f Makefile.inc1 libraries
${LIB32MAKE} -f Makefile.inc1 DESTDIR=${LIB32TMP} libraries
.for _t in obj depend all
cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t}
cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} ${_t}
cd ${.CURDIR}/libexec/rtld-elf; \
PROG=ld-elf32.so.1 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
.endfor
distribute32 install32:
@@ -461,16 +441,15 @@ distribute32 install32:
.else
mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
.endif
cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
cd ${.CURDIR}/lib; ${LIB32MAKE} ${.TARGET:S/32$//}
cd ${.CURDIR}/gnu/lib; ${LIB32MAKE} ${.TARGET:S/32$//}
.if !defined(NO_CRYPT)
cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
cd ${.CURDIR}/secure/lib; ${LIB32MAKE} ${.TARGET:S/32$//}
.endif
cd ${.CURDIR}/libexec/rtld-elf; \
PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32MAKE} ${.TARGET:S/32$//}
.endif
WMAKE_TGTS=
.if !defined(SUBDIR_OVERRIDE)
WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
@@ -500,27 +479,13 @@ kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
#
SPECIAL_INSTALLCHECKS=
#
# Require DESTDIR to be set if installing for a different architecture.
#
.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
.if !make(distributeworld)
SPECIAL_INSTALLCHECKS+= installcheck_DESTDIR
installcheck_DESTDIR:
.if !defined(DESTDIR) || empty(DESTDIR)
@echo "ERROR: Please set DESTDIR!"; \
false
.endif
.endif
.endif
#
# installcheck
#
# Checks to be sure system is ready for installworld
#
CHECK_UIDS=
CHECK_GIDS= audit
CHECK_GIDS=
.if !defined(NO_SENDMAIL)
CHECK_UIDS+= smmsp
CHECK_GIDS+= smmsp
@@ -556,7 +521,7 @@ distributeworld installworld: installcheck
mkdir -p ${INSTALLTMP}
for prog in [ awk cap_mkdb cat chflags chmod chown \
date echo egrep find grep install-info \
ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
test true uname wc zic; do \
cp `which $$prog` ${INSTALLTMP}; \
done
@@ -590,12 +555,11 @@ redistribute:
@echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
.if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
DISTRIBUTION=lib32
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32
.endif
distrib-dirs distribution:
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
distribution:
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} distribution
#
# buildkernel and installkernel
@@ -727,6 +691,12 @@ reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
false
.endif
@echo "--------------------------------------------------------------"
@echo ">>> Making hierarchy"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; \
${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Installing kernel"
@echo "--------------------------------------------------------------"
@@ -806,7 +776,7 @@ _strfile= games/fortune/strfile
.if !defined(NO_CXX)
_gperf= gnu/usr.bin/gperf
.if ${BOOTSTRAPPING} < 600101
.if ${BOOTSTRAPPING} < 500113
_groff= gnu/usr.bin/groff
.else
_groff= gnu/usr.bin/groff/tmac
@@ -833,10 +803,6 @@ _gencat= usr.bin/gencat
_mklocale= usr.bin/mklocale
.endif
.if ${BOOTSTRAPPING} < 602106
_gensnmptree= usr.sbin/bsnmpd/gensnmptree
.endif
.if !defined(NO_RESCUE) && \
${BOOTSTRAPPING} < 600008
_crunchgen= usr.sbin/crunch/crunchgen
@@ -860,7 +826,6 @@ bootstrap-tools:
${_mklocale} \
usr.bin/rpcgen \
usr.bin/xinstall \
${_gensnmptree} \
usr.sbin/config \
${_crunchgen} \
${_pwd_mkdb}
@@ -896,8 +861,7 @@ build-tools:
bin/csh \
bin/sh \
${_rescue} \
lib/ncurses/ncurses \
lib/ncurses/ncursesw \
lib/libncurses \
${_share} \
${_aicasm} \
usr.bin/awk \
@@ -1000,10 +964,9 @@ _prebuild_libs+= kerberos5/lib/libroken
_generic_libs+= kerberos5/lib
.endif
_prebuild_libs+= lib/libbz2 lib/libcom_err lib/libcrypt lib/libexpat \
_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
lib/libkvm lib/libmd \
lib/ncurses/ncurses lib/ncurses/ncursesw \
lib/libnetgraph lib/libopie lib/libpam \
lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
lib/libradius \
lib/libsbuf lib/libtacplus lib/libutil \
lib/libz lib/msun
@@ -1019,11 +982,10 @@ lib/libradius__L: secure/lib/libssl__L
secure/lib/libssl__L: secure/lib/libcrypto__L
.if !defined(NO_OPENSSH)
_prebuild_libs+= secure/lib/libssh
secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L \
lib/libmd__L
secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
.if !defined(NO_KERBEROS)
secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
kerberos5/lib/libasn1__L lib/libcom_err__L \
kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
kerberos5/lib/libroken__L
.endif
.endif
@@ -1041,16 +1003,15 @@ _prebuild_libs+= lib/libypclnt
_generic_libs+= usr.bin/lex/lib
.if ${MACHINE} == "i386"
.if ${MACHINE_ARCH} == "i386"
_generic_libs+= usr.sbin/pcvt/keycap
.endif
.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
${_lib}__L: .PHONY
.if exists(${.CURDIR}/${_lib})
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
${_+_}@${ECHODIR} "===> ${_lib} (depend,all,install)"; \
cd ${.CURDIR}/${_lib}; \
${MAKE} DIRPRFX=${_lib}/ obj; \
${MAKE} DIRPRFX=${_lib}/ depend; \
${MAKE} DIRPRFX=${_lib}/ all; \
${MAKE} DIRPRFX=${_lib}/ install
@@ -1061,9 +1022,8 @@ ${_lib}__L: .PHONY
# static PAM library, and dynamic PAM library before dynamic PAM
# modules.
lib/libpam__L: .PHONY
${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
${_+_}@${ECHODIR} "===> lib/libpam (depend,all,install)"; \
cd ${.CURDIR}/lib/libpam; \
${MAKE} DIRPRFX=lib/libpam/ obj; \
${MAKE} DIRPRFX=lib/libpam/ depend; \
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
@@ -1090,102 +1050,3 @@ par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
.endfor
.include <bsd.subdir.mk>
.if make(delete-old) || make(delete-old-libs) || make(check-old)
#
# check for / delete old files section
#
.include "ObsoleteFiles.inc"
OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
else you can not start such an application. Consult UPDATING for more \
information regarding how to cope with the removal/revision bump of a \
specific library."
.if !defined(BATCH_DELETE_OLD_FILES)
RM_I=-i
.else
RM_I=-v
.endif
delete-old-files:
@echo ">>> Removing old files (only deletes safe to delete libs)"
.for file in ${OLD_FILES}
# Ask for every old file if the user really wants to remove it.
# It's annoying, but better safe than sorry.
@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
|| ([ -f "${DESTDIR}/${file}" ] \
&& echo "Removing schg flag on ${DESTDIR}/${file}" \
&& chflags noschg "${DESTDIR}/${file}" \
&& rm ${RM_I} "${DESTDIR}/${file}"))
.endfor
# Remove catpages without corresponding manpages.
@3<&0; \
find ${DESTDIR}/usr/share/man/cat* ! -type d | \
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
while read catpage; do \
read manpage; \
if [ ! -e "$${manpage}" ]; then \
rm ${RM_I} $${catpage} <&3 ; \
fi; \
done
@echo ">>> Old files removed"
check-old-files:
@echo ">>> Checking for old files"
.for file in ${OLD_FILES}
@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
.endfor
# Check for catpages without corresponding manpages.
@find ${DESTDIR}/usr/share/man/cat* ! -type d | \
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
while read catpage; do \
read manpage; \
if [ ! -e "$${manpage}" ]; then \
echo $${catpage} ; \
fi; \
done
delete-old-libs:
@echo ">>> Removing old libraries"
@echo "${OLD_LIBS_MESSAGE}" | fmt
.for file in ${OLD_LIBS}
@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
|| ([ -f "${DESTDIR}/${file}" ] \
&& echo "Removing schg flag on ${DESTDIR}/${file}" \
&& chflags noschg "${DESTDIR}/${file}" \
&& rm ${RM_I} "${DESTDIR}/${file}"))
.endfor
@echo ">>> Old libraries removed"
check-old-libs:
@echo ">>> Checking for old libraries"
.for file in ${OLD_LIBS}
@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
.endfor
delete-old-dirs:
@echo ">>> Removing old directories"
.for dir in ${OLD_DIRS}
# Don't fail if an old directory isn't empty.
@[ ! -d "${DESTDIR}/${dir}" ] || (rmdir -v "${DESTDIR}/${dir}" || true)
.endfor
@echo ">>> Old directories removed"
check-old-dirs:
@echo ">>> Checking for old directories"
.for dir in ${OLD_DIRS}
@[ ! -d "${DESTDIR}/${dir}" ] || echo "${DESTDIR}/${dir}"
.endfor
delete-old: delete-old-files delete-old-dirs
@echo "To remove old libraries run '${MAKE} delete-old-libs'."
check-old: check-old-files check-old-libs check-old-dirs
@echo "To remove old files and directories run '${MAKE} delete-old'."
@echo "To remove old libraries run '${MAKE} delete-old-libs'."
.endif
-2944
View File
File diff suppressed because it is too large. Load diff
-2
View File
@@ -59,8 +59,6 @@ libexec System daemons.
release Release building Makefile & associated tools.
rescue Build system for statically linked /rescue utilities.
sbin System commands.
secure Cryptographic libraries and commands.
+5 -169
View File
@@ -8,165 +8,12 @@ Items affecting the ports and packages system can be found in
/usr/ports/UPDATING. Please read that file before running
portupgrade.
20091129:
PECOFF image activator support removed.
20081128:
FreeBSD 6.4-RELEASE
20080904:
ntpd upgraded to 4.2.4p5.
20080118:
FreeBSD 6.3-RELEASE
20071126:
The AT keyboard emulation of sunkbd(4) has been turned on
by default. In order to make the special symbols of the Sun
keyboards driven by sunkbd(4) work under X these now have
to be configured the same way as Sun USB keyboards driven
by ukbd(4) (which also does AT keyboard emulation), f.e.:
Option "XkbLayout" "us"
Option "XkbRules" "xorg"
Option "XkbSymbols" "pc(pc105)+sun_vndr/usb(sun_usb)+us"
20071024:
A breakage was introduced in libc and fixed later. Make sure
you have lib/Makefile rev 1.205.2.4. If it already breaks your
world, you can recover it by
- reboot to single user mode, make sure you use /rescue/sh
instead of /bin/sh
- use /rescue/chflags to remove schg flag on /lib/libc.so.6
- use /rescue/cp to copy libc.so.6 from /usr/obj to /lib/libc.so.6
- continue installworld, you should be fine now
20070806:
An incorrect field size in an ioctl struct for if_bridge(4) has been
corrected, ifconfig(8) will need to be recompilied.
20070426:
The ABI breakage in sendmail(8)'s libmilter has been repaired
so it is no longer necessary to recompile mail filters (aka,
milters). If you recompiled mail filters after the 20070411
note, it is not necessary to recompile them again.
20070411:
sendmail(8) has been updated to version 8.14.1. Mail filters
(aka, milters) compiled against the libmilter included in the
base operating system should be recompiled.
20070115:
FreeBSD 6.2-RELEASE
20060902:
The IEEE80211_IOC_STA_INFO ioctl was updated to take a mac
address parameter. Binaries using the old ioctl number will
continue to work but user applications that use this must
be updated (none exist in the base system).
20060818:
The NMBCLUSTERS kernel option has been removed because it is obsolete.
Use the kern.ipc.nmbclusters loader(8) tunable instead.
20060816:
The IPFIREWALL_FORWARD_EXTENDED option is gone and the behaviour
for IPFIREWALL_FORWARD is now as it was before when it was first
committed and for years thereafter. The behaviour is now ON.
20060806:
The interface version of the i4b kernel part has changed. So
after updating the kernel sources and compiling a new kernel,
the i4b user space tools in "/usr/src/usr.sbin/i4b" must also
be rebuilt, and vice versa. This also applies to other tools
using the i4b kernel interface to userland.
20060711:
The iwi(4) was updated to use the firmware(9) framework. In order
for it to work you need a port change from net/iwi-firmware to
net/iwi-firmware-kmod.
20060506:
FreeBSD 6.1-RELEASE
20060309:
The support for Linux applications the 3dfx kernel module used
to provide is in a separate module named 3dfx_linux now. The
latter will pull in 3dfx.ko and linux.ko through its dependencies
when loaded.
20060211:
An IPv6 support of ipfw was enabled by default. If you don't
want to filter an IPv6 by ipfw, please add following line into
your ipfw rule:
pass ip6 from any to any
20060210:
Now most modules get their build-time options from the kernel
configuration file. A few modules still have fixed options
due to their non-conformant implementation, but they will be
corrected eventually. You may need to review the options of
the modules in use, explicitly specify the non-default options
in the kernel configuration file, and rebuild the kernel and
modules afterwards.
20060204:
The 'audit' group was added to support the new auditing functionality
in the base system. Be sure to follow the directions for updating,
including the requirement to run mergemaster -p.
20060127:
The i386 loader(8) now defaults to the serial speed set by the
previous boot stage, if the comconsole is already in use. If
you've changed BOOT_COMCONSOLE_SPEED in make.conf(5) and
installed a new loader, but have not rebuilt and reinstalled the
boot blocks, then your loader will leave the console at 9600
baud. Either install the new boot blocks, or set
comconsole_speed in loader.conf(5). Note that the new boot
blocks also support a -S<speed> flag described in boot(8).
20060122:
/etc/rc.d/ppp-user has been renamed to /etc/rc.d/ppp.
Its /etc/rc.conf.d configuration file has been `ppp' from
the beginning, and hence there is no need to touch it.
20060113:
si(4)'s device files now contain the unit number.
Uses of {cua,tty}A[0-9a-f] should be replaced by {cua,tty}A0[0-9a-f].
20051230:
A lot of fixes and new features in the soundsystem. To get all
benefits, you may want to recompile mplayer (if installed) after
booting the new world.
20051222:
Bug fixes to the trimdomain(3) function in libutil may result in
slight changes to the host names appearing in log files under
relatively rare circumstances.
20051220:
Scripts in the local_startup directories (as defined in
/etc/defaults/rc.conf) that have the new rc.d semantics will
now be run as part of the base system rcorder. If there are
errors or problems with one of these local scripts, it could
cause boot problems. If you encounter such problems, boot in
single user mode, remove that script from the */rc.d directory.
Please report the problem to the port's maintainer, and the
[email protected] mailing list.
20051215:
The setkey(8) utility was moved from /usr/sbin/setkey to /sbin/setkey.
You may want to update scripts which depend on its location.
20051108:
rp(4)'s device files now contain the unit number.
Uses of {cua,tty}R[0-9a-f] should be replaced by {cua,tty}R0[0-9a-f].
20051101:
FreeBSD 6.0-RELEASE
20051011: FreeBSD-SA-05:21.openssl
Correct a man-in-the-middle SSL version rollback vulnerability.
20051001:
kern.polling.enable sysctl MIB is now deprecated. Use ifconfig(8)
to turn polling(4) on your interfaces.
@@ -250,8 +97,7 @@ portupgrade.
20050227:
The on-disk format of LC_CTYPE files was changed to be machine
independent. Please make sure NOT to use NO_CLEAN buildworld
when crossing this point. Crossing this point also requires
recompile or reinstall of all locale depended packages.
when crossing this point.
20050225:
The ifi_epoch member of struct if_data has been changed to
@@ -388,13 +234,6 @@ COMMON ITEMS:
Due to several updates to the build infrastructure, source
upgrades from versions prior to 5.3 no longer supported.
When upgrading from one major version to another it is generally
best to upgrade to the latest code in the currently installed branch
first, then do an upgrade to the new branch. This is the best-tested
upgrade path, and has the highest probability of being successful.
Please try this approach before reporting problems with a major
version upgrade.
To build a kernel
-----------------
If you are updating from a prior version of FreeBSD (even one just
@@ -438,7 +277,6 @@ COMMON ITEMS:
<reboot in single user> [3]
mergemaster -p [5]
make installworld
make delete-old
mergemaster [4]
<reboot>
@@ -476,7 +314,6 @@ COMMON ITEMS:
<reboot in single user> [3]
mergemaster -p [5]
make installworld
make delete-old
mergemaster -i [4]
<reboot>
@@ -519,8 +356,7 @@ COMMON ITEMS:
[8] In order to have a kernel that can run the 5.x binaries
needed to do an installworld, you must include the COMPAT_FREEBSD5
option in your kernel. Failure to do so may leave you with a system
that is hard to boot to recover. A similar kernel option COMPAT_FREEBSD5
is required to run the 5.x binaries on more recent kernels.
that is hard to boot to recover.
Make sure that you merge any new devices from GENERIC since the
last time you updated your kernel config file.
+13 -55
View File
@@ -32,7 +32,7 @@
.\" @(#)chflags.1 8.4 (Berkeley) 5/2/95
.\" $FreeBSD$
.\"
.Dd March 3, 2006
.Dd May 14, 2005
.Dt CHFLAGS 1
.Os
.Sh NAME
@@ -85,24 +85,24 @@ The flags are specified as an octal number or a comma separated list
of keywords.
The following keywords are currently defined:
.Pp
.Bl -tag -offset indent -width ".Cm opaque"
.It Cm arch , archived
.Bl -tag -offset indent -width ".Ar opaque"
.It Ar arch , archived
set the archived flag (super-user only)
.It Cm opaque
.It Ar opaque
set the opaque flag (owner or super-user only)
.It Cm nodump
.It Ar nodump
set the nodump flag (owner or super-user only)
.It Cm sappnd , sappend
.It Ar sappnd , sappend
set the system append-only flag (super-user only)
.It Cm schg , schange , simmutable
.It Ar schg , schange , simmutable
set the system immutable flag (super-user only)
.It Cm sunlnk , sunlink
.It Ar sunlnk , sunlink
set the system undeletable flag (super-user only)
.It Cm uappnd , uappend
.It Ar uappnd , uappend
set the user append-only flag (owner or super-user only)
.It Cm uchg , uchange , uimmutable
.It Ar uchg , uchange , uimmutable
set the user immutable flag (owner or super-user only)
.It Cm uunlnk , uunlink
.It Ar uunlnk , uunlink
set the user undeletable flag (owner or super-user only)
.El
.Pp
@@ -114,45 +114,12 @@ from a keyword causes the flag to be cleared.
For example:
.Pp
.Bl -tag -offset indent -width "nouchg" -compact
.It Cm nouchg
.It Ar nouchg
clear the user immutable flag (owner or super-user only)
.It Cm dump
.It Ar dump
clear the nodump flag (owner or super-user only)
.El
.Pp
A few of the octal values include:
.Bl -tag -offset indent -width ".Li 10"
.It Li 0
Clear all file flags.
.It Li 1
Translates to the
.Cm nodump
keyword.
.It Li 2
Translates to the
.Cm uchg
keyword.
.It Li 3
Translates to the
.Cm uchg , nodump
keywords.
.It Li 4
Translates to the
.Cm uappnd
keyword.
.It Li 10
Translates to the
.Cm opaque
keyword.
.It Li 20
translates to the
.Cm uunlnk
keyword.
.El
.Pp
Other combinations of keywords may be placed by using
the octets assigned; however, these are the most notable.
.Pp
Unless the
.Fl H ,
.Fl L ,
@@ -173,14 +140,6 @@ In addition, these options override each other and the
command's actions are determined by the last one specified.
.Pp
You can use "ls -lo" to see the flags of existing files.
.Pp
Note that the ability to change certain flags is dependent
on the current kernel
.Va securelevel
setting.
See
.Xr security 7
for more information on this setting.
.Sh EXIT STATUS
.Ex -std
.Sh SEE ALSO
@@ -188,7 +147,6 @@ for more information on this setting.
.Xr chflags 2 ,
.Xr stat 2 ,
.Xr fts 3 ,
.Xr security 7 ,
.Xr symlink 7
.Sh HISTORY
The
+3 -5
View File
@@ -32,7 +32,7 @@
.\" @(#)cp.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd August 24, 2006
.Dd February 23, 2005
.Dt CP 1
.Os
.Sh NAME
@@ -45,7 +45,7 @@
.Op Fl H | Fl L | Fl P
.Oc
.Op Fl f | i | n
.Op Fl lpv
.Op Fl pv
.Ar source_file target_file
.Nm
.Oo
@@ -53,7 +53,7 @@
.Op Fl H | Fl L | Fl P
.Oc
.Op Fl f | i | n
.Op Fl lpv
.Op Fl pv
.Ar source_file ... target_directory
.Sh DESCRIPTION
In the first synopsis form, the
@@ -144,8 +144,6 @@ option overrides any previous
or
.Fl n
options.)
.It Fl l
Create hard links to regular files in a hierarchy instead of copying.
.It Fl n
Do not overwrite an existing file.
(The
+3 -12
View File
@@ -83,7 +83,7 @@ static char emptystring[] = "";
PATH_T to = { to.p_path, emptystring, "" };
int fflag, iflag, lflag, nflag, pflag, vflag;
int fflag, iflag, nflag, pflag, vflag;
static int Rflag, rflag;
volatile sig_atomic_t info;
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
char *target;
Hflag = Lflag = Pflag = 0;
while ((ch = getopt(argc, argv, "HLPRfinprvl")) != -1)
while ((ch = getopt(argc, argv, "HLPRfinprv")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@@ -140,9 +140,6 @@ main(int argc, char *argv[])
case 'v':
vflag = 1;
break;
case 'l':
lflag = 1;
break;
default:
usage();
break;
@@ -366,10 +363,7 @@ copy(char *argv[], enum op type, int fts_options)
*/
if (pflag) {
if (setfile(curr->fts_statp, -1))
rval = 1;
if (preserve_dir_acls(curr->fts_statp,
curr->fts_accpath, to.p_path) != 0)
rval = 1;
rval = 1;
} else {
mode = curr->fts_statp->st_mode;
if ((mode & (S_ISUID | S_ISGID | S_ISTXT)) ||
@@ -460,9 +454,6 @@ copy(char *argv[], enum op type, int fts_options)
badcp = rval = 1;
}
break;
case S_IFSOCK:
warnx("%s is a socket (not copied).",
curr->fts_path);
case S_IFIFO:
if (Rflag) {
if (copy_fifo(curr->fts_statp, !dne))
+1 -3
View File
@@ -37,7 +37,7 @@ typedef struct {
} PATH_T;
extern PATH_T to;
extern int fflag, iflag, lflag, nflag, pflag, vflag;
extern int fflag, iflag, nflag, pflag, vflag;
extern volatile sig_atomic_t info;
__BEGIN_DECLS
@@ -46,7 +46,5 @@ int copy_file(const FTSENT *, int);
int copy_link(const FTSENT *, int);
int copy_special(struct stat *, int);
int setfile(struct stat *, int);
int preserve_dir_acls(struct stat *, char *, char *);
int preserve_fd_acls(int, int);
void usage(void);
__END_DECLS
+79 -179
View File
@@ -35,8 +35,6 @@ static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/acl.h>
#include <sys/param.h>
#include <sys/stat.h>
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
@@ -54,18 +52,17 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include "extern.h"
#define cp_pct(x, y) ((y == 0) ? 0 : (int)(100.0 * (x) / (y)))
#define cp_pct(x,y) (int)(100.0 * (double)(x) / (double)(y))
int
copy_file(const FTSENT *entp, int dne)
{
static char buf[MAXBSIZE];
struct stat *fs;
int ch, checkch, from_fd, rcount, rval, to_fd;
ssize_t wcount;
size_t wresid;
off_t wtotal;
int ch, checkch, from_fd = 0, rcount, rval, to_fd = 0;
size_t wtotal;
char *bufp;
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
char *p;
@@ -110,20 +107,15 @@ copy_file(const FTSENT *entp, int dne)
/* remove existing destination file name,
* create a new file */
(void)unlink(to.p_path);
if (!lflag)
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
fs->st_mode & ~(S_ISUID | S_ISGID));
} else {
if (!lflag)
/* overwrite existing destination file name */
to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
}
} else {
if (!lflag)
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
fs->st_mode & ~(S_ISUID | S_ISGID));
}
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
fs->st_mode & ~(S_ISUID | S_ISGID));
} else
/* overwrite existing destination file name */
to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
} else
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
fs->st_mode & ~(S_ISUID | S_ISGID));
if (to_fd == -1) {
warn("%s", to.p_path);
(void)close(from_fd);
@@ -132,86 +124,77 @@ copy_file(const FTSENT *entp, int dne)
rval = 0;
if (!lflag) {
/*
* Mmap and write if less than 8M (the limit is so we don't totally
* trash memory on big files. This is really a minor hack, but it
* wins some CPU back.
*/
/*
* Mmap and write if less than 8M (the limit is so we don't totally
* trash memory on big files. This is really a minor hack, but it
* wins some CPU back.
*/
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
if (S_ISREG(fs->st_mode) && fs->st_size > 0 &&
fs->st_size <= 8 * 1048576) {
if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ,
MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) {
warn("%s", entp->fts_path);
rval = 1;
} else {
wtotal = 0;
for (bufp = p, wresid = fs->st_size; ;
bufp += wcount, wresid -= (size_t)wcount) {
wcount = write(to_fd, bufp, wresid);
if (wcount <= 0)
break;
wtotal += wcount;
if (info) {
info = 0;
(void)fprintf(stderr,
"%s -> %s %3d%%\n",
entp->fts_path, to.p_path,
cp_pct(wtotal, fs->st_size));
}
if (wcount >= (ssize_t)wresid)
break;
}
if (wcount != (ssize_t)wresid) {
warn("%s", to.p_path);
rval = 1;
}
/* Some systems don't unmap on close(2). */
if (munmap(p, fs->st_size) < 0) {
warn("%s", entp->fts_path);
rval = 1;
}
}
} else
#endif
{
if (S_ISREG(fs->st_mode) && fs->st_size > 0 &&
fs->st_size <= 8 * 1048576) {
if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ,
MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) {
warn("%s", entp->fts_path);
rval = 1;
} else {
wtotal = 0;
while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) {
for (bufp = buf, wresid = rcount; ;
bufp += wcount, wresid -= wcount) {
wcount = write(to_fd, bufp, wresid);
if (wcount <= 0)
break;
wtotal += wcount;
if (info) {
info = 0;
(void)fprintf(stderr,
"%s -> %s %3d%%\n",
entp->fts_path, to.p_path,
cp_pct(wtotal, fs->st_size));
}
if (wcount >= (ssize_t)wresid)
break;
for (bufp = p, wresid = fs->st_size; ;
bufp += wcount, wresid -= (size_t)wcount) {
wcount = write(to_fd, bufp, wresid);
wtotal += wcount;
if (info) {
info = 0;
(void)fprintf(stderr,
"%s -> %s %3d%%\n",
entp->fts_path, to.p_path,
cp_pct(wtotal, fs->st_size));
}
if (wcount != (ssize_t)wresid) {
warn("%s", to.p_path);
rval = 1;
if (wcount >= (ssize_t)wresid || wcount <= 0)
break;
}
}
if (rcount < 0) {
if (wcount != (ssize_t)wresid) {
warn("%s", to.p_path);
rval = 1;
}
/* Some systems don't unmap on close(2). */
if (munmap(p, fs->st_size) < 0) {
warn("%s", entp->fts_path);
rval = 1;
}
}
} else {
if (link(entp->fts_path, to.p_path)) {
warn("%s", to.p_path);
} else
#endif
{
wtotal = 0;
while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) {
for (bufp = buf, wresid = rcount; ;
bufp += wcount, wresid -= wcount) {
wcount = write(to_fd, bufp, wresid);
wtotal += wcount;
if (info) {
info = 0;
(void)fprintf(stderr,
"%s -> %s %3d%%\n",
entp->fts_path, to.p_path,
cp_pct(wtotal, fs->st_size));
}
if (wcount >= (ssize_t)wresid || wcount <= 0)
break;
}
if (wcount != (ssize_t)wresid) {
warn("%s", to.p_path);
rval = 1;
break;
}
}
if (rcount < 0) {
warn("%s", entp->fts_path);
rval = 1;
}
}
/*
* Don't remove the target even after an error. The target might
* not be a regular file, or its attributes might be important,
@@ -219,20 +202,13 @@ copy_file(const FTSENT *entp, int dne)
* to remove it if we created it and its length is 0.
*/
if (!lflag) {
if (pflag && setfile(fs, to_fd))
rval = 1;
if (pflag && preserve_fd_acls(from_fd, to_fd) != 0)
rval = 1;
(void)close(from_fd);
if (close(to_fd)) {
warn("%s", to.p_path);
rval = 1;
}
}
if (pflag && setfile(fs, to_fd))
rval = 1;
(void)close(from_fd);
if (close(to_fd)) {
warn("%s", to.p_path);
rval = 1;
}
return (rval);
}
@@ -350,89 +326,13 @@ setfile(struct stat *fs, int fd)
return (rval);
}
int
preserve_fd_acls(int source_fd, int dest_fd)
{
struct acl *aclp;
acl_t acl;
if (fpathconf(source_fd, _PC_ACL_EXTENDED) != 1 ||
fpathconf(dest_fd, _PC_ACL_EXTENDED) != 1)
return (0);
acl = acl_get_fd(source_fd);
if (acl == NULL) {
warn("failed to get acl entries while setting %s", to.p_path);
return (1);
}
aclp = &acl->ats_acl;
if (aclp->acl_cnt == 3)
return (0);
if (acl_set_fd(dest_fd, acl) < 0) {
warn("failed to set acl entries for %s", to.p_path);
return (1);
}
return (0);
}
int
preserve_dir_acls(struct stat *fs, char *source_dir, char *dest_dir)
{
acl_t (*aclgetf)(const char *, acl_type_t);
int (*aclsetf)(const char *, acl_type_t, acl_t);
struct acl *aclp;
acl_t acl;
if (pathconf(source_dir, _PC_ACL_EXTENDED) != 1 ||
pathconf(dest_dir, _PC_ACL_EXTENDED) != 1)
return (0);
/*
* If the file is a link we will not follow it
*/
if (S_ISLNK(fs->st_mode)) {
aclgetf = acl_get_link_np;
aclsetf = acl_set_link_np;
} else {
aclgetf = acl_get_file;
aclsetf = acl_set_file;
}
/*
* Even if there is no ACL_TYPE_DEFAULT entry here, a zero
* size ACL will be returned. So it is not safe to simply
* check the pointer to see if the default ACL is present.
*/
acl = aclgetf(source_dir, ACL_TYPE_DEFAULT);
if (acl == NULL) {
warn("failed to get default acl entries on %s",
source_dir);
return (1);
}
aclp = &acl->ats_acl;
if (aclp->acl_cnt != 0 && aclsetf(dest_dir,
ACL_TYPE_DEFAULT, acl) < 0) {
warn("failed to set default acl entries on %s",
dest_dir);
return (1);
}
acl = aclgetf(source_dir, ACL_TYPE_ACCESS);
if (acl == NULL) {
warn("failed to get acl entries on %s", source_dir);
return (1);
}
aclp = &acl->ats_acl;
if (aclsetf(dest_dir, ACL_TYPE_ACCESS, acl) < 0) {
warn("failed to set acl entries on %s", dest_dir);
return (1);
}
return (0);
}
void
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file target_file",
" cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file ... "
"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] source_file target_file",
" cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] source_file ... "
"target_directory");
exit(EX_USAGE);
}
+1 -19
View File
@@ -68,30 +68,12 @@ NLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
NLSLINKS_it_IT.ISO8859-1= it_CH.ISO8859-1 it_CH.ISO8859-15 it_IT.ISO8859-15
NLSLINKS_es_ES.ISO8859-1= es_ES.ISO8859-15
.if defined(NO_NLS_CATALOGS) || defined(RESCUE)
CFLAGS+= -DNO_NLS_CATALOGS
.else
CFLAGS+= -DHAVE_ICONV
SRCS+= iconv_stub.c
# Following links can be installed from ports/shells/tcsh_nls:
# NLSLINKS_de_DE.ISO8859-1 += de_AT.UTF-8 de_CH.UTF-8 de_DE.UTF-8
# NLSLINKS_el_GR.ISO8859-7 = el_GR.UTF-8
# NLSLINKS_es_ES.ISO8859-1 += es_ES.UTF-8
# NLSLINKS_et_EE.ISO8859-15 = et_EE.UTF-8
# NLSLINKS_fi_FI.ISO8859-1 += fi_FI.UTF-8
# NLSLINKS_fr_FR.ISO8859-1 += fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8 fr_FR.UTF-8
# NLSLINKS_it_IT.ISO8859-1 += it_CH.UTF-8 it_IT.UTF-8
# NLSLINKS_ja_JP.eucJP = ja_JP.SJIS ja_JP.UTF-8
# NLSLINKS_ru_RU.KOI8-R = ru_RU.CP1251 ru_RU.CP866 ru_RU.ISO8859-5 ru_RU.UTF-8
# NLSLINKS_uk_UA.KOI8-U = uk_UA.ISO8859-5 uk_UA.UTF-8
.endif
NLSNAME= tcsh
.for catalog in ${CATALOGS}
NLS+= ${catalog:C/.*://}
NLSSRCDIR_${catalog:C/.*://}= ${TCSHDIR}/nls/${catalog:C/:.*//}
NLSSRCFILES_${catalog:C/.*://}!= cd ${NLSSRCDIR_${catalog:C/.*://}}; echo charset set[0-9]*
NLSSRCFILES_${catalog:C/.*://}!= cd ${NLSSRCDIR_${catalog:C/.*://}}; echo set[0-9]*
.endfor
csh.1: tcsh.man
+10 -45
View File
@@ -12,28 +12,10 @@
/* Define to 1 if you have the <auth.h> header file. */
/* #undef HAVE_AUTH_H */
/* Define to 1 if you have the `catgets' function. */
#define HAVE_CATGETS 1
/* Define to 1 if you have the <crypt.h> header file. */
/* #undef HAVE_CRYPT_H */
/* Define to 1 if you have the declaration of `crypt', and to 0 if you don't.
*/
#define HAVE_DECL_CRYPT 1
/* Define to 1 if you have the declaration of `environ', and to 0 if you
don't. */
#define HAVE_DECL_ENVIRON 0
/* Define to 1 if you have the declaration of `gethostname', and to 0 if you
don't. */
#define HAVE_DECL_GETHOSTNAME 1
/* Define to 1 if you have the declaration of `getpgrp', and to 0 if you
don't. */
#define HAVE_DECL_GETPGRP 1
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
@@ -41,9 +23,6 @@
/* Define to 1 if you have the `dup2' function. */
#define HAVE_DUP2 1
/* Define to 1 if you have the `getauthid' function. */
/* #undef HAVE_GETAUTHID */
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
@@ -56,7 +35,7 @@
/* Define to 1 if you have the `getutent' function. */
/* #undef HAVE_GETUTENT */
/* Define if you have the iconv() function. */
/* Define to 1 if you have the iconv () interface */
/* #undef HAVE_ICONV */
/* Define to 1 if you have the <inttypes.h> header file. */
@@ -65,9 +44,6 @@
/* Define to 1 if the system has the type `long long'. */
#define HAVE_LONG_LONG 1
/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
#define HAVE_MBRTOWC 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
@@ -104,10 +80,6 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strcoll' function and it is properly defined.
*/
#define HAVE_STRCOLL 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
@@ -173,12 +145,6 @@
/* Define to 1 if you have the `wcwidth' function. */
#define HAVE_WCWIDTH 1
/* Define as const if the declaration of iconv() needs const. */
#define ICONV_CONST const
/* Support NLS. */
#define NLS 1
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
@@ -194,6 +160,12 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to 1 if the C compiler supports function prototypes. */
#define PROTOTYPES 1
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define to 1 if the `setpgrp' function takes no argument. */
/* #undef SETPGRP_VOID */
@@ -206,6 +178,9 @@
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define like PROTOTYPES; this can be used by system headers. */
#define __PROTOTYPES 1
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
@@ -221,9 +196,6 @@
/* Define to `int' if neither <sys/types.h> nor <sys/socket.h> define. */
/* #undef socklen_t */
/* Define to `int' not defined in <sys/types.h>. */
/* #undef ssize_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
@@ -233,10 +205,3 @@
#include "config_p.h"
#include "config_f.h"
#ifndef NO_NLS_CATALOGS
#define NLS_CATALOGS
#endif
/* Work around a vendor issue where config_f.h is #undef'ing this setting */
#define SYSMALLOC
+15 -1
View File
@@ -21,6 +21,11 @@
*/
#define POSIXJOBS
/*
* POSIXSIGS Use the POSIX signal facilities to emulate BSD signals.
*/
#undef POSIXSIGS
/*
* VFORK This machine has a vfork().
* It used to be that for job control to work, this define
@@ -42,10 +47,17 @@
*/
#define BSDJOBS
/*
* BSDSIGS You have 4.2-style signals, rather than USG style.
* Note: POSIX systems should not define this unless they
* have sigvec() and friends (ie: 4.3BSD-RENO, HP-UX).
*/
#define BSDSIGS
/*
* BSDTIMES You have BSD-style process time stuff (like rusage)
* This may or may not be true. For example, Apple Unix
* (OREO) has BSDJOBS but not BSDTIMES.
* (OREO) has BSDJOBS and BSDSIGS but not BSDTIMES.
*/
#define BSDTIMES
@@ -82,6 +94,8 @@
#if defined(__FreeBSD__)
#define NLS_BUGS
#define BSD_STYLE_COLORLS
/* we want to use the system malloc when we install as /bin/csh */
#define SYSMALLOC
/* Use LC_MESSAGES locale category to open the message catalog */
#define MCLoadBySet NL_CAT_LOCALE
#define BUFSIZE 8192
-44
View File
@@ -1,44 +0,0 @@
/*-
* Copyright (c) 2006 Hajimu UMEMOTO <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _ICONV_H_
#define _ICONV_H_
typedef void *iconv_t;
typedef size_t dl_iconv_t(iconv_t, const char **, size_t *, char **, size_t *);
typedef int dl_iconv_close_t(iconv_t);
extern iconv_t dl_iconv_open(const char *, const char *);
extern dl_iconv_t *dl_iconv;
extern dl_iconv_close_t *dl_iconv_close;
#define iconv_open dl_iconv_open
#define iconv dl_iconv
#define iconv_close dl_iconv_close
#endif /* !_ICONV_H_ */
-80
View File
@@ -1,80 +0,0 @@
/*-
* Copyright (c) 2006 Hajimu UMEMOTO <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#include <dlfcn.h>
#include <stddef.h>
#include "iconv.h"
#undef iconv_open
#undef iconv
#undef iconv_close
#define ICONVLIB "libiconv.so"
#define ICONV_ENGINE "iconv"
#define ICONV_OPEN "iconv_open"
#define ICONV_CLOSE "iconv_close"
typedef iconv_t iconv_open_t(const char *, const char *);
dl_iconv_t *dl_iconv;
dl_iconv_close_t *dl_iconv_close;
static int initialized;
static void *iconvlib;
static iconv_open_t *iconv_open;
iconv_t
dl_iconv_open(const char *tocode, const char *fromcode)
{
if (initialized) {
if (iconvlib == NULL)
return (iconv_t)-1;
} else {
initialized = 1;
iconvlib = dlopen(ICONVLIB, RTLD_LAZY | RTLD_GLOBAL);
if (iconvlib == NULL)
return (iconv_t)-1;
iconv_open = (iconv_open_t *)dlfunc(iconvlib, ICONV_OPEN);
if (iconv_open == NULL)
goto dlfunc_err;
dl_iconv = (dl_iconv_t *)dlfunc(iconvlib, ICONV_ENGINE);
if (dl_iconv == NULL)
goto dlfunc_err;
dl_iconv_close = (dl_iconv_close_t *)dlfunc(iconvlib,
ICONV_CLOSE);
if (dl_iconv_close == NULL)
goto dlfunc_err;
}
return iconv_open(tocode, fromcode);
dlfunc_err:
dlclose(iconvlib);
iconvlib = NULL;
return (iconv_t)-1;
}
+2
View File
@@ -1,6 +1,8 @@
# @(#)Makefile 8.1 (Berkeley) 5/31/93
# $FreeBSD$
MAINTAINER= [email protected]
PROG= dd
SRCS= args.c conv.c conv_tab.c dd.c misc.c position.c
+1 -6
View File
@@ -32,7 +32,7 @@
.\" @(#)dd.1 8.2 (Berkeley) 1/13/94
.\" $FreeBSD$
.\"
.Dd January 23, 2009
.Dd August 15, 2004
.Dt DD 1
.Os
.Sh NAME
@@ -392,11 +392,6 @@ Remove parity bit from a file:
Check for (even) parity errors on a file:
.Pp
.Dl "dd if=file conv=pareven | cmp -x - file"
.Pp
To create an image of a Mode-1 CD-ROM, which is a commonly used format
for data CD-ROM disks, use a block size of 2048 bytes:
.Pp
.Dl "dd if=/dev/acd0 of=filename.iso bs=2048"
.Sh SEE ALSO
.Xr cp 1 ,
.Xr mt 1 ,
+2 -14
View File
@@ -93,7 +93,7 @@ imax(int a, int b)
return (a > b ? a : b);
}
static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag;
static int aflag = 0, cflag, hflag, iflag, nflag;
static struct ufs_args mdev;
int
@@ -123,14 +123,6 @@ main(int argc, char *argv[])
case 'b':
/* FALLTHROUGH */
case 'P':
/*
* POSIX specifically discusses the the behavior of
* both -k and -P. It states that the blocksize should
* be set to 1024. Thus, if this occurs, simply break
* rather than clobbering the old blocksize.
*/
if (kflag)
break;
putenv("BLOCKSIZE=512");
hflag = 0;
break;
@@ -151,15 +143,13 @@ main(int argc, char *argv[])
iflag = 1;
break;
case 'k':
kflag++;
putenv("BLOCKSIZE=1024");
putenv("BLOCKSIZE=1k");
hflag = 0;
break;
case 'l':
if (vfslist != NULL)
errx(1, "-l and -t are mutually exclusive.");
vfslist = makevfslist(makenetvfslist());
lflag = 1;
break;
case 'm':
putenv("BLOCKSIZE=1m");
@@ -169,8 +159,6 @@ main(int argc, char *argv[])
nflag = 1;
break;
case 't':
if (lflag)
errx(1, "-l and -t are mutually exclusive.");
if (vfslist != NULL)
errx(1, "only one -t option may be specified");
fstype = optarg;
+1 -4
View File
@@ -38,7 +38,7 @@
.Nd get ACL information
.Sh SYNOPSIS
.Nm
.Op Fl dhq
.Op Fl dh
.Op Ar
.Sh DESCRIPTION
The
@@ -64,9 +64,6 @@ An error is generated if a default ACL cannot be associated with
.It Fl h
If the target of the operation is a symbolic link, return the ACL from
the symbolic link itself rather than following the link.
.It Fl q
Don't write commented information about file name and ownership. This is
useful when dealing with filenames with unprintable characters.
.El
.Pp
The following operand is available:
+10 -16
View File
@@ -52,7 +52,7 @@ static void
usage(void)
{
fprintf(stderr, "getfacl [-dhq] [file ...]\n");
fprintf(stderr, "getfacl [-dh] [file ...]\n");
}
/*
@@ -147,7 +147,7 @@ acl_from_stat(struct stat sb)
}
static int
print_acl(char *path, acl_type_t type, int hflag, int qflag)
print_acl(char *path, acl_type_t type, int hflag)
{
struct stat sb;
acl_t acl;
@@ -168,9 +168,7 @@ print_acl(char *path, acl_type_t type, int hflag, int qflag)
else
more_than_one++;
if (!qflag)
printf("#file:%s\n#owner:%d\n#group:%d\n", path, sb.st_uid,
sb.st_gid);
printf("#file:%s\n#owner:%d\n#group:%d\n", path, sb.st_uid, sb.st_gid);
if (hflag)
acl = acl_get_link_np(path, type);
@@ -206,7 +204,7 @@ print_acl(char *path, acl_type_t type, int hflag, int qflag)
}
static int
print_acl_from_stdin(acl_type_t type, int hflag, int qflag)
print_acl_from_stdin(acl_type_t type, int hflag)
{
char *p, pathname[PATH_MAX];
int carried_error = 0;
@@ -214,7 +212,7 @@ print_acl_from_stdin(acl_type_t type, int hflag, int qflag)
while (fgets(pathname, (int)sizeof(pathname), stdin)) {
if ((p = strchr(pathname, '\n')) != NULL)
*p = '\0';
if (print_acl(pathname, type, hflag, qflag) == -1) {
if (print_acl(pathname, type, hflag) == -1) {
carried_error = -1;
}
}
@@ -228,11 +226,10 @@ main(int argc, char *argv[])
acl_type_t type = ACL_TYPE_ACCESS;
int carried_error = 0;
int ch, error, i;
int hflag, qflag;
int hflag;
hflag = 0;
qflag = 0;
while ((ch = getopt(argc, argv, "dhq")) != -1)
while ((ch = getopt(argc, argv, "dh")) != -1)
switch(ch) {
case 'd':
type = ACL_TYPE_DEFAULT;
@@ -240,9 +237,6 @@ main(int argc, char *argv[])
case 'h':
hflag = 1;
break;
case 'q':
qflag = 1;
break;
default:
usage();
return(-1);
@@ -251,17 +245,17 @@ main(int argc, char *argv[])
argv += optind;
if (argc == 0) {
error = print_acl_from_stdin(type, hflag, qflag);
error = print_acl_from_stdin(type, hflag);
return(error ? 1 : 0);
}
for (i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-")) {
error = print_acl_from_stdin(type, hflag, qflag);
error = print_acl_from_stdin(type, hflag);
if (error == -1)
carried_error = -1;
} else {
error = print_acl(argv[i], type, hflag, qflag);
error = print_acl(argv[i], type, hflag);
if (error == -1)
carried_error = -1;
}
+3 -6
View File
@@ -29,7 +29,7 @@
.\" @(#)hostname.1 8.2 (Berkeley) 4/28/95
.\" $FreeBSD$
.\"
.Dd December 7, 2006
.Dd April 18, 2005
.Dt HOSTNAME 1
.Os
.Sh NAME
@@ -37,7 +37,7 @@
.Nd set or print name of current host system
.Sh SYNOPSIS
.Nm
.Op Fl fs
.Op Fl s
.Op Ar name-of-host
.Sh DESCRIPTION
The
@@ -45,7 +45,7 @@ The
utility prints the name of the current host.
The super-user can
set the hostname by supplying an argument; this is usually done in the
initialization script
network initialization script
.Pa /etc/rc.d/hostname ,
normally run at boot
time.
@@ -56,9 +56,6 @@ variable in
.Pp
Options:
.Bl -tag -width flag
.It Fl f
Include domain information in the printed name.
This is the default behavior.
.It Fl s
Trim off any domain information from the printed
name.
+2 -9
View File
@@ -58,15 +58,8 @@ main(int argc, char *argv[])
char *p, hostname[MAXHOSTNAMELEN];
sflag = 0;
while ((ch = getopt(argc, argv, "fs")) != -1)
while ((ch = getopt(argc, argv, "s")) != -1)
switch (ch) {
case 'f':
/*
* On Linux, "hostname -f" prints FQDN.
* BSD "hostname" always prints FQDN by
* default, so we accept but ignore -f.
*/
break;
case 's':
sflag = 1;
break;
@@ -100,6 +93,6 @@ void
usage(void)
{
(void)fprintf(stderr, "usage: hostname [-fs] [name-of-host]\n");
(void)fprintf(stderr, "usage: hostname [-s] [name-of-host]\n");
exit(1);
}
+3 -27
View File
@@ -32,7 +32,7 @@
.\" @(#)ln.1 8.2 (Berkeley) 12/30/93
.\" $FreeBSD$
.\"
.Dd February 14, 2006
.Dd December 30, 1993
.Dt LN 1
.Os
.Sh NAME
@@ -41,11 +41,11 @@
.Nd make links
.Sh SYNOPSIS
.Nm
.Op Fl Ffhinsv
.Op Fl fhinsv
.Ar source_file
.Op Ar target_file
.Nm
.Op Fl Ffhinsv
.Op Fl fhinsv
.Ar source_file ...
.Ar target_dir
.Nm link
@@ -76,24 +76,6 @@ then unlink it so that the link may occur.
option overrides any previous
.Fl i
options.)
.It Fl F
If the target file already exists and is a directory, then remove it
so that the link may occur.
The
.Fl F
option should be used with either
.Fl f
or
.Fl i
options.
If none is specified,
.Fl f
is implied.
The
.Fl F
option is a no-op unless
.Fl s
option is specified.
.It Fl h
If the
.Ar target_file
@@ -197,12 +179,6 @@ options are non-standard and their use in scripts is not recommended.
They are provided solely for compatibility with other
.Nm
implementations.
.Pp
The
.Fl F
option is
.Fx
extention and should not be used in portable scripts.
.Sh SEE ALSO
.Xr link 2 ,
.Xr lstat 2 ,
+5 -23
View File
@@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
int fflag; /* Unlink existing files. */
int Fflag; /* Remove empty directories also. */
int hflag; /* Check new name for symlink first. */
int iflag; /* Interactive mode. */
int sflag; /* Symbolic, not hard, link. */
@@ -92,11 +91,8 @@ main(int argc, char *argv[])
exit(linkit(argv[0], argv[1], 0));
}
while ((ch = getopt(argc, argv, "Ffhinsv")) != -1)
while ((ch = getopt(argc, argv, "fhinsv")) != -1)
switch (ch) {
case 'F':
Fflag = 1;
break;
case 'f':
fflag = 1;
iflag = 0;
@@ -125,10 +121,6 @@ main(int argc, char *argv[])
linkf = sflag ? symlink : link;
linkch = sflag ? '-' : '=';
if (sflag == 0)
Fflag = 0;
if (Fflag == 1 && iflag == 0)
fflag = 1;
switch(argc) {
case 0:
@@ -208,12 +200,7 @@ linkit(const char *target, const char *source, int isdir)
* and interactively if -i was specified.
*/
if (fflag && exists) {
if (Fflag && S_ISDIR(sb.st_mode)) {
if (rmdir(source)) {
warn("%s", source);
return (1);
}
} else if (unlink(source)) {
if (unlink(source)) {
warn("%s", source);
return (1);
}
@@ -229,12 +216,7 @@ linkit(const char *target, const char *source, int isdir)
return (1);
}
if (Fflag && S_ISDIR(sb.st_mode)) {
if (rmdir(source)) {
warn("%s", source);
return (1);
}
} else if (unlink(source)) {
if (unlink(source)) {
warn("%s", source);
return (1);
}
@@ -254,8 +236,8 @@ void
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n%s\n",
"usage: ln [-Ffhinsv] source_file [target_file]",
" ln [-Ffhinsv] source_file ... target_dir",
"usage: ln [-fhinsv] source_file [target_file]",
" ln [-fhinsv] source_file ... target_dir",
" link source_file target_file");
exit(1);
}
-26
View File
@@ -114,32 +114,6 @@ revacccmp(const FTSENT *a, const FTSENT *b)
return (acccmp(b, a));
}
int
birthcmp(const FTSENT *a, const FTSENT *b)
{
if (b->fts_statp->st_birthtimespec.tv_sec >
a->fts_statp->st_birthtimespec.tv_sec)
return (1);
if (b->fts_statp->st_birthtimespec.tv_sec <
a->fts_statp->st_birthtimespec.tv_sec)
return (-1);
if (b->fts_statp->st_birthtimespec.tv_nsec >
a->fts_statp->st_birthtimespec.tv_nsec)
return (1);
if (b->fts_statp->st_birthtimespec.tv_nsec <
a->fts_statp->st_birthtimespec.tv_nsec)
return (-1);
return (strcoll(a->fts_name, b->fts_name));
}
int
revbirthcmp(const FTSENT *a, const FTSENT *b)
{
return (birthcmp(b, a));
}
int
statcmp(const FTSENT *a, const FTSENT *b)
{
-2
View File
@@ -32,8 +32,6 @@
int acccmp(const FTSENT *, const FTSENT *);
int revacccmp(const FTSENT *, const FTSENT *);
int birthcmp(const FTSENT *, const FTSENT *);
int revbirthcmp(const FTSENT *, const FTSENT *);
int modcmp(const FTSENT *, const FTSENT *);
int revmodcmp(const FTSENT *, const FTSENT *);
int namecmp(const FTSENT *, const FTSENT *);
+12 -26
View File
@@ -32,7 +32,7 @@
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94
.\" $FreeBSD$
.\"
.Dd October 12, 2006
.Dd June 2, 2005
.Dt LS 1
.Os
.Sh NAME
@@ -40,7 +40,7 @@
.Nd list directory contents
.Sh SYNOPSIS
.Nm
.Op Fl ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1
.Op Fl ABCFGHLPRSTWZabcdfghiklmnopqrstuwx1
.Op Ar
.Sh DESCRIPTION
For each operand that names a
@@ -68,16 +68,11 @@ lexicographical order.
The following options are available:
.Bl -tag -width indent
.It Fl A
Include directory entries whose names begin with a
dot
.Pq Sq Pa \&.
except for
List all entries except for
.Pa \&.
and
.Pa .. .
Automatically set for the super-user unless
.Fl I
is specified.
Always set for the super-user.
.It Fl B
Force printing of non-printable characters (as defined by
.Xr ctype 3
@@ -122,10 +117,6 @@ none of the
or
.Fl l
options are specified.
.It Fl I
Prevent
.Fl A
from being automatically set for the super-user.
.It Fl L
If argument is a symbolic link, list the file or directory the link references
rather than the link itself.
@@ -152,8 +143,6 @@ When used with the
.Dq ell )
option, display complete time information for the file, including
month, day, hour, minute, second, and year.
.It Fl U
Use time when file was created for sorting or printing.
.It Fl W
Display whiteouts when scanning directories.
.It Fl Z
@@ -162,7 +151,7 @@ Display each file's MAC label; see
.It Fl a
Include directory entries whose names begin with a
dot
.Pq Sq Pa \&. .
.Pq Pa \&. .
.It Fl b
As
.Fl B ,
@@ -268,10 +257,10 @@ options all override each other; the last one specified determines
the format used.
.Pp
The
.Fl c , u ,
.Fl c
and
.Fl U
options all override each other; the last one specified determines
.Fl u
options override each other; the last one specified determines
the file time used.
.Pp
The
@@ -360,8 +349,6 @@ The entry type character describes the type of file, as
follows:
.Pp
.Bl -tag -width 4n -offset indent -compact
.It Sy \-
Regular file.
.It Sy b
Block special file.
.It Sy c
@@ -370,12 +357,12 @@ Character special file.
Directory.
.It Sy l
Symbolic link.
.It Sy s
Socket link.
.It Sy p
.Tn FIFO .
.It Sy s
Socket.
.It Sy w
Whiteout.
.It Sy \-
Regular file.
.El
.Pp
The next three fields
@@ -657,7 +644,6 @@ specification.
.Xr sticky 8
.Sh STANDARDS
With the exception of options
.Fl I ,
.Fl g ,
.Fl n
and
+6 -22
View File
@@ -104,14 +104,12 @@ int termwidth = 80; /* default terminal width */
/* flags */
int f_accesstime; /* use time of last access */
int f_birthtime; /* use time of birth */
int f_flags; /* show flags associated with a file */
int f_humanval; /* show human-readable file sizes */
int f_inode; /* print inode */
static int f_kblocks; /* print size in kilobytes */
static int f_listdir; /* list actual directory, not contents */
static int f_listdot; /* list files beginning with . */
static int f_noautodot; /* do not automatically enable -A for root */
int f_longform; /* long listing format */
int f_nonprint; /* show unprintables as ? */
static int f_nosort; /* don't sort output */
@@ -177,9 +175,13 @@ main(int argc, char *argv[])
termwidth = atoi(p);
}
/* Root is -A automatically. */
if (!getuid())
f_listdot = 1;
fts_options = FTS_PHYSICAL;
while ((ch = getopt(argc, argv,
"1ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx")) != -1) {
"1ABCFGHLPRSTWZabcdfghiklmnopqrstuwx")) != -1) {
switch (ch) {
/*
* The -1, -C, -x and -l options all override each other so
@@ -208,21 +210,14 @@ main(int argc, char *argv[])
f_longform = 0;
f_singlecol = 0;
break;
/* The -c, -u, and -U options override each other. */
/* The -c and -u options override each other. */
case 'c':
f_statustime = 1;
f_accesstime = 0;
f_birthtime = 0;
break;
case 'u':
f_accesstime = 1;
f_statustime = 0;
f_birthtime = 0;
break;
case 'U':
f_birthtime = 1;
f_accesstime = 0;
f_statustime = 0;
break;
case 'F':
f_type = 1;
@@ -252,9 +247,6 @@ main(int argc, char *argv[])
case 'A':
f_listdot = 1;
break;
case 'I':
f_noautodot = 1;
break;
/* The -d option turns off the -R option. */
case 'd':
f_listdir = 1;
@@ -334,10 +326,6 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
/* Root is -A automatically unless -I. */
if (!f_listdot && getuid() == (uid_t)0 && !f_noautodot)
f_listdot = 1;
/* Enabling of colours is conditional on the environment. */
if (getenv("CLICOLOR") &&
(isatty(STDOUT_FILENO) || getenv("CLICOLOR_FORCE")))
@@ -418,8 +406,6 @@ main(int argc, char *argv[])
sortfcn = revnamecmp;
else if (f_accesstime)
sortfcn = revacccmp;
else if (f_birthtime)
sortfcn = revbirthcmp;
else if (f_statustime)
sortfcn = revstatcmp;
else if (f_sizesort)
@@ -431,8 +417,6 @@ main(int argc, char *argv[])
sortfcn = namecmp;
else if (f_accesstime)
sortfcn = acccmp;
else if (f_birthtime)
sortfcn = birthcmp;
else if (f_statustime)
sortfcn = statcmp;
else if (f_sizesort)
-1
View File
@@ -38,7 +38,6 @@
extern long blocksize; /* block size units */
extern int f_accesstime; /* use time of last access */
extern int f_birthtime; /* use time of file creation */
extern int f_flags; /* show flags associated with a file */
extern int f_humanval; /* show human-readable file sizes */
extern int f_label; /* show MAC label */
-2
View File
@@ -190,8 +190,6 @@ printlong(const DISPLAY *dp)
printsize(dp->s_size, sp->st_size);
if (f_accesstime)
printtime(sp->st_atime);
else if (f_birthtime)
printtime(sp->st_birthtime);
else if (f_statustime)
printtime(sp->st_ctime);
else
+2 -2
View File
@@ -222,9 +222,9 @@ usage(void)
{
(void)fprintf(stderr,
#ifdef COLORLS
"usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1]"
"usage: ls [-ABCFGHLPRSTWZabcdfghiklmnopqrstuwx1]"
#else
"usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuwx1]"
"usage: ls [-ABCFHLPRSTWZabcdfghiklmnopqrstuwx1]"
#endif
" [file ...]\n");
exit(1);
+2 -2
View File
@@ -113,9 +113,9 @@ Cause
to be verbose, showing files after they are moved.
.El
.Pp
It is an error for the
It is an error for either the
.Ar source
operand to specify a directory if the target exists and is not a directory.
operand or the destination path to specify a directory unless both do.
.Pp
If the destination path does not have a mode which permits writing,
.Nm
+17 -75
View File
@@ -44,8 +44,6 @@ static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/acl.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/wait.h>
@@ -65,9 +63,6 @@ __FBSDID("$FreeBSD$");
#include <sysexits.h>
#include <unistd.h>
/* Exit code for a failed exec. */
#define EXEC_FAILED 127
int fflg, iflg, nflg, vflg;
int copy(char *, char *);
@@ -201,11 +196,6 @@ do_move(char *from, char *to)
}
}
}
/*
* Rename on FreeBSD will fail with EISDIR and ENOTDIR, before failing
* with EXDEV. Therefore, copy() doesn't have to perform the checks
* specified in the Step 3 of the POSIX mv specification.
*/
if (!rename(from, to)) {
if (vflg)
printf("%s -> %s\n", from, to);
@@ -227,7 +217,7 @@ do_move(char *from, char *to)
if (!S_ISLNK(sb.st_mode)) {
/* Can't mv(1) a mount point. */
if (realpath(from, path) == NULL) {
warn("cannot resolve %s: %s", from, path);
warnx("cannot resolve %s: %s", from, path);
return (1);
}
if (!statfs(path, &sfs) &&
@@ -260,7 +250,6 @@ fastcopy(char *from, char *to, struct stat *sbp)
struct timeval tval[2];
static u_int blen;
static char *bp;
acl_t acl;
mode_t oldmode;
int nread, from_fd, to_fd;
@@ -299,6 +288,7 @@ err: if (unlink(to))
(void)close(to_fd);
return (1);
}
(void)close(from_fd);
oldmode = sbp->st_mode & ALLPERMS;
if (fchown(to_fd, sbp->st_uid, sbp->st_gid)) {
@@ -311,21 +301,6 @@ err: if (unlink(to))
sbp->st_mode &= ~(S_ISUID | S_ISGID);
}
}
/*
* POSIX 1003.2c states that if _POSIX_ACL_EXTENDED is in effect
* for dest_file, then its ACLs shall reflect the ACLs of the
* source_file.
*/
if (fpathconf(to_fd, _PC_ACL_EXTENDED) == 1 &&
fpathconf(from_fd, _PC_ACL_EXTENDED) == 1) {
acl = acl_get_fd(from_fd);
if (acl == NULL)
warn("failed to get acl entries while setting %s",
from);
else if (acl_set_fd(to_fd, acl) < 0)
warn("failed to set acl entries for %s", to);
}
(void)close(from_fd);
if (fchmod(to_fd, sbp->st_mode))
warn("%s: set mode (was: 0%03o)", to, oldmode);
/*
@@ -363,76 +338,43 @@ err: if (unlink(to))
int
copy(char *from, char *to)
{
struct stat sb;
int pid, status;
if (lstat(to, &sb) == 0) {
/* Destination path exists. */
if (S_ISDIR(sb.st_mode)) {
if (rmdir(to) != 0) {
warn("rmdir %s", to);
return (1);
}
} else {
if (unlink(to) != 0) {
warn("unlink %s", to);
return (1);
}
}
} else if (errno != ENOENT) {
warn("%s", to);
return (1);
}
/* Copy source to destination. */
if (!(pid = vfork())) {
if ((pid = fork()) == 0) {
execl(_PATH_CP, "mv", vflg ? "-PRpv" : "-PRp", "--", from, to,
(char *)NULL);
_exit(EXEC_FAILED);
warn("%s", _PATH_CP);
_exit(1);
}
if (waitpid(pid, &status, 0) == -1) {
warn("%s %s %s: waitpid", _PATH_CP, from, to);
warn("%s: waitpid", _PATH_CP);
return (1);
}
if (!WIFEXITED(status)) {
warnx("%s %s %s: did not terminate normally",
_PATH_CP, from, to);
warnx("%s: did not terminate normally", _PATH_CP);
return (1);
}
switch (WEXITSTATUS(status)) {
case 0:
break;
case EXEC_FAILED:
warnx("%s %s %s: exec failed", _PATH_CP, from, to);
return (1);
default:
warnx("%s %s %s: terminated with %d (non-zero) status",
_PATH_CP, from, to, WEXITSTATUS(status));
if (WEXITSTATUS(status)) {
warnx("%s: terminated with %d (non-zero) status",
_PATH_CP, WEXITSTATUS(status));
return (1);
}
/* Delete the source. */
if (!(pid = vfork())) {
execl(_PATH_RM, "mv", "-rf", "--", from, (char *)NULL);
_exit(EXEC_FAILED);
warn("%s", _PATH_RM);
_exit(1);
}
if (waitpid(pid, &status, 0) == -1) {
warn("%s %s: waitpid", _PATH_RM, from);
warn("%s: waitpid", _PATH_RM);
return (1);
}
if (!WIFEXITED(status)) {
warnx("%s %s: did not terminate normally", _PATH_RM, from);
warnx("%s: did not terminate normally", _PATH_RM);
return (1);
}
switch (WEXITSTATUS(status)) {
case 0:
break;
case EXEC_FAILED:
warnx("%s %s: exec failed", _PATH_RM, from);
return (1);
default:
warnx("%s %s: terminated with %d (non-zero) status",
_PATH_RM, from, WEXITSTATUS(status));
if (WEXITSTATUS(status)) {
warnx("%s: terminated with %d (non-zero) status",
_PATH_RM, WEXITSTATUS(status));
return (1);
}
return (0);
+3
View File
@@ -29,6 +29,9 @@ PROG= pax
SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c \
gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c \
tables.c tar.c tty_subs.c
#XXX NOTYET
#MAN= pax.1 tar.1 cpio.1
#LINKS= ${BINDIR}/pax ${BINDIR}/tar ${BINDIR}/pax ${BINDIR}/cpio
.if ${MACHINE_ARCH} == "arm"
WARNS?= 3
+304
View File
@@ -0,0 +1,304 @@
.\"-
.\" Copyright (c) 1997 SigmaSoft, Th. Lockert
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by SigmaSoft, Th. Lockert.
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $OpenBSD: cpio.1,v 1.16 2001/05/01 17:58:01 aaron Exp $
.\" $FreeBSD$
.\"
.Dd February 16, 1997
.Dt CPIO 1
.Os
.Sh NAME
.Nm cpio
.Nd copy file archives in and out
.Sh SYNOPSIS
.Nm
.Fl o
.Op Fl aABcLvzZ
.Op Fl C Ar bytes
.Op Fl F Ar archive
.Op Fl H Ar format
.Op Fl O Ar archive
.No < Ar name-list
.Op No > Ar archive
.Nm
.Fl i
.Op Fl bBcdfmrsStuvzZ6
.Op Fl C Ar bytes
.Op Fl E Ar file
.Op Fl F Ar archive
.Op Fl H Ar format
.Op Fl I Ar archive
.Op Ar pattern ...
.Op No < Ar archive
.Nm
.Fl p
.Op Fl adlLmuv
.Ar destination-directory
.No < Ar name-list
.Sh DESCRIPTION
The
.Nm
command copies files to and from a
.Nm
archive.
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl o
Create an archive.
Reads the list of files to store in the
archive from standard input, and writes the archive on standard
output.
.Bl -tag -width indent
.It Fl a
Reset the access times on files that have been copied to the
archive.
.It Fl A
Append to the specified archive.
.It Fl B
Set block size of output to 5120 bytes.
.It Fl c
Use
.Tn ASCII
format for
.Nm
header for portability.
.It Fl C Ar bytes
Set the block size of output to
.Ar bytes .
.It Fl F Ar archive
.It Fl O Ar archive
Use the specified file name as the archive to write to.
.It Fl H Ar format
Write the archive in the specified format.
Recognized formats are:
.Pp
.Bl -tag -width sv4cpio -compact
.It Cm bcpio
Old binary
.Nm
format.
.It Cm cpio
Old octal character
.Nm
format.
.It Cm sv4cpio
.Tn SVR4
hex
.Nm
format.
.It Cm tar
Old tar format.
.It Cm ustar
.Tn POSIX
ustar format.
.El
.It Fl L
Follow symbolic links.
.It Fl v
Be verbose about operations.
List filenames as they are written to the archive.
.It Fl z
Compress archive using
.Xr gzip 1
format.
.It Fl Z
Compress archive using
.Xr compress 1
format.
.El
.It Fl i
Restore files from an archive.
Reads the archive file from
standard input and extracts files matching the
.Ar patterns
that were specified on the command line.
.Bl -tag -width indent
.It Fl b
Do byte and word swapping after reading in data from the
archive, for restoring archives created on systems with
a different byte order.
.It Fl B
Set the block size of the archive being read to 5120 bytes.
.It Fl c
Expect the archive headers to be in
.Tn ASCII
format.
.It Fl C Ar bytes
Read archive written with a block size of
.Ar bytes .
.It Fl d
Create any intermediate directories as needed during
restore.
.It Fl E Ar file
Read list of file name patterns to extract or list from
.Ar file .
.It Fl f
Restore all files except those matching the
.Ar patterns
given on the command line.
.It Fl F Ar archive , Fl I Ar archive
Use the specified file as the input for the archive.
.It Fl H Ar format
Read an archive of the specified format.
Recognized formats are:
.Pp
.Bl -tag -width sv4cpio -compact
.It Cm bcpio
Old binary
.Nm
format.
.It Cm cpio
Old octal character
.Nm
format.
.It Cm sv4cpio
.Tn SVR4
hex
.Nm
format.
.It Cm tar
Old tar format.
.It Cm ustar
.Tn POSIX
ustar format.
.El
.It Fl m
Restore modification times on files.
.It Fl r
Rename restored files interactively.
.It Fl s
Swap bytes after reading data from the archive.
.It Fl S
Swap words after reading data from the archive.
.It Fl t
Only list the contents of the archive, no files or
directories will be created.
.It Fl u
Overwrite files even when the file in the archive is
older than the one that will be overwritten.
.It Fl v
Be verbose about operations.
List filenames as they are copied in from the archive.
.It Fl z
Uncompress archive using
.Xr gzip 1
format.
.It Fl Z
Uncompress archive using
.Xr compress 1
format.
.It Fl 6
Process old-style
.Nm
format archives.
.El
.It Fl p
Copy files from one location to another in a single pass.
The list of files to copy are read from standard input and
written out to a directory relative to the specified
.Ar directory
argument.
.Bl -tag -width indent
.It Fl a
Reset the access times on files that have been copied.
.It Fl d
Create any intermediate directories as needed to write
the files at the new location.
.It Fl l
When possible, link files rather than creating an
extra copy.
.It Fl L
Follow symbolic links.
.It Fl m
Restore modification times on files.
.It Fl u
Overwrite files even when the original file being copied is
older than the one that will be overwritten.
.It Fl v
Be verbose about operations.
List filenames as they are copied.
.El
.El
.Sh ENVIRONMENT
.Bl -tag -width TMPDIR
.It Ev TMPDIR
Path in which to store temporary files.
.El
.Sh EXIT STATUS
The
.Nm
utility will exit with one of the following values:
.Bl -tag -width 2n
.It 0
All files were processed successfully.
.It 1
An error occurred.
.El
.Pp
Whenever
.Nm
cannot create a file or a link when extracting an archive or cannot
find a file while writing an archive, or cannot preserve the user
ID, group ID, file mode, or access and modification times when the
.Fl p
option is specified, a diagnostic message is written to standard
error and a non-zero exit value will be returned, but processing
will continue.
In the case where
.Nm
cannot create a link to a file,
.Nm
will not create a second copy of the file.
.Pp
If the extraction of a file from an archive is prematurely terminated
by a signal or error,
.Nm
may have only partially extracted the file the user wanted.
Additionally, the file modes of extracted files and directories may
have incorrect file bits, and the modification and access times may
be wrong.
.Pp
If the creation of an archive is prematurely terminated by a signal
or error,
.Nm
may have only partially created the archive which may violate the
specific archive format specification.
.Sh SEE ALSO
.Xr pax 1 ,
.Xr tar 1
.Sh AUTHORS
.An Keith Muller
at the University of California, San Diego.
.Sh BUGS
The
.Fl s
and
.Fl S
options are currently not implemented.
+2 -3
View File
@@ -394,9 +394,8 @@ block the output at a positive decimal integer number of
bytes per write to the archive file.
The
.Ar blocksize
must be a multiple of 512 bytes with a maximum of 64512 bytes. A
.Ar blocksize
larger than 32256 bytes violates the
must be a multiple of 512 bytes with a maximum of 64512 bytes.
Archives larger than 32256 bytes violate the
.Tn POSIX
standard and will not be portable to all systems.
A
-1
View File
@@ -396,7 +396,6 @@ trng_add(char *str)
default:
paxwarn(1, "Bad option %c with time range %s",
*flgpt, str);
free(pt);
goto out;
}
++flgpt;
+310
View File
@@ -0,0 +1,310 @@
.\"-
.\" Copyright (c) 1996 SigmaSoft, Th. Lockert
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by SigmaSoft, Th. Lockert.
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $OpenBSD: tar.1,v 1.33 2001/05/01 17:58:01 aaron Exp $
.\" $FreeBSD$
.\"
.Dd February 7, 2001
.Dt TAR 1
.Os
.Sh NAME
.Nm tar
.Nd tape archiver
.Sh SYNOPSIS
.Nm
.Sm off
.Op Fl
.Brq Cm crtux
.Op Cm befhjmopqsvwyzHLOPXZ014578
.Sm on
.Op Ar blocksize
.Op Ar archive
.Op Ar replstr
.\" XXX how to do this right?
.Op Fl C Ar directory
.Op Fl I Ar file
.Op Ar
.Sh DESCRIPTION
The
.Nm
command creates, adds files to, or extracts files from an
archive file in
.Nm
format.
A
.Nm
archive is often stored on a magnetic tape, but can be
stored equally well on a floppy, CD-ROM, or in a regular disk file.
.Pp
One of the following flags must be present:
.Bl -tag -width indent
.It Fl c
Create new archive, or overwrite an existing archive,
adding the specified files to it.
.It Fl r
Append the named new files to existing archive.
Note that this will only work on media on which an end-of-file mark
can be overwritten.
.It Fl t
List contents of archive.
If any files are named on the
command line, only those files will be listed.
.It Fl u
Alias for
.Fl r .
.It Fl x
Extract files from archive.
If any files are named on the
command line, only those files will be extracted from the
archive.
If more than one copy of a file exists in the
archive, later copies will overwrite earlier copies during
extraction.
The file mode and modification time are preserved
if possible.
The file mode is subject to modification by the
.Xr umask 2 .
.El
.Pp
In addition to the flags mentioned above, any of the following
flags may be used:
.Bl -tag -width indent
.It Fl b Ar "blocking factor"
Set blocking factor to use for the archive, with 512 byte blocks.
The default is 20, the maximum is 126.
Archives with a blocking factor larger 63 violate the
.Tn POSIX
standard and will not be portable to all systems.
.It Fl e
Stop after first error.
.It Fl f Ar archive
Filename where the archive is stored.
Defaults to
.Pa /dev/sa0 .
.It Fl h
Follow symbolic links as if they were normal files
or directories.
.It Fl j
Compress archives using
.Xr bzip2 1 .
.It Fl m
Do not preserve modification time.
.It Fl O
Write old-style
.Pq non- Ns Tn POSIX
archives.
.It Fl o
Do not write directory information that the older (V7) style
.Nm
is unable to decode.
This implies the
.Fl O
flag.
.It Fl p
Preserve user and group ID as well as file mode regardless of
the current
.Xr umask 2 .
The setuid and setgid bits are only preserved if the user is
the superuser.
Only meaningful in conjunction with the
.Fl x
flag.
.It Fl q
Select the first archive member that matches each
.Ar pattern
operand.
No more than one archive member is matched for each
.Ar pattern .
When members of type directory are matched, the file hierarchy rooted at that
directory is also matched.
.It Fl s Ar replstr
Modify the file or archive member names specified by the
.Ar pattern
or
.Ar file
operands according to the substitution expression
.Ar replstr ,
using the syntax of the
.Xr ed 1
utility regular expressions.
The format of these regular expressions are:
.Dl /old/new/[gp]
As in
.Xr ed 1 ,
.Cm old
is a basic regular expression and
.Cm new
can contain an ampersand
.Pq Ql & ,
.Li \e Ns Ar n
(where
.Ar n
is a digit) back-references,
or subexpression matching.
The
.Cm old
string may also contain newline characters.
Any non-null character can be used as a delimiter
.Ql ( /
is shown here).
Multiple
.Fl s
expressions can be specified.
The expressions are applied in the order they are specified on the
command line, terminating with the first successful substitution.
The optional trailing
.Cm g
continues to apply the substitution expression to the pathname substring
which starts with the first character following the end of the last successful
substitution.
The first unsuccessful substitution stops the operation of the
.Cm g
option.
The optional trailing
.Cm p
will cause the final result of a successful substitution to be written to
standard error
in the following format:
.Pp
.Dl <original pathname> >> <new pathname>
.Pp
File or archive member names that substitute to the empty string
are not selected and will be skipped.
.It Fl v
Verbose operation mode.
.It Fl w
Interactively rename files.
This option causes
.Nm
to prompt the user for the filename to use when storing or
extracting files in an archive.
.It Fl y
Compress archives using
.Xr bzip2 1 .
.It Fl z
Compress archive using
.Xr gzip 1 .
.It Fl C Ar directory
This is a positional argument which sets the working directory for the
following files.
When extracting, files will be extracted into
the specified directory; when creating, the specified files will be matched
from the directory.
.It Fl H
Follow symlinks given on command line only.
.It Fl L
Follow all symlinks.
.It Fl P
Do not strip leading slashes
.Pq Ql /
from pathnames.
The default is to strip leading slashes.
.It Fl I Ar file
This is a positional argument which reads the names of files to
archive or extract from the given file, one per line.
.It Fl X
Do not cross mount points in the file system.
.It Fl Z
Compress archive using
.Xr compress 1 .
.El
.Pp
The options
.Op Fl 014578
can be used to select one of the compiled-in backup devices,
.Pa /dev/rst Ns Ar N .
.Sh ENVIRONMENT
.Bl -tag -width TMPDIR
.It Ev TMPDIR
Path in which to store temporary files.
.It Ev TAPE
Default tape device to use instead of
.Pa /dev/sa0 .
.El
.Sh FILES
.Bl -tag -width "/dev/sa0"
.It Pa /dev/sa0
default archive name
.El
.Sh EXIT STATUS
The
.Nm
utility will exit with one of the following values:
.Bl -tag -width 2n
.It 0
All files were processed successfully.
.It 1
An error occurred.
.El
.Pp
Whenever
.Nm
cannot create a file or a link when extracting an archive or cannot
find a file while writing an archive, or cannot preserve the user
ID, group ID, file mode, or access and modification times when the
.Fl p
option is specified, a diagnostic message is written to standard
error and a non-zero exit value will be returned, but processing
will continue.
In the case where
.Nm
cannot create a link to a file,
.Nm
will not create a second copy of the file.
.Pp
If the extraction of a file from an archive is prematurely terminated
by a signal or error,
.Nm
may have only partially extracted the file the user wanted.
Additionally, the file modes of extracted files and directories may
have incorrect file bits, and the modification and access times may
be wrong.
.Pp
If the creation of an archive is prematurely terminated by a signal
or error,
.Nm
may have only partially created the archive which may violate the
specific archive format specification.
.Sh COMPATIBILITY
The
.Fl L
flag is not portable to other versions of
.Nm
where it may have a different meaning.
.Sh SEE ALSO
.Xr cpio 1 ,
.Xr pax 1
.Sh HISTORY
A
.Nm
command first appeared in
.At v7 .
.Sh AUTHORS
.An Keith Muller
at the University of California, San Diego.
+1 -2
View File
@@ -39,7 +39,7 @@ extern fixpt_t ccpu;
extern int cflag, eval, fscale, nlistread, rawcpu;
extern unsigned long mempages;
extern time_t now;
extern int showthreads, sumrusage, termwidth, totwidth;
extern int sumrusage, termwidth, totwidth;
extern STAILQ_HEAD(velisthead, varent) varlist;
__BEGIN_DECLS
@@ -71,7 +71,6 @@ void priorityr(KINFO *, VARENT *);
void rgroupname(KINFO *, VARENT *);
void runame(KINFO *, VARENT *);
void rvar(KINFO *, VARENT *);
int s_comm(KINFO *);
int s_label(KINFO *);
int s_rgroupname(KINFO *);
int s_runame(KINFO *);
+14 -33
View File
@@ -79,8 +79,8 @@ static VAR var[] = {
CHAR, NULL, 0},
{"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"comm", "COMMAND", NULL, LJUST|DSIZ, ucomm, s_comm,
COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0},
{"comm", "COMMAND", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR,
NULL, 0},
{"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0,
CHAR, NULL, 0},
{"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d",
@@ -135,13 +135,12 @@ static VAR var[] = {
LONG, "ld", 0},
{"nvcsw", "NVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nvcsw),
LONG, "ld", 0},
{"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, sizeof(void *) * 2, 0,
CHAR, NULL, 0},
{"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, 8, 0, CHAR, NULL, 0},
{"oublk", "OUBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_oublock),
LONG, "ld", 0},
{"oublock", "", "oublk", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"paddr", "PADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2,
KOFF(ki_paddr), KPTR, "lx", 0},
{"paddr", "PADDR", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR,
"lx", 0},
{"pagein", "PAGEIN", NULL, USER, pagein, NULL, 6, 0, CHAR, NULL, 0},
{"pcpu", "", "%cpu", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"pending", "", "sig", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
@@ -195,13 +194,13 @@ static VAR var[] = {
{"tsiz", "TSIZ", NULL, 0, kvar, NULL, 4, KOFF(ki_tsize), PGTOK, "ld", 0},
{"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0},
{"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0},
{"ucomm", "UCOMM", NULL, LJUST|DSIZ, ucomm, s_comm,
COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0},
{"ucomm", "UCOMM", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR, NULL,
0},
{"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT,
UIDFMT, 0},
{"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0},
{"uprocp", "UPROCP", NULL, 0, kvar, NULL, sizeof(void *) * 2,
KOFF(ki_paddr), KPTR, "lx", 0},
{"uprocp", "UPROCP", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR,
"lx", 0},
{"user", "USER", NULL, LJUST|DSIZ, uname, s_uname, USERLEN, 0, CHAR,
NULL, 0},
{"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
@@ -296,9 +295,8 @@ parsefmt(const char *p, int user)
static VAR *
findvar(char *p, int user, char **header)
{
size_t rflen;
VAR *v, key;
char *hp, *realfmt;
char *hp;
hp = strchr(p, '=');
if (hp)
@@ -308,28 +306,11 @@ findvar(char *p, int user, char **header)
v = bsearch(&key, var, sizeof(var)/sizeof(VAR) - 1, sizeof(VAR), vcmp);
if (v && v->alias) {
/*
* If the user specified an alternate-header for this
* (aliased) format-name, then we need to copy that
* alternate-header when making the recursive call to
* process the alias.
*/
if (hp == NULL)
parsefmt(v->alias, user);
else {
/*
* XXX - This processing will not be correct for
* any alias which expands into a list of format
* keywords. Presently there are no aliases
* which do that.
*/
rflen = strlen(v->alias) + strlen(hp) + 2;
realfmt = malloc(rflen);
if (realfmt == NULL)
errx(1, "malloc failed");
snprintf(realfmt, rflen, "%s=%s", v->alias, hp);
parsefmt(realfmt, user);
if (hp) {
warnx("%s: illegal keyword specification", p);
eval = 1;
}
parsefmt(v->alias, user);
return ((VAR *)NULL);
}
if (!v) {
+2 -25
View File
@@ -175,22 +175,13 @@ command(KINFO *k, VARENT *ve)
void
ucomm(KINFO *k, VARENT *ve)
{
char tmpbuff[COMMLEN + OCOMMLEN + 2];
VAR *v;
v = ve->var;
if (STAILQ_NEXT(ve, next_ve) == NULL) /* last field, don't pad */
(void)printf("%s", k->ki_p->ki_comm);
else {
bzero(tmpbuff, sizeof(tmpbuff));
if (showthreads && k->ki_p->ki_numthreads > 1)
sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm,
k->ki_p->ki_ocomm);
else
sprintf(tmpbuff, "%s", k->ki_p->ki_comm);
(void)printf("%-*s", v->width, tmpbuff);
}
else
(void)printf("%-*s", v->width, k->ki_p->ki_comm);
}
void
@@ -812,20 +803,6 @@ out:
return;
}
int
s_comm(KINFO *k)
{
char tmpbuff[COMMLEN + OCOMMLEN + 2];
bzero(tmpbuff, sizeof(tmpbuff));
if (showthreads && k->ki_p->ki_numthreads > 1)
sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm,
k->ki_p->ki_ocomm);
else
sprintf(tmpbuff, "%s", k->ki_p->ki_comm);
return (strlen(tmpbuff));
}
int
s_label(KINFO *k)
{
+6 -8
View File
@@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd August 21, 2006
.Dd March 20, 2005
.Dt PS 1
.Os
.Sh NAME
@@ -179,16 +179,14 @@ the standard header.
.It Fl o
Display information associated with the space or comma separated
list of keywords specified.
The last keyword in the list may be appended with an equals
.Pq Ql =
sign and a string that spans the rest of the argument and can contain
space and comma characters.
This causes the printed header to use the specified string instead of
the standard header.
Multiple keywords may also be given in the form of more than one
.Fl o
option.
So the header texts for multiple keywords can be changed.
Keywords may be appended with an equals
.Pq Ql =
sign and a string.
This causes the printed header to use the specified string instead of
the standard header.
If all keywords have empty header texts, no header line is written.
.It Fl p
Display information about processes which match the specified process IDs.
+1 -2
View File
@@ -98,7 +98,6 @@ int rawcpu; /* -C */
int sumrusage; /* -S */
int termwidth; /* Width of the screen (0 == infinity). */
int totwidth; /* Calculated-width of requested variables. */
int showthreads; /* will threads be shown? */
struct velisthead varlist = STAILQ_HEAD_INITIALIZER(varlist);
@@ -176,7 +175,7 @@ main(int argc, char *argv[])
char *cols;
int all, ch, elem, flag, _fmt, i, lineno;
int nentries, nkept, nselectors;
int prtheader, wflag, what, xkeep, xkeep_implied;
int prtheader, showthreads, wflag, what, xkeep, xkeep_implied;
char errbuf[_POSIX2_LINE_MAX];
(void) setlocale(LC_ALL, "");
+1 -1
View File
@@ -91,7 +91,7 @@ then 0x00, and then 0xff again, before they are deleted.
Specifying this flag for a read only file will cause
.Nm
to generate an error message and exit.
The file will not be removed or overwritten.
The file wil not be removed or overwritten.
.It Fl R
Attempt to remove the file hierarchy rooted in each file argument.
The
+1 -2
View File
@@ -307,7 +307,6 @@ err:
}
if (errno)
err(1, "fts_read");
fts_close(fts);
}
void
@@ -347,7 +346,7 @@ rm_file(char **argv)
if (!fflag && !S_ISWHT(sb.st_mode) && !check(f, f, &sb))
continue;
rval = 0;
if (!uid && !S_ISWHT(sb.st_mode) &&
if (!uid &&
(sb.st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
!(sb.st_flags & (SF_APPEND|SF_IMMUTABLE)))
rval = chflags(f, sb.st_flags & ~(UF_APPEND|UF_IMMUTABLE));
-2
View File
@@ -44,8 +44,6 @@ The
.Nm
utility sets discretionary access control information on
the specified file(s).
If no files are specified, or the list consists of the
only "-", the file names are taken from the standard input.
.Pp
The following options are available:
.Bl -tag -width indent
+1 -5
View File
@@ -109,7 +109,6 @@ main(int argc, char *argv[])
int local_error, carried_error, ch, i;
struct sf_file *file;
struct sf_entry *entry;
const char *fn_dup;
acl_type = ACL_TYPE_ACCESS;
carried_error = local_error = 0;
@@ -188,10 +187,7 @@ main(int argc, char *argv[])
while (fgets(filename, (int)sizeof(filename), stdin)) {
/* remove the \n */
filename[strlen(filename) - 1] = '\0';
fn_dup = strdup(filename);
if (fn_dup == NULL)
err(1, "strdup() failed");
add_filename(fn_dup);
add_filename(filename);
}
} else
for (i = 0; i < argc; i++)
+1 -1
View File
@@ -22,7 +22,7 @@ LFLAGS= -8 # 8-bit lex scanner for arithmetic
CFLAGS+=-DSHELL -I. -I${.CURDIR}
# for debug:
# CFLAGS+= -g -DDEBUG=2
WARNS?= 3
WARNS?= 0
WFORMAT=0
.PATH: ${.CURDIR}/bltin \
+2 -2
View File
@@ -144,7 +144,7 @@ unalias(char *name)
}
#ifdef mkinit
MKINIT void rmaliases(void);
MKINIT void rmaliases();
SHELLPROC {
rmaliases();
@@ -242,7 +242,7 @@ unaliascmd(int argc __unused, char **argv __unused)
}
}
for (i = 0; *argptr; argptr++)
i |= unalias(*argptr);
i = unalias(*argptr);
return (i);
}
+1 -3
View File
@@ -30,8 +30,6 @@
* $FreeBSD$
*/
extern char *arith_buf, *arith_startbuf;
int arith(char *);
void arith_lex_reset(void);
int arith_assign(char *, arith_t);
int expcmd(int, char **);
+3 -3
View File
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
#include <limits.h>
#include <stdio.h>
#include "arith.h"
#include "shell.h"
#include "var.h"
%}
@@ -262,11 +261,12 @@ expr:
#define lstrlen(var) (3 + (2 + CHAR_BIT * sizeof((var))) / 3)
char *arith_buf, *arith_startbuf;
extern void arith_lex_reset();
int yylex(void);
int yyparse(void);
static int
int
arith_assign(char *name, arith_t value)
{
char *str;
@@ -294,7 +294,7 @@ arith(char *s)
return result;
}
static void
void
yyerror(char *s)
{
+1 -3
View File
@@ -42,15 +42,13 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include "arith.h"
#include "shell.h"
#include "y.tab.h"
#include "error.h"
#include "memalloc.h"
#include "var.h"
int yylex(void);
extern char *arith_buf, *arith_startbuf;
#undef YY_INPUT
#define YY_INPUT(buf,result,max) \
result = (*buf = *arith_buf++) ? 1 : YY_NULL;
-2
View File
@@ -82,7 +82,5 @@
pointer stalloc(int);
void error(const char *, ...) __printf0like(1, 2);
int echocmd(int, char **);
int testcmd(int, char **);
extern char *commandname;
+31 -29
View File
@@ -36,56 +36,58 @@
#
# This file lists all the builtin commands. The first column is the name
# of a C routine.
# The -j flag specifies that this command is to be excluded from systems
# without job control.
# The -h flag specifies that this command is to be excluded from systems
# based on the NO_HISTORY compile-time symbol.
# The -s flag specifies that this is a POSIX 'special built-in' command.
# The rest of the line specifies the command name or names used to run the
# command. The entry for bltincmd, which is run when the user does not specify
# a command, must come first.
# of a C routine. The -j flag, if present, specifies that this command
# is to be excluded from systems without job control, and the -h flag,
# if present specifies that this command is to be excluded from systems
# based on the NO_HISTORY compile-time symbol. The rest of the line
# specifies the command name or names used to run the command. The entry
# for bltincmd, which is run when the user does not specify a command, must
# come first.
#
# NOTE: bltincmd must come first!
bltincmd builtin
aliascmd alias
bgcmd -j bg
bindcmd bind
breakcmd -s break -s continue
cdcmd cd chdir
commandcmd command
dotcmd -s .
#alloccmd alloc
bgcmd -j bg
breakcmd break continue
#catfcmd catf
cdcmd cd chdir
dotcmd .
echocmd echo
evalcmd -s eval
execcmd -s exec
exitcmd -s exit
evalcmd eval
execcmd exec
exitcmd exit
expcmd exp let
exportcmd -s export -s readonly
exportcmd export readonly
#exprcmd expr
falsecmd false
histcmd -h fc
fgcmd -j fg
getoptscmd getopts
hashcmd hash
histcmd -h fc
jobidcmd jobid
jobscmd jobs
#linecmd line
localcmd local
#nlechocmd nlecho
#printfcmd printf
pwdcmd pwd
readcmd read
returncmd -s return
setcmd -s set
returncmd return
setcmd set
setvarcmd setvar
shiftcmd -s shift
testcmd test [
timescmd -s times
trapcmd -s trap
truecmd -s : true
shiftcmd shift
trapcmd trap
truecmd : true
typecmd type
ulimitcmd ulimit
umaskcmd umask
unaliascmd unalias
unsetcmd -s unset
unsetcmd unset
waitcmd wait
#foocmd foo
aliascmd alias
ulimitcmd ulimit
testcmd test [
bindcmd bind
wordexpcmd wordexp
+40 -48
View File
@@ -68,9 +68,7 @@ STATIC int cdlogical(char *);
STATIC int cdphysical(char *);
STATIC int docd(char *, int, int);
STATIC char *getcomponent(void);
STATIC char *findcwd(char *);
STATIC void updatepwd(char *);
STATIC char *getpwd2(char *, size_t);
STATIC int updatepwd(char *);
STATIC char *curdir = NULL; /* current working directory */
STATIC char *prevdir; /* previous working directory */
@@ -126,9 +124,8 @@ cdcmd(int argc, char **argv)
* XXX - rethink
*/
if (p[0] == '.' && p[1] == '/' && p[2] != '\0')
print = strcmp(p + 2, dest);
else
print = strcmp(p, dest);
p += 2;
print = strcmp(p, dest);
}
if (docd(p, print, phys) >= 0)
return 0;
@@ -203,11 +200,10 @@ cdlogical(char *dest)
}
INTOFF;
if ((p = findcwd(badstat ? NULL : dest)) == NULL || chdir(p) < 0) {
if (updatepwd(badstat ? NULL : dest) < 0 || chdir(curdir) < 0) {
INTON;
return (-1);
}
updatepwd(p);
INTON;
return (0);
}
@@ -215,14 +211,12 @@ cdlogical(char *dest)
STATIC int
cdphysical(char *dest)
{
char *p;
INTOFF;
if (chdir(dest) < 0 || (p = findcwd(NULL)) == NULL) {
if (chdir(dest) < 0 || updatepwd(NULL) < 0) {
INTON;
return (-1);
}
updatepwd(p);
INTON;
return (0);
}
@@ -252,20 +246,38 @@ getcomponent(void)
}
STATIC char *
findcwd(char *dir)
/*
* Update curdir (the name of the current directory) in response to a
* cd command. We also call hashcd to let the routines in exec.c know
* that the current directory has changed.
*/
STATIC int
updatepwd(char *dir)
{
char *new;
char *p;
hashcd(); /* update command hash table */
/*
* If our argument is NULL, we don't know the current directory
* any more because we traversed a symbolic link or something
* we couldn't stat().
*/
if (dir == NULL || curdir == NULL) {
p = stalloc(PATH_MAX);
return getpwd2(p, PATH_MAX);
if (prevdir)
ckfree(prevdir);
INTOFF;
prevdir = curdir;
curdir = NULL;
if (getpwd() == NULL) {
INTON;
return (-1);
}
setvar("PWD", curdir, VEXPORT);
setvar("OLDPWD", prevdir, VEXPORT);
INTON;
return (0);
}
cdcomppath = stalloc(strlen(dir) + 1);
scopy(dir, cdcomppath);
@@ -289,25 +301,16 @@ findcwd(char *dir)
if (new == stackblock())
STPUTC('/', new);
STACKSTRNUL(new);
return stackblock();
}
/*
* Update curdir (the name of the current directory) in response to a
* cd command. We also call hashcd to let the routines in exec.c know
* that the current directory has changed.
*/
STATIC void
updatepwd(char *dir)
{
hashcd(); /* update command hash table */
INTOFF;
if (prevdir)
ckfree(prevdir);
prevdir = curdir;
curdir = savestr(dir);
curdir = savestr(stackblock());
setvar("PWD", curdir, VEXPORT);
setvar("OLDPWD", prevdir, VEXPORT);
INTON;
return (0);
}
int
@@ -351,31 +354,17 @@ pwdcmd(int argc, char **argv)
}
/*
* Get the current directory and cache the result in curdir.
* Find out what the current directory is. If we already know the current
* directory, this routine returns immediately.
*/
char *
getpwd(void)
{
char buf[PATH_MAX];
char *p;
if (curdir)
return curdir;
p = getpwd2(buf, sizeof(buf));
if (p != NULL)
curdir = savestr(p);
return curdir;
}
/*
* Return the current directory.
*/
STATIC char *
getpwd2(char *buf, size_t size)
{
if (getcwd(buf, size) == NULL) {
if (getcwd(buf, sizeof(buf)) == NULL) {
char *pwd = getenv("PWD");
struct stat stdot, stpwd;
@@ -383,9 +372,12 @@ getpwd2(char *buf, size_t size)
stat(pwd, &stpwd) != -1 &&
stdot.st_dev == stpwd.st_dev &&
stdot.st_ino == stpwd.st_ino) {
return pwd;
curdir = savestr(pwd);
return curdir;
}
return NULL;
}
return buf;
curdir = savestr(buf);
return curdir;
}
+33 -77
View File
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/resource.h>
#include <sys/wait.h> /* For WIFSIGNALED(status) */
#include <errno.h>
@@ -91,8 +90,8 @@ int exitstatus; /* exit status of last command */
int oexitstatus; /* saved exit status */
STATIC void evalloop(union node *, int);
STATIC void evalfor(union node *, int);
STATIC void evalloop(union node *);
STATIC void evalfor(union node *);
STATIC void evalcase(union node *, int);
STATIC void evalsubshell(union node *, int);
STATIC void expredir(union node *);
@@ -183,9 +182,6 @@ evalstring(char *s)
void
evaltree(union node *n, int flags)
{
int do_etest;
do_etest = 0;
if (n == NULL) {
TRACE(("evaltree(NULL) called\n"));
exitstatus = 0;
@@ -194,10 +190,10 @@ evaltree(union node *n, int flags)
#ifndef NO_HISTORY
displayhist = 1; /* show history substitutions done with fc */
#endif
TRACE(("evaltree(%p: %d) called\n", (void *)n, n->type));
TRACE(("evaltree(0x%lx: %d) called\n", (long)n, n->type));
switch (n->type) {
case NSEMI:
evaltree(n->nbinary.ch1, flags & ~EV_EXIT);
evaltree(n->nbinary.ch1, 0);
if (evalskip)
goto out;
evaltree(n->nbinary.ch2, flags);
@@ -223,7 +219,6 @@ evaltree(union node *n, int flags)
break;
case NSUBSHELL:
evalsubshell(n, flags);
do_etest = !(flags & EV_TESTED);
break;
case NBACKGND:
evalsubshell(n, flags);
@@ -242,10 +237,10 @@ evaltree(union node *n, int flags)
}
case NWHILE:
case NUNTIL:
evalloop(n, flags & ~EV_EXIT);
evalloop(n);
break;
case NFOR:
evalfor(n, flags & ~EV_EXIT);
evalfor(n);
break;
case NCASE:
evalcase(n, flags);
@@ -261,11 +256,9 @@ evaltree(union node *n, int flags)
case NPIPE:
evalpipe(n);
do_etest = !(flags & EV_TESTED);
break;
case NCMD:
evalcommand(n, flags, (struct backcmd *)NULL);
do_etest = !(flags & EV_TESTED);
break;
default:
out1fmt("Node type = %d\n", n->type);
@@ -275,13 +268,15 @@ evaltree(union node *n, int flags)
out:
if (pendingsigs)
dotrap();
if ((flags & EV_EXIT) || (eflag && exitstatus != 0 && do_etest))
if ((flags & EV_EXIT) || (eflag && exitstatus
&& !(flags & EV_TESTED) && (n->type == NCMD ||
n->type == NSUBSHELL)))
exitshell(exitstatus);
}
STATIC void
evalloop(union node *n, int flags)
evalloop(union node *n)
{
int status;
@@ -305,7 +300,7 @@ skipping: if (evalskip == SKIPCONT && --skipcount <= 0) {
if (exitstatus == 0)
break;
}
evaltree(n->nbinary.ch2, flags);
evaltree(n->nbinary.ch2, 0);
status = exitstatus;
if (evalskip)
goto skipping;
@@ -317,7 +312,7 @@ skipping: if (evalskip == SKIPCONT && --skipcount <= 0) {
STATIC void
evalfor(union node *n, int flags)
evalfor(union node *n)
{
struct arglist arglist;
union node *argp;
@@ -338,7 +333,7 @@ evalfor(union node *n, int flags)
loopnest++;
for (sp = arglist.list ; sp ; sp = sp->next) {
setvar(n->nfor.var, sp->text, 0);
evaltree(n->nfor.body, flags);
evaltree(n->nfor.body, 0);
if (evalskip) {
if (evalskip == SKIPCONT && --skipcount <= 0) {
evalskip = 0;
@@ -367,7 +362,6 @@ evalcase(union node *n, int flags)
setstackmark(&smark);
arglist.lastp = &arglist.list;
oexitstatus = exitstatus;
exitstatus = 0;
expandarg(n->ncase.expr, &arglist, EXP_TILDE);
for (cp = n->ncase.cases ; cp && evalskip == 0 ; cp = cp->nclist.next) {
for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) {
@@ -463,7 +457,7 @@ evalpipe(union node *n)
int prevfd;
int pip[2];
TRACE(("evalpipe(%p) called\n", (void *)n));
TRACE(("evalpipe(0x%lx) called\n", (long)n));
pipelen = 0;
for (lp = n->npipe.cmdlist ; lp ; lp = lp->next)
pipelen++;
@@ -602,7 +596,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
#endif
/* First expand the arguments. */
TRACE(("evalcommand(%p, %d) called\n", (void *)cmd, flags));
TRACE(("evalcommand(0x%lx, %d) called\n", (long)cmd, flags));
setstackmark(&smark);
arglist.lastp = &arglist.list;
varlist.lastp = &varlist.list;
@@ -644,19 +638,14 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
/* Print the command if xflag is set. */
if (xflag) {
char sep = 0;
out2str(ps4val());
outc('+', &errout);
for (sp = varlist.list ; sp ; sp = sp->next) {
if (sep != 0)
outc(' ', &errout);
outc(' ', &errout);
out2str(sp->text);
sep = ' ';
}
for (sp = arglist.list ; sp ; sp = sp->next) {
if (sep != 0)
outc(' ', &errout);
outc(' ', &errout);
out2str(sp->text);
sep = ' ';
}
outc('\n', &errout);
flushout(&errout);
@@ -664,10 +653,8 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
/* Now locate the command. */
if (argc == 0) {
/* Variable assignment(s) without command */
cmdentry.cmdtype = CMDBUILTIN;
cmdentry.u.index = BLTINCMD;
cmdentry.special = 1;
} else {
static const char PATH[] = "PATH=";
char *path = pathval();
@@ -713,8 +700,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
argv++;
if (--argc == 0)
break;
if ((cmdentry.u.index = find_builtin(*argv,
&cmdentry.special)) < 0) {
if ((cmdentry.u.index = find_builtin(*argv)) < 0) {
outfmt(&errout, "%s: not found\n", *argv);
exitstatus = 127;
flushout(&errout);
@@ -821,6 +807,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
memout.bufsize = 64;
mode |= REDIR_BACKQ;
}
redirect(cmd->ncmd.redirect, mode);
savecmdname = commandname;
cmdenviron = varlist.list;
e = -1;
@@ -831,9 +818,6 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
}
savehandler = handler;
handler = &jmploc;
redirect(cmd->ncmd.redirect, mode);
if (cmdentry.special)
listsetvar(cmdenviron);
commandname = argv[0];
argptr = argv + 1;
optptr = NULL; /* initialize nextopt */
@@ -853,7 +837,14 @@ cmddone:
handler = savehandler;
if (e != -1) {
if ((e != EXERROR && e != EXEXEC)
|| cmdentry.special)
|| cmdentry.u.index == BLTINCMD
|| cmdentry.u.index == DOTCMD
|| cmdentry.u.index == EVALCMD
#ifndef NO_HISTORY
|| cmdentry.u.index == HISTCMD
#endif
|| cmdentry.u.index == EXECCMD
|| cmdentry.u.index == COMMANDCMD)
exraise(e);
FORCEINTON;
}
@@ -915,7 +906,7 @@ prehash(union node *n)
{
struct cmdentry entry;
if (n && n->type == NCMD && n->ncmd.args)
if (n->type == NCMD && n->ncmd.args)
if (goodname(n->ncmd.args->narg.text))
find_command(n->ncmd.args->narg.text, &entry, 0,
pathval());
@@ -929,12 +920,14 @@ prehash(union node *n)
*/
/*
* No command given, or a bltin command with no arguments.
* No command given, or a bltin command with no arguments. Set the
* specified variables.
*/
int
bltincmd(int argc __unused, char **argv __unused)
{
listsetvar(cmdenviron);
/*
* Preserve exitstatus of a previous possible redirection
* as POSIX mandates
@@ -979,7 +972,6 @@ commandcmd(int argc, char **argv)
struct strlist *sp;
char *path;
int ch;
int cmd = -1;
for (sp = cmdenviron; sp ; sp = sp->next)
setvareq(sp->text, VEXPORT|VSTACK);
@@ -987,17 +979,11 @@ commandcmd(int argc, char **argv)
optind = optreset = 1;
opterr = 0;
while ((ch = getopt(argc, argv, "pvV")) != -1) {
while ((ch = getopt(argc, argv, "p")) != -1) {
switch (ch) {
case 'p':
path = stdpath;
break;
case 'v':
cmd = TYPECMD_SMALLV;
break;
case 'V':
cmd = TYPECMD_BIGV;
break;
case '?':
default:
error("unknown option: -%c", optopt);
@@ -1006,11 +992,6 @@ commandcmd(int argc, char **argv)
argc -= optind;
argv += optind;
if (cmd != -1) {
if (argc != 1)
error("wrong number of arguments");
return typecmd_impl(2, argv - 1, cmd);
}
if (argc != 0) {
old = handler;
handler = &loc;
@@ -1081,28 +1062,3 @@ execcmd(int argc, char **argv)
}
return 0;
}
int
timescmd(int argc __unused, char **argv __unused)
{
struct rusage ru;
long shumins, shsmins, chumins, chsmins;
double shusecs, shssecs, chusecs, chssecs;
if (getrusage(RUSAGE_SELF, &ru) < 0)
return 1;
shumins = ru.ru_utime.tv_sec / 60;
shusecs = ru.ru_utime.tv_sec % 60 + ru.ru_utime.tv_usec / 1000000.;
shsmins = ru.ru_stime.tv_sec / 60;
shssecs = ru.ru_stime.tv_sec % 60 + ru.ru_stime.tv_usec / 1000000.;
if (getrusage(RUSAGE_CHILDREN, &ru) < 0)
return 1;
chumins = ru.ru_utime.tv_sec / 60;
chusecs = ru.ru_utime.tv_sec % 60 + ru.ru_utime.tv_usec / 1000000.;
chsmins = ru.ru_stime.tv_sec / 60;
chssecs = ru.ru_stime.tv_sec % 60 + ru.ru_stime.tv_usec / 1000000.;
out1fmt("%ldm%.3fs %ldm%.3fs\n%ldm%.3fs %ldm%.3fs\n", shumins,
shusecs, shsmins, shssecs, chumins, chusecs, chsmins, chssecs);
return 0;
}
-1
View File
@@ -56,7 +56,6 @@ int returncmd(int, char **);
int falsecmd(int, char **);
int truecmd(int, char **);
int execcmd(int, char **);
int timescmd(int, char **);
int commandcmd(int, char **);
/* in_function returns nonzero if we are currently evaluating a function */
+19 -64
View File
@@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$");
struct tblentry {
struct tblentry *next; /* next entry in hash chain */
union param param; /* definition of builtin function */
int special; /* flag for special builtin commands */
short cmdtype; /* index identifying command */
char rehash; /* if set, cd done since entry created */
char cmdname[ARB]; /* name of command */
@@ -318,7 +317,6 @@ find_command(char *name, struct cmdentry *entry, int printerr, char *path)
struct stat statb;
int e;
int i;
int spec;
/* If name contains a slash, don't use the hash table */
if (strchr(name, '/') != NULL) {
@@ -332,12 +330,11 @@ find_command(char *name, struct cmdentry *entry, int printerr, char *path)
goto success;
/* If %builtin not in path, check for builtin next */
if (builtinloc < 0 && (i = find_builtin(name, &spec)) >= 0) {
if (builtinloc < 0 && (i = find_builtin(name)) >= 0) {
INTOFF;
cmdp = cmdlookup(name, 1);
cmdp->cmdtype = CMDBUILTIN;
cmdp->param.index = i;
cmdp->special = spec;
INTON;
goto success;
}
@@ -359,13 +356,12 @@ loop:
index++;
if (pathopt) {
if (prefix("builtin", pathopt)) {
if ((i = find_builtin(name, &spec)) < 0)
if ((i = find_builtin(name)) < 0)
goto loop;
INTOFF;
cmdp = cmdlookup(name, 1);
cmdp->cmdtype = CMDBUILTIN;
cmdp->param.index = i;
cmdp->special = spec;
INTON;
goto success;
} else if (prefix("func", pathopt)) {
@@ -434,7 +430,6 @@ success:
cmdp->rehash = 0;
entry->cmdtype = cmdp->cmdtype;
entry->u = cmdp->param;
entry->special = cmdp->special;
}
@@ -444,15 +439,13 @@ success:
*/
int
find_builtin(char *name, int *special)
find_builtin(char *name)
{
const struct builtincmd *bp;
for (bp = builtincmd ; bp->name ; bp++) {
if (*bp->name == *name && equal(bp->name, name)) {
*special = bp->special;
if (*bp->name == *name && equal(bp->name, name))
return bp->code;
}
}
return -1;
}
@@ -562,7 +555,7 @@ clearcmdentry(int firstchange)
*/
#ifdef mkinit
MKINIT void deletefuncs(void);
MKINIT void deletefuncs();
SHELLPROC {
deletefuncs();
@@ -712,12 +705,11 @@ unsetfunc(char *name)
}
/*
* Shared code for the following builtin commands:
* type, command -v, command -V
* Locate and print what a word is...
*/
int
typecmd_impl(int argc, char **argv, int cmd)
typecmd(int argc, char **argv)
{
struct cmdentry entry;
struct tblentry *cmdp;
@@ -728,28 +720,20 @@ typecmd_impl(int argc, char **argv, int cmd)
extern char *const parsekwd[];
for (i = 1; i < argc; i++) {
if (cmd != TYPECMD_SMALLV)
out1str(argv[i]);
out1str(argv[i]);
/* First look at the keywords */
for (pp = (char **)parsekwd; *pp; pp++)
if (**pp == *argv[i] && equal(*pp, argv[i]))
break;
if (*pp) {
if (cmd == TYPECMD_SMALLV)
out1fmt("%s\n", argv[i]);
else
out1str(" is a shell keyword\n");
out1str(" is a shell keyword\n");
continue;
}
/* Then look at the aliases */
if ((ap = lookupalias(argv[i], 1)) != NULL) {
if (cmd == TYPECMD_SMALLV)
out1fmt("alias %s='%s'\n", argv[i], ap->val);
else
out1fmt(" is an alias for %s\n", ap->val);
out1fmt(" is an alias for %s\n", ap->val);
continue;
}
@@ -772,58 +756,29 @@ typecmd_impl(int argc, char **argv, int cmd)
name = padvance(&path, argv[i]);
stunalloc(name);
} while (--j >= 0);
if (cmd == TYPECMD_SMALLV)
out1fmt("%s\n", name);
else
out1fmt(" is%s %s\n",
(cmdp && cmd == TYPECMD_TYPE) ?
" a tracked alias for" : "",
name);
out1fmt(" is%s %s\n",
cmdp ? " a tracked alias for" : "", name);
} else {
if (eaccess(argv[i], X_OK) == 0) {
if (cmd == TYPECMD_SMALLV)
out1fmt("%s\n", argv[i]);
else
out1fmt(" is %s\n", argv[i]);
} else {
if (cmd != TYPECMD_SMALLV)
out1fmt(": %s\n",
strerror(errno));
error |= 127;
}
if (access(argv[i], X_OK) == 0)
out1fmt(" is %s\n", argv[i]);
else
out1fmt(": %s\n", strerror(errno));
}
break;
}
case CMDFUNCTION:
if (cmd == TYPECMD_SMALLV)
out1fmt("%s\n", argv[i]);
else
out1str(" is a shell function\n");
out1str(" is a shell function\n");
break;
case CMDBUILTIN:
if (cmd == TYPECMD_SMALLV)
out1fmt("%s\n", argv[i]);
else
out1str(" is a shell builtin\n");
out1str(" is a shell builtin\n");
break;
default:
if (cmd != TYPECMD_SMALLV)
out1str(": not found\n");
out1str(": not found\n");
error |= 127;
break;
}
}
return error;
}
/*
* Locate and print what a word is...
*/
int
typecmd(int argc, char **argv)
{
return typecmd_impl(argc, argv, TYPECMD_TYPE);
}
+1 -9
View File
@@ -39,12 +39,6 @@
#define CMDBUILTIN 1 /* command is a shell builtin */
#define CMDFUNCTION 2 /* command is a shell function */
/* values for typecmd_impl's third parameter */
enum {
TYPECMD_SMALLV, /* command -v */
TYPECMD_BIGV, /* command -V */
TYPECMD_TYPE /* type */
};
struct cmdentry {
int cmdtype;
@@ -52,7 +46,6 @@ struct cmdentry {
int index;
union node *func;
} u;
int special;
};
@@ -63,13 +56,12 @@ void shellexec(char **, char **, char *, int);
char *padvance(char **, char *);
int hashcmd(int, char **);
void find_command(char *, struct cmdentry *, int, char *);
int find_builtin(char *, int *);
int find_builtin(char *);
void hashcd(void);
void changepath(const char *);
void deletefuncs(void);
void addcmdentry(char *, struct cmdentry *);
void defun(char *, union node *);
int unsetfunc(char *);
int typecmd_impl(int, char **, int);
int typecmd(int, char **);
void clearcmdentry(int);
+10 -13
View File
@@ -98,7 +98,7 @@ STATIC void expbackq(union node *, int, int);
STATIC int subevalvar(char *, char *, int, int, int, int);
STATIC char *evalvar(char *, int);
STATIC int varisset(char *, int);
STATIC void varvalue(char *, int, int, int);
STATIC void varvalue(char *, int, int);
STATIC void recordregion(int, int, int);
STATIC void removerecordregions(int);
STATIC void ifsbreakup(char *, struct arglist *);
@@ -633,7 +633,7 @@ evalvar(char *p, int flag)
int easy;
int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
varflags = (unsigned char)*p++;
varflags = *p++;
subtype = varflags & VSTYPE;
var = p;
special = 0;
@@ -669,7 +669,7 @@ again: /* jump here after setting a variable with ${var=text} */
if (set && subtype != VSPLUS) {
/* insert the value of the variable */
if (special) {
varvalue(var, varflags & VSQUOTE, subtype, flag);
varvalue(var, varflags & VSQUOTE, flag & EXP_FULL);
if (subtype == VSLENGTH) {
varlen = expdest - stackblock() - startloc;
STADJUST(-varlen, expdest);
@@ -763,11 +763,6 @@ record:
goto record;
break;
case VSERROR:
c = p - var - 1;
error("${%.*s%s}: Bad substitution", c, var,
(c > 0 && *p != CTLENDVAR) ? "..." : "");
default:
abort();
}
@@ -841,7 +836,7 @@ varisset(char *name, int nulok)
*/
STATIC void
varvalue(char *name, int quoted, int subtype, int flag)
varvalue(char *name, int quoted, int allow_split)
{
int num;
char *p;
@@ -853,7 +848,7 @@ varvalue(char *name, int quoted, int subtype, int flag)
#define STRTODEST(p) \
do {\
if (flag & (EXP_FULL | EXP_CASE) && subtype != VSLENGTH) { \
if (allow_split) { \
syntax = quoted? DQSYNTAX : BASESYNTAX; \
while (*p) { \
if (syntax[(int)*p] == CCTL) \
@@ -888,7 +883,7 @@ numvar:
}
break;
case '@':
if (flag & EXP_FULL && quoted) {
if (allow_split && quoted) {
for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
STRTODEST(p);
if (*ap)
@@ -898,7 +893,7 @@ numvar:
}
/* FALLTHROUGH */
case '*':
if (ifsset())
if (ifsset() != 0)
sep = ifsval()[0];
else
sep = ' ';
@@ -1027,7 +1022,8 @@ ifsbreakup(char *string, struct arglist *arglist)
p++;
}
} while ((ifsp = ifsp->next) != NULL);
if (*start || (!ifsspc && start > string)) {
if (*start || (!ifsspc && start > string &&
(nulonly || 1))) {
sp = (struct strlist *)stalloc(sizeof *sp);
sp->text = start;
*arglist->lastp = sp;
@@ -1215,6 +1211,7 @@ expmeta(char *enddir, char *name)
scopy(dp->d_name, enddir);
addfname(expdir);
} else {
char *q;
for (p = enddir, q = dp->d_name;
(*p++ = *q++) != '\0';)
continue;
+1 -1
View File
@@ -156,7 +156,7 @@ sethistsize(hs)
if (hs == NULL || *hs == '\0' ||
(histsize = atoi(hs)) < 0)
histsize = 100;
history(hist, &he, H_SETSIZE, histsize);
history(hist, &he, H_EVENT, histsize);
}
}
+4 -13
View File
@@ -184,23 +184,14 @@ preadfd(void)
retry:
#ifndef NO_HISTORY
if (parsefile->fd == 0 && el) {
static const char *rl_cp;
static int el_len;
const char *rl_cp;
if (rl_cp == NULL)
rl_cp = el_gets(el, &el_len);
rl_cp = el_gets(el, &nr);
if (rl_cp == NULL)
nr = 0;
else {
nr = el_len;
if (nr > BUFSIZ - 1)
nr = BUFSIZ - 1;
memcpy(parsenextc, rl_cp, nr);
if (nr != el_len) {
el_len -= nr;
rl_cp += nr;
} else
rl_cp = NULL;
/* XXX - BUFSIZE should redesign so not necessary */
(void) strcpy(parsenextc, rl_cp);
}
} else
#endif
+19 -27
View File
@@ -98,7 +98,7 @@ STATIC void setcurjob(struct job *);
STATIC void deljob(struct job *);
STATIC struct job *getcurjob(struct job *);
#endif
STATIC void showjob(struct job *, pid_t, int);
STATIC void showjob(struct job *, pid_t, int, int);
/*
@@ -265,21 +265,18 @@ int
jobscmd(int argc, char *argv[])
{
char *id;
int ch, mode;
int ch, sformat, lformat;
optind = optreset = 1;
opterr = 0;
mode = SHOWJOBS_DEFAULT;
while ((ch = getopt(argc, argv, "lps")) != -1) {
sformat = lformat = 0;
while ((ch = getopt(argc, argv, "ls")) != -1) {
switch (ch) {
case 'l':
mode = SHOWJOBS_VERBOSE;
break;
case 'p':
mode = SHOWJOBS_PGIDS;
lformat = 1;
break;
case 's':
mode = SHOWJOBS_PIDS;
sformat = 1;
break;
case '?':
default:
@@ -290,25 +287,24 @@ jobscmd(int argc, char *argv[])
argv += optind;
if (argc == 0)
showjobs(0, mode);
showjobs(0, sformat, lformat);
else
while ((id = *argv++) != NULL)
showjob(getjob(id), 0, mode);
showjob(getjob(id), 0, sformat, lformat);
return (0);
}
STATIC void
showjob(struct job *jp, pid_t pid, int mode)
showjob(struct job *jp, pid_t pid, int sformat, int lformat)
{
char s[64];
struct procstat *ps;
struct job *j;
int col, curr, i, jobno, prev, procno;
pid_t ppid;
char c;
procno = (mode == SHOWJOBS_PGIDS) ? 1 : jp->nprocs;
procno = jp->nprocs;
jobno = jp - jobtab + 1;
curr = prev = 0;
#if JOBS
@@ -319,13 +315,11 @@ showjob(struct job *jp, pid_t pid, int mode)
}
#endif
for (ps = jp->ps ; ; ps++) { /* for each process */
if (mode == SHOWJOBS_PIDS || mode == SHOWJOBS_PGIDS) {
ppid = (mode == SHOWJOBS_PIDS) ? ps->pid :
getpgid(ps->pid);
out1fmt("%d\n", (int)ppid);
if (sformat) {
out1fmt("%d\n", (int)ps->pid);
goto skip;
}
if (mode != SHOWJOBS_VERBOSE && ps != jp->ps && pid == 0)
if (!lformat && ps != jp->ps && pid == 0)
goto skip;
if (pid != 0 && pid != ps->pid)
goto skip;
@@ -341,7 +335,7 @@ showjob(struct job *jp, pid_t pid, int mode)
fmtstr(s, 64, " %c ", c);
out1str(s);
col = strlen(s);
if (mode == SHOWJOBS_VERBOSE) {
if (lformat) {
fmtstr(s, 64, "%d ", (int)ps->pid);
out1str(s);
col += strlen(s);
@@ -394,7 +388,7 @@ skip: if (--procno <= 0)
*/
void
showjobs(int change, int mode)
showjobs(int change, int sformat, int lformat)
{
int jobno;
struct job *jp;
@@ -410,7 +404,7 @@ showjobs(int change, int mode)
}
if (change && ! jp->changed)
continue;
showjob(jp, 0, mode);
showjob(jp, 0, sformat, lformat);
jp->changed = 0;
if (jp->state == JOBDONE) {
freejob(jp);
@@ -653,7 +647,7 @@ makejob(union node *node __unused, int nprocs)
jp->ps = &jp->ps0;
}
INTON;
TRACE(("makejob(%p, %d) returns %%%d\n", (void *)node, nprocs,
TRACE(("makejob(0x%lx, %d) returns %%%d\n", (long)node, nprocs,
jp - jobtab + 1));
return jp;
}
@@ -739,7 +733,7 @@ forkshell(struct job *jp, union node *n, int mode)
pid_t pid;
pid_t pgrp;
TRACE(("forkshell(%%%d, %p, %d) called\n", jp - jobtab, (void *)n,
TRACE(("forkshell(%%%d, 0x%lx, %d) called\n", jp - jobtab, (long)n,
mode));
INTOFF;
flushall();
@@ -930,8 +924,6 @@ dowait(int block, struct job *job)
} while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) ||
(pid > 0 && WIFSTOPPED(status) && !iflag));
in_dowait--;
if (pid == -1 && errno == ECHILD && job != NULL)
job->state = JOBDONE;
if (breakwaitcmd != 0) {
breakwaitcmd = 0;
if (pid <= 0)
@@ -998,7 +990,7 @@ dowait(int block, struct job *job)
out1str(" (core dumped)");
out1c('\n');
} else
showjob(thisjob, pid, SHOWJOBS_DEFAULT);
showjob(thisjob, pid, 0, 0);
}
} else {
TRACE(("Not printing status, rootshell=%d, job=%p\n", rootshell, job));
+1 -8
View File
@@ -74,13 +74,6 @@ struct job {
#endif
};
enum {
SHOWJOBS_DEFAULT, /* job number, status, command */
SHOWJOBS_VERBOSE, /* job number, PID, status, command */
SHOWJOBS_PIDS, /* PID only */
SHOWJOBS_PGIDS /* PID of the group leader only */
};
extern pid_t backgndpid; /* pid of last background process */
extern int job_warning; /* user was warned about stopped jobs */
extern int in_waitcmd; /* are we in waitcmd()? */
@@ -91,7 +84,7 @@ void setjobctl(int);
int fgcmd(int, char **);
int bgcmd(int, char **);
int jobscmd(int, char **);
void showjobs(int, int);
void showjobs(int, int, int);
int waitcmd(int, char **);
int jobidcmd(int, char **);
struct job *makejob(union node *, int);
-1
View File
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
#include "shell.h"
#include "exec.h" /* defines padvance() */
#include "mail.h"
#include "var.h"
#include "output.h"
#include "memalloc.h"
+9 -11
View File
@@ -209,7 +209,7 @@ cmdloop(int top)
inter = 0;
if (iflag && top) {
inter++;
showjobs(1, SHOWJOBS_DEFAULT);
showjobs(1, 0, 0);
chkmail(0);
flushout(&output);
}
@@ -314,21 +314,19 @@ int
dotcmd(int argc, char **argv)
{
struct strlist *sp;
char *fullname;
if (argc < 2)
error("missing filename");
exitstatus = 0;
for (sp = cmdenviron; sp ; sp = sp->next)
setvareq(savestr(sp->text), VSTRFIXED|VTEXTFIXED);
fullname = find_dot_file(argv[1]);
setinputfile(fullname, 1);
commandname = fullname;
cmdloop(0);
popfile();
if (argc >= 2) { /* That's what SVR2 does */
char *fullname = find_dot_file(argv[1]);
setinputfile(fullname, 1);
commandname = fullname;
cmdloop(0);
popfile();
}
return exitstatus;
}
+2 -16
View File
@@ -57,10 +57,7 @@ ckmalloc(int nbytes)
{
pointer p;
INTOFF;
p = malloc(nbytes);
INTON;
if (p == NULL)
if ((p = malloc(nbytes)) == NULL)
error("Out of space");
return p;
}
@@ -73,22 +70,11 @@ ckmalloc(int nbytes)
pointer
ckrealloc(pointer p, int nbytes)
{
INTOFF;
p = realloc(p, nbytes);
INTON;
if (p == NULL)
if ((p = realloc(p, nbytes)) == NULL)
error("Out of space");
return p;
}
void
ckfree(pointer p)
{
INTOFF;
free(p);
INTON;
}
/*
* Make a copy of a string in safe storage.
+2 -1
View File
@@ -48,7 +48,6 @@ extern int herefd;
pointer ckmalloc(int);
pointer ckrealloc(pointer, int);
void ckfree(pointer);
char *savestr(char *);
pointer stalloc(int);
void stunalloc(pointer);
@@ -73,3 +72,5 @@ void ungrabstackstr(char *, char *);
#define STTOPC(p) p[-1]
#define STADJUST(amount, p) (p += (amount), sstrnleft -= (amount))
#define grabstackstr(p) stalloc(stackblocksize() - sstrnleft)
#define ckfree(p) free((pointer)(p))
+8 -9
View File
@@ -64,10 +64,6 @@ __FBSDID("$FreeBSD$");
#undef eflag
int readcmd(int, char **);
int umaskcmd(int, char **);
int ulimitcmd(int, char **);
/*
* The read builtin. The -r option causes backslashes to be treated like
* ordinary characters.
@@ -147,7 +143,6 @@ readcmd(int argc __unused, char **argv __unused)
if (tcgetattr(0, &told) == 0) {
memcpy(&tnew, &told, sizeof(told));
cfmakeraw(&tnew);
tnew.c_iflag |= told.c_iflag & ICRNL;
tcsetattr(0, TCSANOW, &tnew);
tsaved = 1;
}
@@ -193,7 +188,13 @@ readcmd(int argc __unused, char **argv __unused)
continue;
}
startword = 0;
if (ap[1] != NULL && strchr(ifs, c) != NULL) {
if (backslash && c == '\\') {
if (read(STDIN_FILENO, &c, 1) != 1) {
status = 1;
break;
}
STPUTC(c, p);
} else if (ap[1] != NULL && strchr(ifs, c) != NULL) {
STACKSTRNUL(p);
setvar(*ap, stackblock(), 0);
ap++;
@@ -269,20 +270,18 @@ umaskcmd(int argc __unused, char **argv)
mask = 0;
do {
if (*ap >= '8' || *ap < '0')
error("Illegal number: %s", *argptr);
error("Illegal number: %s", argv[1]);
mask = (mask << 3) + (*ap - '0');
} while (*++ap != '\0');
umask(mask);
} else {
void *set;
INTOFF;
if ((set = setmode (ap)) == 0)
error("Illegal number: %s", ap);
mask = getmode (set, ~mask & 0777);
umask(~mask & 0777);
free(set);
INTON;
}
}
return 0;
+5 -11
View File
@@ -58,22 +58,17 @@ cat <<\!
!
awk '/^[^#]/ {if(('$havejobs' || $2 != "-j") && ('$havehist' || $2 != "-h")) \
print $0}' builtins.def | sed 's/-[hj]//' > $temp
awk '{ printf "int %s(int, char **);\n", $1}' $temp
awk '{ printf "int %s();\n", $1}' $temp
echo '
int (*const builtinfunc[])(int, char **) = {'
int (*const builtinfunc[])() = {'
awk '/^[^#]/ { printf "\t%s,\n", $1}' $temp
echo '};
const struct builtincmd builtincmd[] = {'
awk '{ for (i = 2 ; i <= NF ; i++) {
if ($i == "-s") {
spc = 1;
} else {
printf "\t{ \"%s\", %d, %d },\n", $i, NR-1, spc
spc = 0;
}
printf "\t{ \"%s\", %d },\n", $i, NR-1
}}' $temp
echo ' { NULL, 0, 0 }
echo ' { NULL, 0 }
};'
exec > ${objdir}/builtins.h
@@ -90,9 +85,8 @@ echo '
struct builtincmd {
char *name;
int code;
int special;
};
extern int (*const builtinfunc[])(int, char **);
extern int (*const builtinfunc[])();
extern const struct builtincmd builtincmd[];'
rm -f $temp
+5 -6
View File
@@ -133,10 +133,10 @@ char shellproc[] = "\
struct event event[] = {
{ "INIT", "init", init, { NULL, 0, NULL, NULL } },
{ "RESET", "reset", reset, { NULL, 0, NULL, NULL } },
{ "SHELLPROC", "initshellproc", shellproc, { NULL, 0, NULL, NULL } },
{ NULL, NULL, NULL, { NULL, 0, NULL, NULL } }
{"INIT", "init", init},
{"RESET", "reset", reset},
{"SHELLPROC", "initshellproc", shellproc},
{NULL, NULL}
};
@@ -172,7 +172,6 @@ main(int argc __unused, char *argv[])
header_files[0] = "\"shell.h\"";
header_files[1] = "\"mystring.h\"";
header_files[2] = "\"init.h\"";
for (ap = argv + 1 ; *ap ; ap++)
readfile(*ap);
output();
@@ -392,7 +391,7 @@ output(void)
for (ep = event ; ep->name ; ep++) {
fputs("\n\n\n", fp);
fputs(ep->comment, fp);
fprintf(fp, "\nvoid\n%s(void)\n{\n", ep->routine);
fprintf(fp, "\nvoid\n%s() {\n", ep->routine);
writetext(&ep->code, fp);
fprintf(fp, "}\n");
}
+3 -4
View File
@@ -343,10 +343,9 @@ print(char *name)
static char *macro[] = {
"#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)",
"#define is_eof(c)\t((c) == PEOF)",
"#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))",
"#define is_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalpha((unsigned char) (c))))",
"#define is_in_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalnum((unsigned char) (c))))",
"#define is_alpha(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))",
"#define is_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalpha((unsigned char) (c))))",
"#define is_in_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalnum((unsigned char) (c))))",
"#define is_special(c)\t((is_type+SYNBASE)[c] & (ISSPECL|ISDIGIT))",
NULL
};
+14 -11
View File
@@ -247,7 +247,7 @@ end_options2:
STATIC void
minus_o(char *name, int val)
{
int i;
int doneset, i;
if (name == NULL) {
if (val) {
@@ -258,13 +258,16 @@ minus_o(char *name, int val)
optlist[i].val ? "on" : "off");
} else {
/* Output suitable for re-input to shell. */
for (i = 0; i < NOPTS; i++) {
if (i % 6 == 0)
out1str(i == 0 ? "set" : "\nset");
out1fmt(" %co %s", optlist[i].val ? '-' : '+',
optlist[i].name);
}
out1c('\n');
for (doneset = i = 0; i < NOPTS; i++)
if (optlist[i].val) {
if (!doneset) {
out1str("set");
doneset = 1;
}
out1fmt(" -o %s", optlist[i].name);
}
if (doneset)
out1c('\n');
}
} else {
for (i = 0; i < NOPTS; i++)
@@ -374,7 +377,7 @@ shiftcmd(int argc, char **argv)
if (argc > 1)
n = number(argv[1]);
if (n > shellparam.nparam)
return 1;
error("can't shift that many");
INTOFF;
shellparam.nparam -= n;
for (ap1 = shellparam.p ; --n >= 0 ; ap1++) {
@@ -383,7 +386,7 @@ shiftcmd(int argc, char **argv)
}
ap2 = shellparam.p;
while ((*ap2++ = *ap1++) != NULL);
shellparam.reset = 1;
shellparam.optnext = NULL;
INTON;
return 0;
}
@@ -405,7 +408,6 @@ setcmd(int argc, char **argv)
if (*argptr != NULL) {
setparam(argptr);
}
shellparam.reset = 1;
INTON;
return 0;
}
@@ -415,6 +417,7 @@ void
getoptsreset(const char *value)
{
if (number(value) == 1) {
shellparam.optnext = NULL;
shellparam.reset = 1;
}
}
-4
View File
@@ -134,10 +134,6 @@ outqstr(const char *p, struct output *file)
{
char ch;
if (p[0] == '\0') {
outstr("''", file);
return;
}
if (p[strcspn(p, "|&;<>()$`\\\"'")] == '\0' && (!ifsset() ||
p[strcspn(p, ifsval())] == '\0')) {
outstr(p, file);
+27 -31
View File
@@ -39,7 +39,6 @@ static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95";
__FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <unistd.h>
#include "shell.h"
#include "parser.h"
@@ -98,6 +97,12 @@ STATIC int startlinno; /* line # where last token started */
/* XXX When 'noaliases' is set to one, no alias expansion takes place. */
static int noaliases = 0;
#define GDB_HACK 1 /* avoid local declarations which gdb can't handle */
#ifdef GDB_HACK
static const char argvars[5] = {CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0'};
static const char types[] = "}-+?=";
#endif
STATIC union node *list(int);
STATIC union node *andor(void);
@@ -378,12 +383,13 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
if (lasttoken != TNL && lasttoken != TSEMI)
synexpect(-1);
} else {
static char argvars[5] = {
CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0'
};
#ifndef GDB_HACK
static const char argvars[5] = {CTLVAR, VSNORMAL|VSQUOTE,
'@', '=', '\0'};
#endif
n2 = (union node *)stalloc(sizeof (struct narg));
n2->type = NARG;
n2->narg.text = argvars;
n2->narg.text = (char *)argvars;
n2->narg.backquote = NULL;
n2->narg.next = NULL;
n1->nfor.args = n2;
@@ -952,7 +958,6 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
USTPUTC('\\', out);
pungetc();
} else if (c == '\n') {
plinno++;
if (doprompt)
setprompt(2);
else
@@ -1180,12 +1185,13 @@ parsesub: {
int typeloc;
int flags;
char *p;
#ifndef GDB_HACK
static const char types[] = "}-+?=";
#endif
int bracketed_name = 0; /* used to handle ${[0-9]*} variables */
c = pgetc();
if (c != '(' && c != '{' && (is_eof(c) || !is_name(c)) &&
!is_special(c)) {
if (c != '(' && c != '{' && !is_name(c) && !is_special(c)) {
USTPUTC('$', out);
pungetc();
} else if (c == '(') { /* $(command) or $((arith)) */
@@ -1212,11 +1218,11 @@ parsesub: {
else
subtype = 0;
}
if (!is_eof(c) && is_name(c)) {
if (is_name(c)) {
do {
STPUTC(c, out);
c = pgetc();
} while (!is_eof(c) && is_in_name(c));
} while (is_in_name(c));
} else if (is_digit(c)) {
if (bracketed_name) {
do {
@@ -1228,17 +1234,12 @@ parsesub: {
c = pgetc();
}
} else {
if (! is_special(c)) {
subtype = VSERROR;
if (c == '}')
pungetc();
else
USTPUTC(c, out);
} else {
USTPUTC(c, out);
c = pgetc();
}
if (! is_special(c))
badsub: synerror("Bad substitution");
USTPUTC(c, out);
c = pgetc();
}
STPUTC('=', out);
flags = 0;
if (subtype == 0) {
switch (c) {
@@ -1248,13 +1249,9 @@ parsesub: {
/*FALLTHROUGH*/
default:
p = strchr(types, c);
if (p == NULL) {
if (flags == VSNUL)
STPUTC(':', out);
STPUTC(c, out);
subtype = VSERROR;
} else
subtype = p - types + VSNORMAL;
if (p == NULL)
goto badsub;
subtype = p - types + VSNORMAL;
break;
case '%':
case '#':
@@ -1270,10 +1267,9 @@ parsesub: {
break;
}
}
} else if (subtype != VSERROR) {
} else {
pungetc();
}
STPUTC('=', out);
if (subtype != VSLENGTH && (dblquote || arinest))
flags |= VSQUOTE;
*(stackblock() + typeloc) = subtype | flags;
@@ -1603,7 +1599,7 @@ getprompt(void *unused __unused)
*/
case 'h':
case 'H':
ps[i] = '\0';
ps[i] == '\0';
gethostname(&ps[i], PROMPTLEN - i);
/* Skip to end of hostname. */
trim = (*fmt == 'h') ? '.' : '\0';
@@ -1619,7 +1615,7 @@ getprompt(void *unused __unused)
*/
case 'W':
case 'w':
ps[i] = '\0';
ps[i] == '\0';
getcwd(&ps[i], PROMPTLEN - i);
if (*fmt == 'W') {
/* Final path component only. */
-1
View File
@@ -60,7 +60,6 @@
#define VSTRIMRIGHT 0x8 /* ${var%pattern} */
#define VSTRIMRIGHTMAX 0x9 /* ${var%%pattern} */
#define VSLENGTH 0xa /* ${#var} */
#define VSERROR 0xb /* Syntax error, issue when expanded */
/*
+31 -168
View File
@@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd October 7, 2006
.Dd July 3, 2004
.Dt SH 1
.Os
.Sh NAME
@@ -208,22 +208,13 @@ option if it has been set).
.It Fl e Li errexit
Exit immediately if any untested command fails in non-interactive mode.
The exit status of a command is considered to be
explicitly tested if the command is part of the list used to control
an
.Ic if , elif , while ,
or
.Ic until ;
if the command is the left
explicitly tested if the command is used to control
an if, elif, while, or until; or if the command is the left
hand operand of an
.Dq Li &&
or
.Dq Li ||
operator; or if the command is a pipeline preceded by the
.Ic !\&
operator.
If a shell function is executed and its exit status is explicitly
tested, all commands of the function are considered to be tested as
well.
.It Fl f Li noglob
Disable pathname expansion.
.It Fl I Li ignoreeof
@@ -305,9 +296,8 @@ as it is read.
Useful for debugging.
.It Fl x Li xtrace
Write each command
(preceded by the value of the
.Ev PS4
variable)
(preceded by
.Dq Li "+ " )
to standard error before it is executed.
Useful for debugging.
.El
@@ -363,22 +353,10 @@ The following is a list of valid operators:
.It Li <& Ta Li >& Ta Li <<- Ta Li >|
.El
.El
.Pp
The character
.Ql #
introduces a comment if used at the beginning of a word.
The word starting with
.Ql #
and the rest of the line are ignored.
.Pp
.Tn ASCII
.Dv NUL
characters (character code 0) are not allowed in shell input.
.Ss Quoting
Quoting is used to remove the special meaning of certain characters
or words to the shell, such as operators, whitespace, keywords,
or alias names.
.Pp
or words to the shell, such as operators, whitespace, or
keywords.
There are three types of quoting: matched single quotes,
matched double quotes, and backslash.
.Bl -tag -width indent
@@ -444,16 +422,6 @@ to create functions with arguments.
They can also be
used to create lexically obscure code.
This use is discouraged.
.Pp
An alias name may be escaped in a command line, so that it is not
replaced by its alias value, by using quoting characters within or
adjacent to the alias name.
This is most often done by prefixing
an alias name with a backslash to execute a function, built-in, or
normal program with the same name.
See the
.Sx Quoting
subsection.
.Ss Commands
The shell interprets the words it reads according to a
language, the specification of which is outside the scope
@@ -808,15 +776,10 @@ repeat until the exit status of the first list is zero.
The syntax of the
.Ic for
command is:
.Dl Ic for Ar variable Op Ic in Ar word ...
.Dl Ic for Ar variable Ic in Ar word ...
.Dl Ic do Ar list
.Dl Ic done
.Pp
If
.Ic in
and the following words are omitted,
.Ic in Li $@
is used instead.
The words are expanded, and then the list is executed
repeatedly with the variable set to each word in turn.
The
@@ -865,10 +828,6 @@ described later),
separated by
.Dq Li \&|
characters.
The exit code of the
.Ic case
command is the exit code of the last command executed in the list or
zero if no patterns were matched.
.Ss Grouping Commands Together
Commands may be grouped by writing either
.Bd -literal -offset indent
@@ -913,7 +872,7 @@ and the syntax is:
.Bd -ragged -offset indent
.Ic local
.Op Ar variable ...
.Op Fl
.Op Ar -
.Ed
.Pp
The
@@ -1369,8 +1328,9 @@ This section lists the commands which
are built-in because they need to perform some operation
that cannot be performed by a separate process.
In addition to
these, built-in versions of essential utilities
are provided for efficiency.
these, a built-in version of the
.Xr test 1
command is provided for efficiency.
.Bl -tag -width indent
.It Ic \&:
A null command that returns a 0 (true) exit value.
@@ -1392,10 +1352,8 @@ for the file.
If it is not found in the
.Ev PATH ,
it is sought in the current working directory.
.It Ic \&[
A built-in equivalent of
.Xr test 1 .
.It Ic alias Oo Ar name Ns Oo = Ns Ar string Oc ... Oc
.It Ic alias Op Ar name ...
.It Ic alias Op Ar name Ns = Ns Ar string ...
If
.Ar name Ns = Ns Ar string
is specified, the shell defines the alias
@@ -1414,9 +1372,6 @@ built-in command prints the names and values of all defined aliases
.Ic unalias ) .
Alias values are written with appropriate quoting so that they are
suitable for re-input to the shell.
Also see the
.Sx Aliases
subsection.
.It Ic bg Op Ar job ...
Continue the specified jobs
(or the current job if no jobs are given)
@@ -1484,8 +1439,7 @@ A synonym for the
.Ic cd
built-in command.
.It Ic command Oo Fl p Oc Op Ar utility Op Ar argument ...
.It Ic command Oo Fl v | V Oc Op Ar utility
The first form of invocation executes the specified
Execute the specified
.Ar utility
as a simple command (see the
.Sx Simple Commands
@@ -1497,39 +1451,10 @@ option is specified, the command search is performed using a
default value of
.Ev PATH
that is guaranteed to find all of the standard utilities.
.Pp
If the
.Fl v
option is specified,
.Ar utility
is not executed but a description of its interpretation by the shell is
printed.
For ordinary commands the output is the path name; for shell built-in
commands, shell functions and keywords only the name is written.
Aliases are printed as
.Dq Ic alias Ar name Ns = Ns Ar value .
.Pp
The
.Fl V
option is identical to
.Fl v
except for the output.
It prints
.Dq Ar utility Ic is Ar description
where
.Ar description
is either
the path name to
.Ar utility ,
a shell builtin,
a shell function,
a shell keyword
or
an alias for
. Ar value .
.It Ic echo Oo Fl e | n Oc Op Ar string ...
Print a space-separated list of the arguments to the standard output
and append a newline character.
.It Ic echo Oo Fl e | n Oc Op Ar string
Print
.Ar string
to the standard output with a newline appended.
.Bl -tag -width indent
.It Fl n
Suppress the output of the trailing newline.
@@ -1609,8 +1534,7 @@ If
is given
it is used as the exit status of the shell;
otherwise the exit status of the preceding command is used.
.It Ic export Ar name ...
.It Ic export Op Fl p
.It Ic export Oo Fl p Oc Op Ar name ...
The specified names are exported so that they will
appear in the environment of subsequent commands.
The only way to un-export a variable is to
@@ -1629,8 +1553,6 @@ If the
option is specified, the exported variables are printed as
.Dq Ic export Ar name Ns = Ns Ar value
lines, suitable for re-input to the shell.
.It Ic false
A null command that returns a non-zero (false) exit value.
.It Ic fc Oo Fl e Ar editor Oc Op Ar first Op Ar last
.It Ic fc Fl l Oo Fl nr Oc Op Ar first Op Ar last
.It Ic fc Fl s Oo Ar old Ns = Ns Ar new Oc Op Ar first
@@ -1785,7 +1707,7 @@ Print the process id's of the processes in the specified
If the
.Ar job
argument is omitted, use the current job.
.It Ic jobs Oo Fl lps Oc Op Ar job ...
.It Ic jobs Oo Fl ls Oc Op Ar job ...
Print information about the specified jobs, or all jobs if no
.Ar job
argument is given.
@@ -1795,17 +1717,8 @@ If the
.Fl l
option is specified, the PID of each job is also printed.
If the
.Fl p
option is specified, only the process IDs for the process group leaders
are printed, one per line.
If the
.Fl s
option is specified, only the PIDs of the job commands are printed, one per
line.
.It Ic local Oo Ar variable ... Oc Op Fl
See the
.Sx Functions
subsection.
option is specified, only the PIDs of the jobs are printed, one per line.
.It Ic pwd Op Fl L | P
Print the path of the current directory.
The built-in command may
@@ -1871,7 +1784,7 @@ option is specified and the
elapses before any input is supplied,
the
.Ic read
command will return an exit status of 1 without assigning any values.
command will return without assigning any values.
The
.Ar timeout
value may optionally be followed by one of
@@ -1907,10 +1820,6 @@ If the
option is specified, the read-only variables are printed as
.Dq Ic readonly Ar name Ns = Ns Ar value
lines, suitable for re-input to the shell.
.It Ic return Op Ar exitstatus
See the
.Sx Functions
subsection.
.It Ic set Oo Fl /+abCEefIimnpTuVvx Oc Oo Fl /+o Ar longname Oc Oo
.Fl c Ar string Oc Op Fl - Ar arg ...
The
@@ -1976,16 +1885,7 @@ A shift sets the value of $1 to the value of $2,
the value of $2 to the value of $3, and so on,
decreasing the value of $# by one.
If there are zero positional parameters, shifting does not do anything.
.It Ic test
A built-in equivalent of
.Xr test 1 .
.It Ic times
Print the amount of time spent executing the shell and its children.
The first output line shows the user and system times for the shell
itself, the second one contains the user and system times for the
children.
.It Ic trap Oo Ar action Oc Ar signal ...
.It Ic trap Fl l
Cause the shell to parse and execute
.Ar action
when any specified
@@ -1997,27 +1897,14 @@ In addition, the pseudo-signal
may be used to specify an action that is performed when the shell terminates.
The
.Ar action
may be an empty string or a dash
.Pq Ar - ;
may be null or omitted;
the former causes the specified signal to be ignored
and the latter causes the default action to be taken.
Omitting the
.Ar action
is another way to request the default action, for compatibility reasons this
usage is not recommended though.
When the shell forks off a subshell,
it resets trapped (but not ignored) signals to the default action.
The
.Ic trap
command has no effect on signals that were ignored on entry to the shell.
.Pp
Option
.Fl l
causes the
.Ic trap
command to display a list of valid signal names.
.It Ic true
A null command that returns a 0 (true) exit value.
.It Ic type Op Ar name ...
Interpret each
.Ar name
@@ -2091,19 +1978,16 @@ The maximal number of simultaneous processes for this user ID.
.It Fl v Ar virtualmem
The maximal virtual size of a process, in kilobytes.
.El
.It Ic umask Oo Fl S Oc Op Ar mask
.It Ic umask Op Ar mask
Set the file creation mask (see
.Xr umask 2 )
to the octal or symbolic (see
.Xr chmod 1 )
value specified by
to the octal value specified by
.Ar mask .
If the argument is omitted, the current mask value is printed.
If the
.Fl S
option is specified, the output is symbolic, otherwise the output is octal.
.It Ic unalias Oo Fl a Oc Op Ar name ...
The specified alias names are removed.
.It Ic unalias Oo Fl a Oc Op Ar name
If
.Ar name
is specified, the shell removes that alias.
If
.Fl a
is specified, all aliases are removed.
@@ -2220,12 +2104,6 @@ unless you are the superuser, in which case it defaults to
.It Ev PS2
The secondary prompt string, which defaults to
.Dq Li "> " .
.It Ev PS4
The prefix for the trace output (if
.Fl x
is active).
The default is
.Dq Li "+ " .
.It Ev TERM
The default terminal setting for the shell.
This is inherited by children of the shell, and is used in the history
@@ -2257,23 +2135,8 @@ will return the argument.
.Sh HISTORY
A
.Nm
command, the Thompson shell, appeared in
command appeared in
.At v1 .
It was superseded in
.At v7
by the Bourne shell, which inherited the name
.Nm .
.Pp
This version of
.Nm
was rewritten in 1989 under the
.Bx
license after the Bourne shell from
.At V.4 .
.Sh AUTHORS
This version of
.Nm
was originally written by Kenneth Almquist.
.Sh BUGS
The
.Nm
+1
View File
@@ -371,6 +371,7 @@ void
opentrace(void)
{
char s[100];
char *getenv();
int flags;
if (!debug)
+7 -6
View File
@@ -153,14 +153,15 @@ trapcmd(int argc, char **argv)
if (argc <= 1) {
for (signo = 0 ; signo < sys_nsig ; signo++) {
if (signo < NSIG && trap[signo] != NULL) {
out1str("trap -- ");
out1qstr(trap[signo]);
if (signo == 0) {
out1str(" exit\n");
out1fmt("trap -- '%s' %s\n",
trap[signo], "exit");
} else if (sys_signame[signo]) {
out1fmt(" %s\n", sys_signame[signo]);
out1fmt("trap -- '%s' %s\n",
trap[signo], sys_signame[signo]);
} else {
out1fmt(" %d\n", signo);
out1fmt("trap -- '%s' %d\n",
trap[signo], signo);
}
}
}
@@ -381,7 +382,7 @@ onsig(int signo)
*/
if (Tflag &&
trap[signo] != NULL &&
! (trap[signo][0] == '\0') &&
! trap[signo][0] == '\0' &&
! (trap[signo][0] == ':' && trap[signo][1] == '\0'))
breakwaitcmd = 1;
+11 -54
View File
@@ -88,7 +88,6 @@ struct var vpath;
struct var vppid;
struct var vps1;
struct var vps2;
struct var vps4;
struct var vvers;
STATIC struct var voptind;
@@ -112,8 +111,6 @@ STATIC const struct varinit varinit[] = {
*/
{ &vps2, VSTRFIXED|VTEXTFIXED, "PS2=> ",
NULL },
{ &vps4, VSTRFIXED|VTEXTFIXED, "PS4=+ ",
NULL },
{ &voptind, VSTRFIXED|VTEXTFIXED, "OPTIND=1",
getoptsreset },
{ NULL, 0, NULL,
@@ -448,7 +445,7 @@ environment(void)
*/
#ifdef mkinit
MKINIT void shprocvar(void);
MKINIT void shprocvar();
SHELLPROC {
shprocvar();
@@ -482,21 +479,6 @@ shprocvar(void)
}
static int
var_compare(const void *a, const void *b)
{
const char *const *sa, *const *sb;
sa = a;
sb = b;
/*
* This compares two var=value strings which creates a different
* order from what you would probably expect. POSIX is somewhat
* ambiguous on what should be sorted exactly.
*/
return strcoll(*sa, *sb);
}
/*
* Command to list all variables which are set. Currently this command
@@ -510,41 +492,18 @@ showvarscmd(int argc __unused, char **argv __unused)
struct var **vpp;
struct var *vp;
const char *s;
const char **vars;
int i, n;
/*
* POSIX requires us to sort the variables.
*/
n = 0;
for (vpp = vartab; vpp < vartab + VTABSIZE; vpp++) {
for (vp = *vpp; vp; vp = vp->next) {
if (!(vp->flags & VUNSET))
n++;
for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) {
for (vp = *vpp ; vp ; vp = vp->next) {
if (vp->flags & VUNSET)
continue;
for (s = vp->text; *s != '='; s++)
out1c(*s);
out1c('=');
out1qstr(s + 1);
out1c('\n');
}
}
INTON;
vars = ckmalloc(n * sizeof(*vars));
i = 0;
for (vpp = vartab; vpp < vartab + VTABSIZE; vpp++) {
for (vp = *vpp; vp; vp = vp->next) {
if (!(vp->flags & VUNSET))
vars[i++] = vp->text;
}
}
qsort(vars, n, sizeof(*vars), var_compare);
for (i = 0; i < n; i++) {
for (s = vars[i]; *s != '='; s++)
out1c(*s);
out1c('=');
out1qstr(s + 1);
out1c('\n');
}
ckfree(vars);
INTOFF;
return 0;
}
@@ -582,11 +541,9 @@ exportcmd(int argc, char **argv)
argc -= optind;
argv += optind;
if (values && argc != 0)
error("-p requires no arguments");
listsetvar(cmdenviron);
if (argc != 0) {
while ((name = *argv++) != NULL) {
while ((name = *argptr++) != NULL) {
if ((p = strchr(name, '=')) != NULL) {
p++;
} else {
-2
View File
@@ -74,7 +74,6 @@ extern struct var vpath;
extern struct var vppid;
extern struct var vps1;
extern struct var vps2;
extern struct var vps4;
#ifndef NO_HISTORY
extern struct var vhistsize;
#endif
@@ -92,7 +91,6 @@ extern struct var vhistsize;
#define pathval() (vpath.text + 5)
#define ps1val() (vps1.text + 4)
#define ps2val() (vps2.text + 4)
#define ps4val() (vps4.text + 4)
#define optindval() (voptind.text + 7)
#ifndef NO_HISTORY
#define histsizeval() (vhistsize.text + 9)
+1 -14
View File
@@ -32,7 +32,7 @@
.\" @(#)test.1 8.1 (Berkeley) 5/31/93
.\" $FreeBSD$
.\"
.Dd July 31, 2006
.Dd July 3, 2004
.Dt TEST 1
.Os
.Sh NAME
@@ -332,16 +332,3 @@ The
utility implements a superset of the
.St -p1003.2
specification.
.Sh BUGS
Both sides are always evaluated in
.Fl a
and
.Fl o ,
unlike in the logical operators of
.Xr sh 1 .
For instance, the writable status of
.Pa file
will be tested by the following command even though the former expression
indicated false, which results in a gratuitous access to the file system:
.Pp
.Dl "[ -z abc -a -w file ]"
+4 -97
View File
@@ -12,11 +12,6 @@ The most significant changes were made by Erez Zadok in terms of bug fixes,
ports, and new features added. Erez Zadok is the current maintainer of
am-utils, as of January 1997.
* Ion Badulescu <[email protected]>
Co-maintainer of am-utils since late 1999: Linux and Solaris autofs support,
Linux NFSv3 support, major code reorganization, etc...
* Randall S. Winchester <[email protected]>
May 7, 1997: contributed a special version of upl102 that included NFS V.3
@@ -159,7 +154,7 @@ that do not allow forwarding of RPC messages to other services.
August 10, 1997: netbsd and other bsd systems have a mask flag for
pcfs_args (msdos mount).
* Christos Zoulas <christos@zoulas.com>
* Christos Zoulas <christos@deshaw.com>
September 25, 1997: fix to initialize uid/gid fields of pcfs_args_t on
netbsd.
@@ -168,19 +163,9 @@ October 10, 1997: compile time cleanups of printf()s in hlfsd code. If nfs
server is down or does not support a portmapper call, then mark it down as
version 2, and try again later.
November 29, 2002: compile fixes for NetBSD, a couple of bug fixes (one
already fixed by maintainers)
April 12, 2003: support new "unmount" option, useful to timeout removable
local media mounts.
October 12, 2004: patch to support two new amd.conf options, domain_strip
and auto_attrcache. Patch to cleanup NFS attribute-cache flag computation.
Patch to fix an inconsistency in timeouts in the RPC code between socket and
TLI implementations. Patch to print version string (amd -v) after all
options had been initialized, so we can print domain, host, and hostd.
Linux patch to use umount2(2) if umount(2) fails.
* Bill Paul <[email protected]>
November 5, 1997: NFS v.3 support for AIX 4.2.1, which does *not* include
@@ -206,8 +191,6 @@ and proto.
January 12, 1998: minor bug in output of amd -H.
June 23, 2005: assortment of small compile bugs on aix4, and solaris 5/6/7.
* Thomas Richter <[email protected]>
January 13, 1998: use case insensitive comparisons for variables that need
@@ -319,13 +302,9 @@ January 25, 2000: allow browsable auto maps.
* Wolfram Klaus <[email protected]>.
November 21, 2000: recognize proplist mnttab flag.
* Thomas Klausner <[email protected].at>
* Thomas Klausner <[email protected].at>
November 21, 2000: lots of NetBSD fixes (many of which are generic).
April 18, 2003: patch to reference am-utils info pages in man page.
November 28, 2004: small fixes to typos in amd.conf(5) man page.
* Olaf Kirch <[email protected]>
February 1, 2001: important Linux NFS error number mapping fixed
@@ -339,92 +318,20 @@ March 27, 2002: LDAP bug and port to HPUX-11.
* Philippe Troin <[email protected]>
July 12, 2001: Proper handling of GNU getopt, support for optionally
disabling LDAP/Hesiod, fixes for the dev/nodev option on Linux. Texi
documentation fix.
disabling LDAP/Hesiod, fixes for the dev/nodev option on Linux
November 28, 2001: Bug fix. Support "nolock" as an NFS option, not a
generic mount option.
July 17, 2003: pref:=null core dump fix. libgdbm portability. tcpd/librap
support. And a few other things for the 6.0 branch.
July 17, 2003: Debian fixes. Null am_pref free.
* Trond Myklebust <[email protected]>
January 10, 2002: Proper initialization of the timeo parameter on Linux, TCP
_must_ have a timeout 2 orders of magnitude larger than UDP
* George Ross <[email protected]>
April 29, 2002: Rework of old code, support for wildcards in LDAP queries,
and an FD leak fix. Amd -A support.
October 21, 2002: ldap_unbind fix for SIGPIPE, and support for LDAPv3
protocol version parameter (with Tim Colles <[email protected]>).
* Matthias Scheler <[email protected]>
June 14, 2002: patch to use "xlatecookie" NFS mount option.
* Jun-ichiro itojun Hagino <[email protected]>.
June 11, 2002: minor fixes to support NetBSD 1.6A.
* Sean Fagan <[email protected]>
March 14, 2003: detect and use the MNT2_GEN_OPT_AUTOMNTFS mount flag
on OS X / Darwin.
* Hendrik Scholz <[email protected]>
June 9, 2003: mk-amd-map should open temp db file using O_EXCL.
* Mark Davies <[email protected]>
July 14, 2003: define "xlatecookie" mnttab option if not defined (for
NetBSD). Support null hesiod entries if they start with a ".".
* Eric S. Raymond <[email protected]>
December 9, 2003: fix unbalanced [] typo in fsinfo man page.
* Martin Blapp <[email protected]>
July 6, 2004: recognize fields in pcfs_args_t in FreeBSD 5.
* Dan Nelson <[email protected]>
August 2, 2004: pawd to recognize "host" type mounts.
* Hauke Fath <[email protected]>
August 3, 2004: pawd to recognize "linkx" type mounts.
* Michael van Elst <[email protected]>
September 1, 2004: bug fix to avoid race condition in calls to mntctl on
AIX.
* Jonathan Chen <[email protected]>
October 22, 2004: patch/fix to move mlock/mlockall/plock code after the
fork().
June 29, 2005: core dump going off end of exported_ap[] array.
September 29, 2005: patch/fix for pawd not to go into an infinite loop.
October 25, 2005: patch/fix for pawd to repeatedly resolve path.
* David Rage <[email protected]>
January 17, 2005: prevent Amd from logging 'Read-only filesystem' errors
when the mount point has an ancestor (i.e. '/') that is mounted read-only.
* Kevin Layer <[email protected]>
January 28, 2005: basic instructions how to setup Amd on Mac OS-X.
* Dan Ottavio <[email protected]>
March 2, 2005: new global amd.conf option debug_mtab_file, to set the debug
mtab file when using debug_options=mtab. Default has changed from "./mtab"
to "/tmp/mtab" to avoid security problem. Bug fixed to ensure that Amd
terminates properly even mtab file doesn't exist.
* Erik Kline <ekline at ekline dot com>
January 3, 2005: implementation of executable maps for Amd.
* Jim Zajkowski <[email protected]>
March 14, 2005: small patch to amd2ldif.
* Adam Morley <adam at gmi dot com>
January 27, 2005: synchronize what amd2ldif does vs. what the ldap.schema
expects.
* Graeme Wilford <[email protected]>
July 4, 2005: buffer overflow in pawd.
* Steve Plite <[email protected]>
September 22, 2005: repair reversed meaning of D_AMQ, so amq will unregister
on exit.
+9 -106
View File
@@ -1,8 +1,5 @@
LIST OF KNOWN BUGS IN AM-UTILS OR OPERATING SYSTEMS
Note: report am-utils bugs via Bugzilla to https://bugzilla.am-utils.org/ or
by email to the [email protected] mailing list.
(1) mips-sgi-irix*
@@ -166,15 +163,12 @@ kernel will panic.
The Linux kernels don't support Amd's direct mounts very well, leading to
erratic behavior: shares that don't get remounted after the first timeout,
inability to restart Amd because its mount points cannot be unmounted, etc.
There are some kernel patches on the am-utils Web site, which solve these
problems. See http://www.am-utils.org/patches/.
inability to restart Amd because its mount points cannot be unmounted,
etc. There are some kernel patches on the am-utils Web site, which solve
these problems. See http://www.am-utils.org/patches/.
Later 2.4.x kernels completely disallow the hack amd was using for direct
mounts, so another solution will have to be found.
Note: the above is for the old-style amd mount_type = nfs. The autofs mounts
don't support direct mounts at all (due to lack of kernel support).
UPDATE: kernels 2.4.10 and later completely disallow the direct mount hack,
so direct mounts are simply not possible on those Linux kernels.
(12) *-aix5.1.0.0 and *-hpux9*
@@ -183,24 +177,14 @@ to use /bin/ksh instead. The buildall script will do it for you; if for some
reason you need to run configure directly, run it using 'ksh configure'
instead of just 'configure'.
[12A] *-aix5.2.*
[12A] *-aix5.1.*
Apparently there is an NFS client side bug in vmount() which causes amd to
hang when it starts (and tries to NFS-mount itself). According to IBM
engineers, this has to do with partial support code for IPv6: the NFS kernel
code doesn't appear to recognize the sin_family of the amd vmount(),
although amd does the right thing. The bug doesn't appear to be in 5.1 or
4.3.3. A fix from IBM is available, APAR number IY41417.
A binary built on 4.3.3 will not work on 5.2, because the kernel ABIs have
changed.
[12C] *-aix*
It is important that you install bos.net.nfs.adt before configuring and
building am-utils. If you don't, you will get compile-time or
configure-time errors, especially when configure tries to find AIX's
definition of struct nfs_args.
although amd does the right thing. The bug appears to have been fixed in
AIX 5.2. No known fix/patch is available for AIX 5.1 as of now (1/25/2003).
(13) *-linux and *-darwin6.0
@@ -217,87 +201,6 @@ default). Nonetheless, if a TCP connection breaks, under certain unclear
circumstances the kernel might "forget" about that flag and start using
unprivileged ports, causing the same EPERM error above.
(14) Solaris
The line "%option" in *.l files may cause Solaris /usr/ccs/bin/lex to abort
with the error "missing translation value." This is a bug in Solaris lex.
Erez & Ion.
Moreover, both Solaris yacc and lex produce code that does not pass strict
compilation such as "gcc -Wall -Werror".
Use GNU Flex and Bison instead. You can download ready-made binaries from
www.sunfreeware.com. Note, however, that sometimes the binaries on
sunfreeware.com don't seem to work, often because they are built against an
older revision of Solaris or build tools. In that case, build a fresh
version of GNU flex and/or bison from the latest stable sources. See
http://www.gnu.org/software/flex/ and http://www.gnu.org/software/bison/.
(15) Solaris 8 + patch 10899[34]-xx (18 <= xx < 25) or patch 11260[56]-xx
With this patch, Sun updated the autofs kernel module and automountd
userspace daemon from version 3 to version 4. They also updated the
/usr/include/rpcsvc/autofs_prot.x file, but forgot to regenerate the
autofs_prot.h file. Thus, when amd is compiled, it uses the old header and
thinks it should use autofs version 3, when in fact the kernel now supports
(and expects) only version 4.
The workaround is to run 'rpcgen -C -h /usr/include/rpcsvc/autofs_prot.x >
/usr/include/rpcsvc/autofs_prot.h' and completely reconfigure and rebuild
am-utils (removing config.cache before running configure).
The problem is fixed in patch revisions 10899[34]-25 and up.
(16) Linux kernel 2.4+ and lofs mounts
Lofs mounts are not supported by the linux kernel, at all, but since 2.4.0
the kernel supports a similar type of mount called a bind mount. Its
semantics are closer to those of a hardlink than to those of lofs, and one
of the results is that bind mounts ignore any mount options paseed to them.
Amd uses bind mounts internally to emulate lofs mounts, which means that
lofs mounts on linux will effectively ignore their mount parameters and
inherit whatever options the original filesystem mounted upon had.
(17) autoconf 2.57
If you see configure warnings of the following kind:
configure: WARNING: sys/proc.h: present but cannot be compiled
configure: WARNING: sys/proc.h: check for missing prerequisite headers?
configure: WARNING: sys/proc.h: proceeding with the preprocessor's result
configure: WARNING: ## ------------------------------------ ##
configure: WARNING: ## Report this to [email protected]. ##
configure: WARNING: ## ------------------------------------ ##
please ignore them. They are not real errors, and neither
[email protected] nor the am-utils maintainers are interested in hearing
about them. Autoconf simply tries to do more than we need and attempts to
compile each header in isolation, which fails for many system headers.
That's ok, because we only need to know if a header file exists -- we know
how to use it properly ourselves.
While autoconf does offer a way to specify other files to be included with
the tested header, in order to avoid these warnings, using it would enlarge
the resulting configure script by an order of magnitude, and for no real
gain. Configure is big enough as it is, we don't need any more useless
baggage in it.
(18) NetBSD 2.0.2, FreeBSD 5.4, OpenBSD 3.7, and quite possibly most other
BSDs and other OSs (as of September 2005)
Some BSD kernels don't have a way to turn off the NFS attribute cache. They
don't have a 'noac' mount flag, and setting various cache timeout fields in
struct nfs_args doesn't turn off the attribute cache; instead, it sets the
attribute cache timeout to some internal hard-coded default (usually
anywhere from 5-30 seconds). If Amd cannot turn off the NFS attribute
cache, under heavy Amd usage, users could get ESTALE errors from automounted
symlinks, or find that those symlinks point to the wrong place. One
workaround which would minimize this effect is to set auto_attrcache=1 in
your amd.conf, but it doesn't eliminate the problem! The best solutions are
(1) to use Amd in Autofs mode, if it's supported in your OS, and (2) talk to
your OS vendor to support a true "noac" flag. See README.attrcache for more
details.
Erez & the am-utils team.
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 1997-2006 Erez Zadok
Copyright (c) 1997-2004 Erez Zadok
Copyright (c) 1989 Jan-Simon Pendry
Copyright (c) 1989 Imperial College of Science, Technology & Medicine
Copyright (c) 1989 The Regents of the University of California.
+291 -6005
View File
File diff suppressed because it is too large. Load diff
-69
View File
@@ -1,69 +0,0 @@
Am-utils Frequently Asked Questions
Note: we started this FAQ only on March 15, 2005; so it's not long or
comprehensive, yet. Amd is much older than that, and so there's a lot of
information that's already available in other forms. If this FAQ doesn't
answer your questions, see information in the following sources:
1. The Am-utils book: http://www.am-utils.org/docs/amd-book/
2. The Am-utils user manual, which is part of the distribution and is also
available from www.am-utils.org.
3. The www.am-utils.org Web site resources, especially the "am-utils" mailing
list (and its archives).
4. In the am-utils distribution (always use the latest ones), see all of the
various README files (README, README.autofs, README.ldap, README.osx, and
README.y2k). The "BUGS" file also lists useful information about bugs
and problems with specific OSs which affect Amd. All of these text files
are also available from www.am-utils.org.
5. Some FAQ questions (including newbie questions) are available here:
http://www.kernelcorp.com/resources_faqs.html
6. Some problems are known bugs but have not been fixed yet: this are
listed in bugzilla in https://bugzilla.am-utils.org/
If you have additions to this FAQ, please let us know at
[email protected].
Thank you,
The Am-utils development team.
<FAQ>
*** Linux Questions
Q1. When I use Amd with Autofs and I restart Amd, how come it cannot remount
the Autofs partitions?
A1. This is a limitation of the Linux Autofs kernel module (for both autofs
v2. and v3). The Linux Autofs does not allow restarting automounted
points. There's nothing Amd can do about this. In fact, the same
problem exists if you use the userland "automount" daemon instead of
Amd. Hopefully Autofs-v4 or the separate effort of Autofs-NG will
address this serious problem.
Note that Amd itself can restart autofs automounted points just fine on
OSs that support it, for example Solaris.
Q2. When I use Amd, I get this console message frequently: "mount version
older than kernel." Is it a problem?
A2. No, it's a harmless warning message that the Linux kernel prints for NFS
mounts. The intent was to alert administrators that the kernel has
supposedly a different version of the mount(2) code than a userland
program used. This happens if you compile Amd against kernel headers
that are different than the kernel you're running. If the message
really bothers you, then one way to "fix" the problem is to recompile
Amd against the same kernel headers as the running kernel.
Nevertheless, it is a relatively useless message because as far as we
know, the NFS v2 and v3 mount codes have been in perfect sync between
the userland and kernel sides, and were "standardized" for years
already. This warning message caused more unnecessary worry among
administrators than helping alert them to legitimate problems.
</FAQ>
-123
View File
@@ -2,7 +2,6 @@ $FreeBSD$
*LSM.am-utils
*Makefile.*
*README.autofs
*README.osx
*ac*.m4
*.old
*acconfig.h
@@ -16,7 +15,6 @@ $FreeBSD$
*missing
*mkinstalldirs
*stamp-h.in
*amd/test1.sh
*amd/Makefile.*
*amq/Makefile.*
*commit
@@ -40,13 +38,10 @@ $FreeBSD$
*conf/fh_dref/fh_dref_sunos3.h
*conf/fh_dref/fh_dref_sunos4.h
*conf/fh_dref/fh_dref_svr4.h
*conf/hn_dref/hn_dref_default.h,
*conf/hn_dref/hn_dref_isc3.h
*conf/hn_dref/hn_dref_linux.h
*conf/mount/mount_aix.c
*conf/mount/mount_aix3.c
*conf/mount/mount_bsdi3.c
*conf/mount/mount_default.c
*conf/mount/mount_freebsd3.c
*conf/mount/mount_hpux.c
*conf/mount/mount_irix5.c
@@ -59,7 +54,6 @@ $FreeBSD$
*conf/mtab/mtab_aix.c
*conf/mtab/mtab_file.c
*conf/mtab/mtab_isc3.c
*conf/mtab/mtab_linux.c
*conf/mtab/mtab_mach3.c
*conf/mtab/mtab_osf.c
*conf/mtab/mtab_svr4.c
@@ -69,7 +63,6 @@ $FreeBSD$
*conf/nfs_prot/nfs_prot_aix4_2.h
*conf/nfs_prot/nfs_prot_aix4_3.h
*conf/nfs_prot/nfs_prot_aix5_1.h
*conf/nfs_prot/nfs_prot_aix5_2.h
*conf/nfs_prot/nfs_prot_bsdi2.h
*conf/nfs_prot/nfs_prot_bsdi3.h
*conf/nfs_prot/nfs_prot_darwin.h
@@ -99,12 +92,6 @@ $FreeBSD$
*conf/nfs_prot/nfs_prot_sunos5_8.h
*conf/nfs_prot/nfs_prot_svr4.h
*conf/nfs_prot/nfs_prot_ultrix.h
*conf/autofs/autofs_linux.h
*conf/autofs/autofs_linux.c
*conf/autofs/autofs_solaris_v1.h
*conf/autofs/autofs_solaris_v1.c
*conf/autofs/autofs_solaris_v2_v3.h
*conf/autofs/autofs_solaris_v2_v3.c
*conf/sa_dref/sa_dref_386bsd.h
*conf/sa_dref/sa_dref_aix3.h
*conf/sa_dref/sa_dref_aoi.h
@@ -116,7 +103,6 @@ $FreeBSD$
*conf/trap/trap_aix3.h
*conf/trap/trap_aux.h
*conf/trap/trap_dgux.h
*conf/trap/trap_freebsd3.h
*conf/trap/trap_hcx.h
*conf/trap/trap_hpux.h
*conf/trap/trap_hpux11.h
@@ -129,9 +115,7 @@ $FreeBSD$
*conf/trap/trap_stellix.h
*conf/trap/trap_svr4.h
*conf/trap/trap_ultrix.h
*conf/umount/umount_aix.c
*conf/umount/umount_default.c
*conf/umount/umount_linux.c
*conf/umount/umount_osf.c
*doc/Makefile.am
*doc/Makefile.in
@@ -151,118 +135,11 @@ $FreeBSD$
*fsinfo/Makefile.*
*hlfsd/Makefile.*
*libamu/Makefile.*
*libamu/alloca.c
*libamu/clnt_sperrno.c
*libamu/memcmp.c
*libamu/strcasecmp.c
*libamu/strdup.c
*libamu/strstr.c
*libamu/strlcat.c
*libamu/strlcpy.c
*libamu/ualarm.c
*mk-amd-map/Makefile.*
*wire-test/Makefile.*
*m4/GNUmakefile
*m4/amdgrep*
*m4/amindent*
*m4/autopat*
*m4/chop-aclocal.pl*
*m4/copy-if-newbig*
*m4/mk-aclocal*
*m4/mkconf*
*m4/rmtspc*
*m4/update_build_version*
*m4/macros/HEADER
*m4/macros/TRAILER
*m4/macros/c_void_p.m4
*m4/macros/cache_check_dynamic.m4
*m4/macros/check_amu_fs.m4
*m4/macros/check_checkmount_style.m4
*m4/macros/check_extern.m4
*m4/macros/check_fhandle.m4
*m4/macros/check_field.m4
*m4/macros/check_fs_headers.m4
*m4/macros/check_fs_mntent.m4
*m4/macros/check_gnu_getopt.m4
*m4/macros/check_hide_mount_type.m4
*m4/macros/check_lib2.m4
*m4/macros/check_map_funcs.m4
*m4/macros/check_mnt2_cdfs_opt.m4
*m4/macros/check_mnt2_gen_opt.m4
*m4/macros/check_mnt2_nfs_opt.m4
*m4/macros/check_mnttab_file_name.m4
*m4/macros/check_mnttab_location.m4
*m4/macros/check_mnttab_opt.m4
*m4/macros/check_mnttab_style.m4
*m4/macros/check_mnttab_type.m4
*m4/macros/check_mount_style.m4
*m4/macros/check_mount_trap.m4
*m4/macros/check_mount_type.m4
*m4/macros/check_mtype_printf_type.m4
*m4/macros/check_mtype_type.m4
*m4/macros/check_network_transport_type.m4
*m4/macros/check_nfs_fh_dref.m4
*m4/macros/check_nfs_hn_dref.m4
*m4/macros/check_nfs_prot_headers.m4
*m4/macros/check_nfs_sa_dref.m4
*m4/macros/check_nfs_socket_connection.m4
*m4/macros/check_os_libs.m4
*m4/macros/check_restartable_signal_handler.m4
*m4/macros/check_umount_style.m4
*m4/macros/check_unmount_args.m4
*m4/macros/check_unmount_call.m4
*m4/macros/expand_cpp_hex.m4
*m4/macros/expand_cpp_int.m4
*m4/macros/expand_cpp_string.m4
*m4/macros/expand_run_string.m4
*m4/macros/extern_optarg.m4
*m4/macros/extern_sys_errlist.m4
*m4/macros/field_mntent_t_mnt_time_string.m4
*m4/macros/func_bad_memcmp.m4
*m4/macros/func_bad_yp_all.m4
*m4/macros/header_templates.m4
*m4/macros/host_macros.m4
*m4/macros/linux_headers.m4
*m4/macros/localconfig.m4
*m4/macros/mount_headers.m4
*m4/macros/name_package.m4
*m4/macros/name_version.m4
*m4/macros/opt_amu_cflags.m4
*m4/macros/opt_cppflags.m4
*m4/macros/opt_debug.m4
*m4/macros/opt_ldflags.m4
*m4/macros/opt_libs.m4
*m4/macros/os_cflags.m4
*m4/macros/os_cppflags.m4
*m4/macros/os_ldflags.m4
*m4/macros/package_bugreport.m4
*m4/macros/package_name.m4
*m4/macros/package_version.m4
*m4/macros/save_state.m4
*m4/macros/struct_field_nfs_fh.m4
*m4/macros/struct_mntent.m4
*m4/macros/struct_mnttab.m4
*m4/macros/struct_nfs_args.m4
*m4/macros/struct_nfs_fh.m4
*m4/macros/struct_nfs_fh3.m4
*m4/macros/struct_nfs_gfs_mount.m4
*m4/macros/try_compile_anyfs.m4
*m4/macros/try_compile_nfs.m4
*m4/macros/try_compile_rpc.m4
*m4/macros/type_auth_create_gidlist.m4
*m4/macros/type_cachefs_args.m4
*m4/macros/type_cdfs_args.m4
*m4/macros/type_efs_args.m4
*m4/macros/type_lofs_args.m4
*m4/macros/type_mfs_args.m4
*m4/macros/type_pcfs_args.m4
*m4/macros/type_recvfrom_fromlen.m4
*m4/macros/type_rfs_args.m4
*m4/macros/type_svc_in_arg.m4
*m4/macros/type_time_t.m4
*m4/macros/type_tmpfs_args.m4
*m4/macros/type_ufs_args.m4
*m4/macros/type_xdrproc_t.m4
*m4/macros/type_xfs_args.m4
*m4/macros/type_yp_order_outorder.m4
*m4/macros/with_addon.m4
+9 -10
View File
@@ -1,19 +1,21 @@
# ex:ts=8
$FreeBSD$
AMD (am-utils) 6.1.5
originals can be found at: ftp://ftp.am-utils.org/pub/am-utils/
AMD (am-utils) 6.0.9
originals can be found at: ftp://shekel.mcl.cs.columbia.edu/pub/am-utils/
(http://www.cs.columbia.edu/~ezk/am-utils/index.html)
For the import of AMD many files were pruned by:
tar -X FREEBSD-Xlist -xf am-utils-6.1.5.tar.gz
tar -X FREEBSD-Xlist -xzf am-utils-6.0.9.tar.gz
and `find . -name '.cvsignore' -delete`
Then imported by:
cvs import -m 'Virgin import of AMD (am-utils) v6.1.5' \
src/contrib/amd COLUMBIA amd_6_1_5
cvs import -m 'Virgin import of AMD (am-utils) v6.0.9' \
src/contrib/amd COLUMBIA amd_6_0_9
After the import, a separate extraction of am-utils was GNU configured in
the "normal" way. The resulting config.h file should be compared with
@@ -23,11 +25,8 @@ updated as needed.
To make local changes to amd, simply patch and commit to the main
branch (aka HEAD). Never make local changes on the vendor (COLUMBIA) branch.
Note, we don't trim anything in scripts/ as sysadmins may find the bits
as a useful reference.
All local changes should be submitted to "[email protected]" or
https://bugzilla.am-utils.org for inclusion in the next vendor release.
All local changes should be submitted to "[email protected]"
for inclusion in the next vendor release.
Local changes:
+138 -99
View File
@@ -1,91 +1,113 @@
am-utils 6.1 compatibility list
am-utils 6.0 compatibility list
For each system, list if it autoconfigures, compiles, or runs. Fill in
email id of person who confirms the fact. A missing entry means unverified.
A 'no' or 'X' means verified broken or nonexistent (static library).
SYSTEM CONFIG COMPILE RUN SHLIB AUTOFS
========================= ======= ======= ======= ======= ======
alpha-dec-osf4.0f ro ro ro - -
alpha-dec-osf5.1 ro ro ro - -
alpha-unknown-linux-gentoo1.4.16 ezk ezk ezk ezk -
alphaev56-dec-osf4.0f ezk ezk ezk ezk -
i386-apple-darwin6.0 ezk ezk ezk ezk -
i386-pc-bsdi2.1 ion ion ion ion[X] ion[X]
i386-pc-linux-deb3.0 ezk ezk ezk ezk -
i386-pc-linux-deb3.1 ezk ezk ezk ezk -
i386-pc-linux-fc1 ezk ezk ezk ezk -
i386-pc-linux-fc2 ezk ezk ezk ezk -
i386-pc-linux-fc3 ezk ezk ezk ezk -
i386-pc-linux-fc4 ezk ezk ezk ezk -
i386-pc-linux-gentoo1.4.16 ezk ezk ezk ezk -
i386-pc-linux-rh6.2 ion ion ion ion ion
i386-pc-linux-rh7.1 ion ion ion ion ion
i386-pc-linux-rh7.2 ion ion ion ion ion
i386-pc-linux-rh7.3 ion ion ion ion ion
i386-pc-linux-rh8.0 ezk ezk ezk ezk -
i386-pc-linux-rh9 ion ion ion ion ion
i386-pc-linux-rhel3 ezk ezk ezk ezk -
i386-pc-linux-rhel4 ezk ezk ezk ezk -
i386-pc-linux-suse8.2 ezk ezk ezk ezk -
i386-pc-linux-suse9.1 ezk ezk ezk ezk -
i386-pc-linux-suse9.2 ezk ezk ezk ezk -
i386-pc-linux-suse9.3 ezk ezk ezk ezk -
i386-pc-solaris2.10 ro ro ro - -
i386-pc-solaris2.9 ro ro ro - -
i386-unknown-freebsd4.10 ezk ezk ezk ezk -
i386-unknown-freebsd4.11 ezk ezk ezk ezk -
i386-unknown-freebsd4.8 ezk ezk ezk ezk -
i386-unknown-freebsd4.9 ezk ezk ezk ezk -
i386-unknown-freebsd5.0 ezk ezk - ezk -
i386-unknown-freebsd5.1 ezk ezk ezk ezk -
i386-unknown-freebsd5.2 ezk ezk ezk ezk -
i386-unknown-freebsd5.2.1 ezk ezk ezk ezk -
i386-unknown-freebsd5.3 ezk ezk ezk ezk -
i386-unknown-freebsd5.4 ezk ezk ezk ezk -
i386-unknown-freebsd6 (BETA5) ezk ezk ezk ezk -
i386-unknown-netbsd1.6A ezk ezk ezk ezk -
i386-unknown-netbsdelf1.6.1 ezk ezk ezk ezk -
i386-unknown-netbsdelf1.6.2 ezk ezk ezk ezk -
i386-unknown-netbsdelf2.0 ezk ezk ezk ezk -
i386-unknown-netbsdelf2.0.2 ezk ezk ezk ezk -
i386-unknown-netbsdelf3.0 ezk ezk ezk ezk -
i386-unknown-openbsd3.3 ezk ezk ezk ezk -
i386-unknown-openbsd3.6 ezk ezk ezk ezk -
i386-unknown-openbsd3.7 ezk ezk ezk ezk -
i686-apple-darwin6.6 ezk ezk ezk ezk -
ia64-hp-hpux11.20 ezk ezk ezk ezk -
ia64-unknown-linux-rh2.1AS ezk ezk - ezk -
ia64-unknown-linux-rh2.1AW ezk ezk ezk ezk -
ia64-unknown-linux-rhel4 ezk ezk ezk ezk -
mips-sgi-irix6.2 ro ro ro - -[3]
mips-sgi-irix6.5 ro ro ro - -[3]
mips-unknown-linux-gentoo1.4.16 ezk ezk ezk ezk -
mipsel-unknown-linux-rhPS2 ezk ezk ezk ezk -
powerpc-apple-darwin7.6.0 ezk ezk ezk ezk -
powerpc-apple-darwin7.7.0 ezk ezk ezk ezk -
powerpc-apple-darwin7.8.0 ezk ezk ezk ezk -
powerpc-apple-darwin7.9.0 ezk ezk ezk ezk -
powerpc-apple-darwin8.2.0 ezk ezk ezk ezk -
powerpc-ibm-aix5.1.0.0 ion ion ion ion[X] ion[1,2]
powerpc-ibm-aix5.2.0.0 ezk ezk ezk ezk -
powerpc-ibm-aix5.3.0.0 ezk ezk ezk ezk -
powerpc-unknown-linux-yellowdog2.3 ezk ezk ezk ezk -
sparc-sun-solaris2.10 ro ro ro - -
sparc-sun-solaris2.5.1 ion ion ion ion ion[1]
sparc-sun-solaris2.6 ion ion ion ion ion
sparc-sun-solaris2.7 ion ion ion ion ion
sparc-sun-solaris2.8 ion ion ion ion ion
sparc-sun-solaris2.9 ro ro ro - -
sparc-unknown-linux-rh62 ion ion ion ion ion
sparc64-unknown-linux-aurora10 ion ion ion ion ion
sparc64-unknown-linux-deb3.0 ezk ezk ezk ezk -
sparc64-unknown-linux-gentoo1.4.16 ezk ezk ezk ezk -
sparc64-unknown-linux-rh62 ion ion ion ion ion
sparc64-unknown-linux-suse7.3 ezk ezk - ezk -
x86_64-unknown-linux-rh2.9.5AS ezk ezk ezk ezk -
x86_64-unknown-linux-rh3.0.0AS ion ion ion ion ion
SYSTEM CONFIG COMPILE RUN SHLIB
========================= ====== ======= ===== =====
alpha-dec-osf2.1 ezk[0] ezk ezk ezk[X]
alpha-dec-osf4.0 ezk[0] ezk dsr[3] ezk
alpha-dec-osf4.0f ezk[0] ezk dsr[3] ezk
alpha-dec-osf5.1 ro[0] ro ro ro
alphaev5-unknown-linux ezk[0] ezk finkel ezk
alphaev5-unknown-linux-rh5.2 ezk[0] ezk ezk ezk
alphaev6-dec-osf5.0 ezk[0] ezk dsr[3] ezk
hppa1.0-hp-hpux11.00 ezk[0] ezk ezk ezk
hppa1.1-hp-hpux10.10 ezk[0] ezk ezk ezk
hppa1.1-hp-hpux10.20 ezk[0] ezk ezk ezk
hppa1.1-hp-hpux11.00 ezk[0] ezk ezk ezk
hppa1.1-hp-hpux9.01 ezk[0,4]ezk[4] nrh/ezk ezk
hppa1.1-hp-hpux9.05 ezk[0,4]ezk[4] nrh/ezk ezk
hppa1.1-hp-hpux9.07 ezk[0,4]ezk[4] nrh/ezk ezk
hppa2.0w-hp-hpux11.00 ezk[0] ezk ezk ezk
i386-pc-bsdi2.1 ion ion ion ion[X]
i386-pc-bsdi3.0 ezk[0] ezk ezk ezk[X]
i386-pc-bsdi3.1 ezk[0] ezk ezk ezk[X]
i386-pc-bsdi4.0 ezk[0] ezk ezk ezk
i386-pc-bsdi4.0.1 ezk[0] ezk ezk ezk
i386-pc-bsdi4.1 ezk[0] ezk ezk ezk
i386-pc-linux ezk[0] ezk ezk ezk
i386-pc-linux-libc1 ezk[0] ezk ezk ezk
i386-pc-linux-libc1-rh4.2 ezk[0] ezk ezk ezk
i386-pc-linux-rh5.2 ezk[0] ezk ezk ezk
i386-pc-linux-rh6.0 ezk[0] ezk ezk ezk
i386-pc-linux-rh6.1 ezk[0] ezk ezk ezk
i386-pc-linux-rh6.2 ion ion ion ion
i386-pc-linux-rh7.1 ion ion ion ion
i386-pc-linux-rh7.2 ion ion ion ion
i386-pc-linux-rh7.3 ion ion ion ion
i386-pc-solaris2.5.1 ezk[0] ezk ezk ezk
i386-pc-solaris2.6 ezk[0] ezk ezk ezk
i386-pc-solaris2.7 ezk[0] ezk ezk ezk
i386-unknown-freebsd2.1.0 ezk[0] ezk ezk
i386-unknown-freebsd2.2.1 ezk[0] ezk ezk ezk
i386-unknown-freebsd2.2.6 ezk[0] ezk ezk ezk
i386-unknown-freebsd2.2.7 ezk[0] ezk ezk ezk
i386-unknown-freebsd2.2.8 ezk[0] ezk ezk ezk
i386-unknown-freebsd3.0 ezk[0] ezk ezk ezk
i386-unknown-freebsd4.2 ezk[0] ezk ezk ezk
i386-unknown-freebsd4.4 ezk[0] ezk ezk ezk
i386-unknown-freebsd5.0 ezk[0] ezk ezk ezk
i386-unknown-freebsdelf3.0 ezk[0] ezk ezk ezk
i386-unknown-freebsdelf3.1 ezk[0] ezk ezk ezk
i386-unknown-freebsdelf3.2 ezk[0] ezk ezk ezk
i386-unknown-freebsdelf3.3 ezk[0] ezk ezk ezk
i386-unknown-freebsdelf3.4 ezk[0] ezk ezk ezk
i386-unknown-freebsdelf4.0 ezk[0] ezk ezk ezk
i386-unknown-netbsd1.2.1 ezk[0] ezk ezk ezk
i386-unknown-netbsd1.3 ezk[0] ezk ezk ezk
i386-unknown-netbsd1.3.1 ezk[0] ezk ezk ezk
i386-unknown-netbsd1.3.2 ezk[0] ezk ezk ezk
i386-unknown-netbsd1.3.3 ezk[0] ezk ezk ezk
i386-unknown-netbsd1.4 ezk[0] ezk ezk ezk
i386-unknown-netbsd1.4.1 ezk[0] ezk ezk ezk
i386-unknown-openbsd2.1 ezk[0] ezk ezk ezk
i386-unknown-openbsd2.2 ezk[0] ezk ezk ezk
i386-unknown-openbsd2.3 ezk[0] ezk ezk ezk
i386-unknown-openbsd2.4 ezk[0] ezk ezk ezk
i386-unknown-openbsd2.5 ezk[0] ezk ezk ezk
i486-ncr-sysv4.3.03 ezk[0] ezk ezk
ia64-hp-hpux11.20 ezk[0] ezk ezk ezk
ia64-unknown-linux-rh7.1 ezk[0] ezk ezk ezk
ia64-unknown-linux-rh7.2 ezk[0] ezk ezk ezk
ia64-unknown-linux-rh2.1AS ezk[0] ezk ezk ezk
ia64-unknown-linux-rh2.1AW ezk[0] ezk ezk ezk
m68k-hp-hpux9.00 ezk[0,4]ezk[4] nrh/ezk
m68k-next-nextstep3 ezk[0] ezk ezk ezk[X]
m68k-sun-sunos4.1.1 ezk[0] ezk ezk[X]
mips-dec-ultrix4.3 ro[0] ro ro
mips-sgi-irix5.3 ezk[0] ezk ezk ezk
mips-sgi-irix6.2 ezk[0,1]ezk[1] ezk[1] ezk
mips-sgi-irix6.4 ezk[0] ezk ezk ezk
mips-sgi-irix6.5 ezk[0] ezk ezk
powerpc-ibm-aix4.1.5.0 ezk[0] ezk wpaul ezk[X]
powerpc-ibm-aix4.2.1.0 ezk[0] ezk ezk ezk[X]
powerpc-ibm-aix4.3.1.0 ezk[0] ezk ezk[X]
powerpc-ibm-aix5.1.0.0 ion ion ion ion[X]
powerpc-unknown-linux jose[0] jose jose
rs6000-ibm-aix3.2 ezk[0] ezk ezk
rs6000-ibm-aix3.2.5 ezk[0] ezk ezk
rs6000-ibm-aix4.1.4.0 ezk[0] ezk ezk[X]
rs6000-ibm-aix4.1.5.0 ezk[0] ezk ezk[X]
sparc-sun-solaris2.3 ezk[0] ezk ezk ezk
sparc-sun-solaris2.4 ezk[0] ezk ezk ezk
sparc-sun-solaris2.5 ezk[0] ezk ezk ezk
sparc-sun-solaris2.5.1 ion ion ion ion
sparc-sun-solaris2.6 ion ion ion ion
sparc-sun-solaris2.7 ion ion ion ion
sparc-sun-solaris2.8 ion ion ion ion
sparc-sun-sunos4.1.1 ezk[0] ezk ezk ezk
sparc-sun-sunos4.1.3 ezk[0] ezk ezk ezk
sparc-sun-sunos4.1.3C ezk[0] ezk ezk ezk
sparc-sun-sunos4.1.3_U1 ezk[0] ezk ezk ezk
sparc-sun-sunos4.1.4 ezk[0] ezk ezk ezk
sparc-unknown-linux-libc1 ezk[0] ezk ezk ezk
sparc-unknown-linux-rh6.2 ion ion ion ion
sparc-unknown-netbsd1.2E ezk[0] ezk ezk
sparc-unknown-netbsd1.2G ezk[0] ezk ezk
sparc64-unknown-linux-rh6.2 ion ion ion ion
sparc64-unknown-linux-suse7.3 ezk[0] ezk ezk ezk
EMAIL ID LEGEND:
@@ -103,22 +125,39 @@ wpaul: Bill Paul <[email protected]>
FOOTNOTES:
[1] Due to limitations in the Sun autofs v1 implementation, some amd features
cannot be properly supported. More precisely, trying to access a link mount
pointing to another amd entry will result in failure and/or deadlock.
Ordinary nfs and link mounts work well, however.
[0] These entries were tested with older 6.0 releases, but not with the
latest version. They probably still work, however.
[2] AIX autofs appears to be a variant of the Sun autofs v1 protocol, but
IBM don't provide any sort of documentation or even header files from it.
It is currently unsupported; we may add some experimental support for it at
some point, though it won't be pretty. Assistance from IBM-ers would be
highly appreciated, hint hint.
[1] If compiling with cc on Irix 6, then use
[3] IRIX 6 autofs uses the Sun autofs v1 protocol, too. The header files
are part of the onc3_eoe.sw.autofs (IRIX 6.2) or nfs.sw.autofs (IRIX 6.5)
package, which may not be installed. The autofs code is known to compile,
but hasn't been run yet. SGI's autofsd uses a barely documented system
call, syssgi(SGI_AUTOFS_SYS, ...), which may be required to get working
autofs support. Additional help from SGI would be highly appreciated.
CC="cc -32 -Wl,-woff,84" ./buildall
Erez & Ion
to build (good) "old style" 32 bit code and suppress stupid linker warnings
about unused libraries.
Also, to get NFS V3 working, you need these two patches from SGI:
patch 1615: NFS over TCP
patch 2041: NFS roll-up patch
and then add "-p tcp" to /etc/config/nfsd.options.
[2] ... has gone missing ...
[3] DU-4.0 may not use NFS (server-side) V3 by default. You may need to
adjust /etc/init.d/nfs, and change the nfsd startup line from to
if /usr/sbin/nfsd $NUM_NFSD; then
to
if /usr/sbin/nfsd -t 8 -u 8 ; then
[4] HPUX 9.X has a bad /bin/sh that runs out of fixed memory allocations.
If you use the configure script, you must run it as
/bin/ksh ./configure
Also, this system has a bad /bin/make that cannot handle VPATH well. You
cannot use --srcdir or the buildall script with it. I suggest you install
GNU make or configure locally with "/bin/ksh ./configure".
Erez.
+93 -609
View File
@@ -1,663 +1,147 @@
*** Notes specific to am-utils version 6.1.5
New amd.conf global parameter: nfs_allow_any_interface. By default it is
set to 'no' which means that Amd accepts local NFS packets only from
127.0.0.1. If set to 'yes' then Amd will accept local NFS packets from any
local interface; this is useful on hosts that may have multiple interfaces
where the system is forced to send all outgoing packets (even those bound to
the same host) via an address other than 127.0.0.1.
Add support for specifying the host to match in the mount selectors netgrp
and netgrpd. Now one can use either netgrp(<group-name>) or
netgrp(<group-name>,<host-name>).
- Bugs fixed:
* handle old-style filehandles correctly (for mount points longer
than 28 chars)
* don't turn off attribute cache for regular NFS mounts (improves
performance)
* detect G/DBM support via gdbm_compat library (Debian)
* detect NDBM support in libc (FreeBSD 6)
*** Notes specific to am-utils version 6.0.10-pre:
- minor new ports:
i386-unknown-freebsd6.1 (RELEASE)
i386-unknown-openbsd3.9
powerpc-apple-darwin8.6.0
*** Notes specific to am-utils version 6.1.4
Support new mount options for type:=pcfs mounts: longname, nowin95,
shortname, user=N, group=N, mask=N, and dirmask=N.
Two new amd.conf [global] parameters: nfs_retry_interval_toplvl and
nfs_retransmit_counter_toplvl. They are similar to nfs_retry_interval and
nfs_retransmit_counter, and allow you to set the "timeo" and "retrans" NFS
mount parameters, respectively, but ONLY for Amd's top-level mounts (which
are NFSv2/UDP currently). This is useful because on some systems you may
wish to set these parameters differently than the OS default, so as to
better tune Amd's responsiveness under heavy scheduler loads.
- minor new ports:
i386-pc-linux-fc5 (Fedora Core 5)
i386-pc-linux-suse10.1 (beta 8)
i386-unknown-freebsd6.0 (RELEASE)
i386-unknown-netbsdelf2.1
i386-unknown-netbsdelf3.0 (RELEASE)
i386-unknown-openbsd3.8
powerpc-apple-darwin8.5.0
- Bugs fixed:
* one serious memory leak in amfs_generic (caught by Coverity)
* assorted potential (but rare) NULL pointer dereferences (Coverity)
* correctly print nfs_args->addr info (sin_family/port/addr)
* pawd should resolve path repeatedly until no more to do
* use-after-free bug in amfs_lookup_mntfs (Coverity)
*** Notes specific to am-utils version 6.1.3
- Bugs fixed:
* amq should de-register properly on exit
* convert all sprintf to safer xsnprintf
* convert all strcat to safer xstrlcat
* convert all strcpy to safer xstrlcpy
* fix three buffer overruns in expand_op (amd/opts.c)
* pawd was trying UDP only, now try TCP if UDP failed
Moved pawd's path-matching functionality into Amd, where it can be done a
lot more efficiently (we no longer need to construct and send the whole
mounted tree, only to match small parts of it). This will lessen the CPU
and network load on systems that use pawd heavily, and also minimize the
chance that we exceed default or hard-coded UDP/TCP RPC packet sizes.
*** Notes specific to am-utils version 6.1.2.1
- Bugs fixed:
* properly turn off the attrcache in freebsd and openbsd
* can turn off attrcache on netbsd, but need kernel patch, see
README.attrcache
* pawd goes into an infinite loop on type:=auto
* consistent search for file system mnttab/mount names
*** Notes specific to am-utils version 6.1.2
MAJOR BUG FIXES: Synchronize Amd's view of its file systems with the
kernel's NFS client-side DNLC/dcache. Amd changes its view when it reloads
maps (automatically or via "amq -f") because new map entries could be added,
old one removed, or existing ones changed. Amd also changes its view when a
simple entry has expired and was flushed, or was forced out via "amq -u".
Amd was not updating the mtime of its parent directory (often the amd
automount point): this resulted in the kernel re-using cached entries, which
are now possibly stale. Many users had seen this problem in the form of
occasional ESTALE errors, or dangling/broken automounted symlinks,
especially on systems under heavy use. To tell the kernel to ignore (flush)
its old entries for an directory, the mtime of the directory must be updated
(monotonically incremented). Amd was indeed doing so in several places, but
unfortunately it was using time(2) which only provides a one-second
resolution clock: this was fine a decade ago, but not good enough on today's
fast systems; using only a one-second resolution clock meant that on busy
systems that invoke Amd many times a second, some rapidly changing entries
do not get flushed from the kernel, and the kernel thus uses stale entries.
The solution to all of these was to rework the whole clock timer updates to
use gettimeofday(), using a micro-second resolution timer, and to use that
time whenever Amd needs to update an mtime/atime/ctime of any node.
Finally, we now update the mtime in places that were never updated before
(when a whole map is flushed or a single entry times out).
Warning: some OSs, we discovered, are incapable of turning off their
NFS attribute cache entirely. This means that Amd cannot work fully
reliability on these systems, not under heavy load. This is documented in
detail in the README.attrcache file included with this distribution.
Include test-attrcache script to test the NFS attribute cache behavior using
Amd.
Tell syslog not to log automatically to /dev/console; it's unfriendly. If
user really wants to, they can set it in /etc/syslog.conf.
- minor new ports:
i386-pc-linux-deb3.1
i386-unknown-netbsdelf3.0
powerpc-apple-darwin8.2.0
- bugs fixed:
* minor documentation corrections
*** Notes specific to am-utils version 6.1.1
New amd.conf global parameter: forced_unmounts (default to "no"). If set to
"yes," and the client OS supports forced or lazy unmounts, then Amd will
attempt to use them if it gets any of three serious error conditions when
trying to unmount an existing mount point or mount on top of one: EIO,
ESTALE, or EBUSY. This could be useful to recover from serious conditions
such as hardware failure of mounted disks, or NFS servers which are down
permanently, were migrated, or changed their IP address. Only
"type:=toplvl" mounts hung with EBUSY are forcibly unmounted using this
option: this is useful to ensure that a new Amd can mount itself even if a
previous Amd died and left its mount points hung, or to force Amd to
shutdown cleanly, even if some processes (i.e., user shells) have their CWD
on Amd's own mount point. This functionality is available for Linux, BSD44
systems, Solaris, OSF/1, and partially for AIX.
New amd.conf global parameter: truncate_log (default to "no"). If set to
"yes", then Amd will truncate the log file (if it's a regular file) on
startup. This could be useful when conducting extensive testing on Amd maps
(or Amd itself) and you don't want to see log data from a previous run in
the same file.
- minor new ports:
i386-pc-linux-fc4
i386-pc-linux-suse9.3
i386-pc-linuxoldld-deb3.1
- bugs fixed:
* safer mtab handling for Linux (locks + handles /proc/mounts)
* small compile problems on Solaris 6 (rpcvers_t)
* small compile problems on HPUX 10 (h_errno)
* possibly missing definition of INADDR_NONE in wire.c
* extern for sleep(3) may be missing on older gcc systems
* updated nfs_args structure on aix4.
* possible running off end of exported_ap[] array.
* buffer overflow in pawd.
* aix4 clean build.
* use strlcat/snprintf in a few places for safety.
* recover from IP address change of a down NFS server
* don't discard restarted mntfs that was used.
*** Notes specific to am-utils version 6.1
- bugs fixed:
* set timeo/retrans for type:=nfs only if user asked
Also, if you want to know what's new in 6.1 compared to 6.0.x, it's
EVERYTHING below this line, up to "6.0.4." Yes, that's a lot of stuff.
*** Notes specific to am-utils version 6.1-rc7
Remove alloca from am-utils, and rewrite code that used it.
Assorted minor code cleanups.
- minor new ports:
alpha-unknown-linux-gentoo1.4.16
alphaev56-dec-osf4.0f (using both cc and gcc)
mips-sgi-irix6.5 (using both cc and gcc)
mips-unknown-linux-gentoo1.4.16
sparc64-unknown-linux-gentoo1.4.16
- bugs fixed:
* getwire() detects networks correctly on OSF/1
*** Notes specific to am-utils version 6.1-rc6
- minor new ports:
i386-pc-linux-deb3.0
i386-pc-linux-gentoo1.4.16
i386-pc-linux-suse9.2
i386-unknown-freebsd5.4
i386-unknown-netbsdelf2.0.2
i386-unknown-openbsd3.7
powerpc-unknown-linux-yellowdog2.3
- bugs fixed:
* minor compile error of nfs_subr.c on some systems.
* AIX 5.2/5.3 PPC compile fixes.
*** Notes specific to am-utils version 6.1-rc5
For NetBSD systems, $os used to say "netbsdelf1" or "netbsdelf2." Now it
just says "netbsd."
- minor new ports:
powerpc-apple-darwin7.9.0
- bugs fixed:
* silly (but nasty) null pointer dereferencing
* improved fix for '-opts' syntax for resetting map options
*** Notes specific to am-utils version 6.1-rc4
- bugs fixed:
* check for "macosx" in M4 macros properly
* minor memory leaks (thanks to Valgrind)
*** Notes specific to am-utils version 6.1-rc3
Minor fix to configure.in. Reran bootstrap to get a working configure
script that indeed checks for certain Linux nfs/autofs headers.
*** Notes specific to am-utils version 6.1-rc2
New amd.conf global parameter: normalize_slashes (default to "yes"). If set
to "no," then Amd will not condense repeated slashes or remove trailing ones
from strings representing pathnames. This is sometimes useful with SMB
mounts, which often require multiple slash characters in pathnames.
Using a custom version of strlcpy instead of strncpy (but only where it
makes sense), to minimize string overflow changes. Audited all use of
strncpy/strlcpy to ensure safety.
On Apple machines, use "powerpc" for $arch, instead of "Power Macintosh".
Also, use sw_vers to find out more appropriate OS name (macosx) and OS
version (10.3.x) than uname(3) reports.
- minor new ports:
powerpc64-unknown-linux-rhel4
powerpc64-unknown-linux-sles9
- bugs fixed:
* pawd handles all file systems
* fix double-free in type:=nfsx
* timeo and retrans shouldn't be set for type:=toplvl
* fix inconsistency in handling filehandle generation number
* document proper use of hosts.allow (don't spawn)
* single dash '-' map entry now resets the defaults
*** Notes specific to am-utils version 6.1-rc1
- minor new ports:
i386-pc-linux-fc2 (Fedora Core 2).
i386-pc-linux-fc3 (Fedora Core 3).
i386-pc-linux-rhel3
i386-pc-linux-rhel4
i386-pc-linux-suse8.2
i386-pc-linux-suse9.1
i386-pc-solaris2.10
i386-unknown-freebsd4.8
i386-unknown-freebsd4.9
i386-unknown-freebsd4.10
i386-unknown-freebsd4.11
i386-unknown-freebsd5.1 (5.1-RELEASE)
i386-unknown-freebsd5.2 (5.2-RELEASE)
i386-unknown-freebsd5.2.1 (5.2.1-RELEASE)
i386-unknown-freebsd5.3 (5.3-RELEASE)
i386-unknown-freebsd6.0 (6.0-CURRENT-SNAP001)
i386-unknown-netbsdelf1.6.1
i386-unknown-netbsdelf2.0
i386-unknown-openbsd3.6
ia64-hp-hpux11.20
ia64-unknown-linux-rhel4
mipsel-unknown-linux-rhPS2 (Linux on Sony PlayStation 2)
powerpc-apple-darwin7.6.0
powerpc-apple-darwin7.7.0
powerpc-apple-darwin7.8.0
powerpc-ibm-aix5.2.0.0
powerpc-ibm-aix5.3.0.0
sparc-sun-solaris2.10
sparc64-unknown-linux-deb3.0
x86_64-unknown-linux-rh2.9.5AS
- support for executable maps ala Sun automounter. Set map_type=exec in
amd.conf, and map_name to a program/script that takes a key as argv[1],
and returns key-value pair on stdout. See also exec_map_timeout [global]
parameter which defines how many seconds (default 10 sec) Amd will wait
for an executable map program to return output before timing out. See
am-utils manual for full details.
- new amd.conf parameter "nfs_allow_insecure_port". Used to work around
bugs in certain kernels, which cause them to try and talk to amd from
unprivileged ports.
- new amd.conf parameter: localhost_address. Used to override the localhost
(often 127.0.0.1) address Amd uses to connect to for the local NFS server
and RPC server.
- new amd.conf [global] parameter: domain_strip (default "yes"). If set to
"no," Amd won't strip domain names from host names, which is useful if
your Amd maps are served by multiple domains and you want to tell from the
logs which exact host did what.
- new amd.conf [global] parameter: auto_attrcache (default to 0). Sets
Amd's own NFS attribute-cache timeout in seconds. A value of 0 turns off
attribute caching, meaning that Amd will be consulted via a kernel-RPC
each time someone stat's the mount point (which could be abused as a
denial-of-service attack). If you're concerned, set this to something
greater than zero (a value of 1 second is currently recommended).
Warning: if you set this option to any non-zero value, especially a large
value, and you get ESTALE errors on your particular OS, then set this
value back to 0 seconds.
- four new amd.conf [global] parameters, similar to nfs_retry_interval and
nfs_retransmit_counter, which allow you to set the "timeo" and "retrans"
NFS mount parameters, respectively. Now you can set those parameters
globally and separately for UDP vs. TCP, using any of these:
nfs_retry_interval_udp, nfs_retransmit_counter_udp nfs_retry_interval_tcp,
and nfs_retransmit_counter_tcp.
- new amd.conf [global] parameter: preferred_amq_port. Allows you to select
the UDP+TCP port that Amd's amq service will use with the RPC portmapper.
Useful with firewalls and NAT'ed environments.
- new amd.conf option "debug_mtab_file". Allows user to define the mtab
file during debug-mtab mode. The default path is "/tmp/mnttab".
- new function selector xhost(ARG) which will match ARG against the current
host name. This works even if ARG is a CNAME (unlike the host==ARG
selector).
- support restarting the automounter's own mount points (only over NFS,
for now).
- fully support WebNFS as per RFC 2054. It now tries v3/TCP first, falling
back to v2/UDP if this doesn't work. The "webnfs" pseudo-mount options
has been renamed (again) to "public" to match Solaris 2.
- restructured the restarting of already-mounted filesystems, in the process
also fixing a problem with restarting nfsx components.
- support escaped slashes, needed for SMB mounts. Use '\\\/\\\/' in a
string to get a double slash.
- amd -v now prints domain, host, and hostd values: foo, example.com, and
foo.example.com, respectively.
- On Linux, if umount(2) failed with EIO or ESTALE, try the new umount2(2)
system call with MNT_FORCE+MNT_DETACH. This could be quite helpful to
unmounting hung mount points that otherwise cannot be fixed without a
reboot.
- The ping=N mount option now works. N defaults to 30 seconds for all NFS
servers. It can now be set to any value for each server separately.
Setting it to a large value can reduce the amount of NFS_NULL chatter on
your network considerably, especially in large sites. Setting this to -1
will turn off pings for that server (useful in NFS-HA setups). Setting N
to 0 will pick the default ping value in Amd (currently 30 seconds). Note
that if you have multiple Amd entries using the same file server, and each
entry sets a different value of N, then each time Amd mounts a new entry,
the ping value will be re-evaluated (and updated, turned off, or turned
back on as needed). Note that NFS_NULL pings are sent for both UDP and
TCP mounts, because even a hung TCP mount can cause user processes to
hang.
- file system inheritance code restructured, so it's no longer a pseudo file
system, but actually integrated into Amd (as it should have been).
- for type:=program, the "umount" program doesn't have to be defined; it'll
default to "unmount ${fs}".
- "amd -v" now prints the distribution name if it's known (e.g., rh9, fc3,
suse8, etc.).
- bugs fixed:
* various memory management problems (leaks, etc)
* fixed nfsx support
* fixed a race involving late replies to network queries which
arrive after the file system has already been mounted
* recognize pcfs_args_t fields in FreeBSD 5
* recognize other mount types in pawd: host, linkx, and nfsx
* allow exactly one of umount and unmount in type:=program
* race condition between calls to mntctl() on AIX
* plock/mlockall wasn't inherited by fork(); moved after
daemonizing.
* fix inconsistency between Socket and TLI RPC timeouts.
* don't warn when couldn't rmdir a dir with a readonly ancestor.
* avoid hangs of amd in ctl-amd (must chdir to /)
* workaround occasional daemonizing problems (parent won't die)
* don't hang on exit if debug_options=mtab was used
* utimeout=N mount option works with non-nfs types (ufs, pcfs, etc.)
* SEGV (null pointer deref) in type:=program and type:=cachefs
* unmount_on_exit of type:=program caused amd to hang
* match amd2ldif output with ldap.schema
*** Notes specific to am-utils version 6.1b4
- minor new ports:
i686-apple-darwin6.6
- speed up the recovery of inherited (restarted) filesystems by using the
proper waiting channels
- added support for mounting webnfs filesystems, see entry below. It doesn't
do any probing currently, so it will default to v2/UDP unless another
version and/or protocol are explicitly specified.
- pseudo-mount option "ignore_portmapper" renamed to "webnfs"
- bugs fixed:
* properly time out autofs filesystems on Linux
* link mounts with relative targets weren't working on autofs
* the link side of the nfsl file system wasn't working on autofs
* umount code was accidentally turning all symlinks into directories
during attempted umounts, causing stale filehandles
* various minor build fixes for "impossible" configurations
* prevent ldap code from dereferencing a null pointer
*** Notes specific to am-utils version 6.1b3
- new amd.conf option autofs_use_lofs, set by default to "yes". "yes" means
using in-place mounts (lofs, bind mounts, etc.), thus utilizing one of
Autofs's main advantages. "no" means using symlinks instead, which has
the "/bin/pwd" problem and certain efficiency issues on Solaris 2.6+ and
is also not supported on Solaris Autofs v1 and derivatives; however, the
autofs code that uses symlinks is simpler and more thoroughly tested.
- new amd.conf option map_default (can be used in [global] and overwritten
in the per-map section). This will overwrite the /defaults entry of the
map itself, to allow people to set defaults in amd.conf (useful when you
cannot control your amd maps, or you'd rather not modify them globally).
- for type:=program, you can use either unmount:=XXX or umount:=XXX (but not
both). This new 'unmount' name is an alias for convenience.
- fixed the "multiple matching sub-entries in a map entry" semantics to try
mounting those sub-entries one by one, until either one succeeds or all
fail. The old semantics of trying to mount everything in parallel and use
the one that mounted fastest hasn't worked in a long time; in fact, 6.0
currently simply ignores all but the first matching sub-entry.
- made amd fail much faster (instantly, in fact) if the remote server
doesn't have a functional portmapper or NFS service. Also reduced the
total timeout to 3 seconds for a completely downed server.
- new pseudo-mount option "ignore_portmapper"; not very useful currently,
will make more sense when we also accept hard-coded ports for mountd and
nfsd.
- amd will no longer query the portmapper for all possible NFS versions and
protocols if the user requested to use specific ones.
- increased the major number for the library, so that 6.0 and 6.1 can't
share libraries anymore.
- support tcpd/libwrap tcpwrappers. If your system supports libwrap, then
you can use /etc/hosts.allow and /etc/hosts.deny to control remote Amq
access to Amd. The new amd.conf parameter use_tcpwrappers is set to "yes"
by default.
- support NULL entries in Hesiod maps, if they start with a ".".
- code reorganization
- documentation cleanup, corrections, and general updates. Better
references to all man pages. Support newer texi2html. Proper building of
DVI and PSI files. Allow building of am-utils manual in one long Web
page.
- minor new ports:
ia64-unknown-linux-rh2.1AS (Red Hat Itanium Advanced Server)
i386-unknown-freebsd5.0 (5.0-RELEASE)
sparc64-unknown-linux-suse7.3
i386-unknown-netbsdelf1.6.1
i386-unknown-openbsd3.3
i386-pc-solaris2.9
i386-unknown-freebsd4.9
i386-unknown-freebsd5.2 (5.2-RELEASE)
- bugs fixed:
- new amd.conf directive "nfs_allow_insecure_port". Used to work around
bugs in certain kernels, which cause them to try and talk to amd from
unprivileged ports.
* autofs mode on Linux was segfaulting on a silly error (and noone
complained, which proves that I'm probably the only one testing
these beta releases, tsk tsk).
* fixed handling of host entries over autofs.
* fixed handling of nfsl entries over autofs.
* the matching in find_mntfs() was causing problems for inherited
filesystems, so make an exception for them. Tighten the
matching even more, to take into account the f/s type as well.
* recognize xlatecookie mnttab option on netbsd
* document Solaris lex bug (use flex)
* document AIX 5.x NFS bug (need patch)
* document Solaris 8 autofs version change (need to fix system
header file)
* ensure lex doesn't run out of output slots
* support GNU flex-2.5.31+
* force version.texi to be rebuilt unconditionally
* mk-amd-map open db file exclusively (security)
* turn off maintainer-only rules in distros
* don't core dump if log_file is NULL (Solaris)
* don't include malloc.h if stdlib.h exists
* recognize file system failures (EIO) upon reading file maps
- bug fixes:
rename log() in fsinfo to avoid glibc/gcc-3.3 conflict
am_pref free NULL pointer
compiles with modern bison/flex versions
handles sites with various combos of db, n/dbm, and gdbm
*** Notes specific to am-utils version 6.1b2
- new mount flag "softlookup", which determines how amd will respond to
lookups of NFS shares already mounted (return a valid symlink or return
EIO). The default, if "softlookup" is not specified, depends on whether the
mount is "soft" or "hard".
- return EIO instead of ENOENT if amd thinks the server is down; this allows
well-written applications to sleep and retry the operation.
- minor new ports:
*** Notes specific to am-utils version 6.0.9:
- Minor new ports:
i386-apple-darwin6.0
i386-pc-linux-rh8.0
ia64-unknown-linux-rh2.1AW
sparc-sun-solaris2.9
- automatic support for loop mounts on Linux (deprecates the "loop" mount
option)
- new amd.conf parameter ldap_proto_version (default 2) for setting the LDAP
protocol version to use.
- bugs fixed:
* redundancy mode (multiple servers for the same share) wasn't working
* non-autofs mode had some rather nasty hangs on downed file servers
* double-free'ing problem in assign_error_mntfs and free_continuation
* free'ing non-malloc'ed memory in amfs_auto_mount
* late server ping replies were not ignored
* amfs_auto_lookup_mntfs wasn't propagating errors up to callers
* autofs-v4 on Solaris 9 works
* handle std{in,out,err} correctly when releasing controlling tty
(for real this time)
* don't cast pointers between enum_t and u_long, it doesn't work on
64-bit big-endian platforms
* fix compile problem with mlockall() on Darwin
*** Notes specific to am-utils version 6.1b1
- Major Autofs work
Partial support for Sun Autofs v1
Documented known problems with Sun Autofs v1 (possible deadlocks)
Fixes for Sun Autofs v2/v3
Preliminary support for Sun Autofs v4 (Solaris 9)
Kernel-based expirations for Linux Autofs
*** Notes specific to am-utils version 6.0.8:
- Minor new ports:
i386-pc-linux-rh7.2
i386-pc-linux-rh7.3
i386-unknown-freebsd4.4
i386-unknown-freebsd5.0
ia64-hp-hpux11.20
ia64-unknown-linux-rh7.1
powerpc-ibm-aix5.1.0.0
i386-unknown-netbsd1.6A
- Work around IBM's NFSv3 ABI change in aix4.3
- trivial regression test suite started: run "make check" on a built
am-utils to execute tests. Currently only one test which checks to see if
"amd -v" executes correctly.
- Support network/netmask and network/masklen syntax in in_network()
- new command line option "amd -A arch" to overwrite the value of $arch.
- Support disabling LDAP and Hesiod support using configure
- Support xfs on Linux
- Red Hat specific Amd startup script included
- Remove (non-functional) autofs code and detection support. If you want
autofs support, use am-utils-6.1.
- bugs fixed:
* Linux loop mounts of ISO images
* assorted LDAP fixes
* strerror not found on some systems
* small fixes for hpux9 and aix43
* exclude ldap/hesiod support unless both libraries+headers exist
* fully support "xlatecookie" mount option
* security: if -D noamq option, don't listen on socket.
*** Notes specific to am-utils version 6.1a5:
- browsable_dirs support for Solaris autofs, *without* mount storms!
- new amd.conf global parameter: map_reload_interval (default 1 hour).
Determines how often Amd checks to see if maps have changed at the source
(and then reloading only those that have changed).
- "amd -v" now lists bug-reporting address.
- assorted code cleanups and porting to use latest versions of GNU
Autotools.
- opts:=loop works for type:=cdfs, for mounting ISO-9660 files on Linux.
- bugs fixed:
* fixed sublink support in Linux autofs (broken in a4)
* hlfsd takes uid 0's home from root's passwd entry instead of
defaulting to '/'
* (not really our bug) Linux ignores the microseconds field in
mtime, so hlfsd and amd need to increment the seconds field all
the time to prevent symlink caching
* generic map parsing bug which was rejecting a numerical mount
option if it was the last option in the string.
* file descriptor leak in Linux autofs.
* "nolock" is an NFS mount option, not a generic one.
* use mlockall(2) on systems that have it, for plock=yes. Now
pinning Amd's pages in memory works on Linux.
* ctl-amd/ctl-hlfsd correctly refer to @sysconfdir@ for alternate
location of configuration files.
* generic map parsing bug which was rejecting a numerical mount option
if it was the last option in the string
* MacOS X compile bug
* minor fix for GNU getopt
* Linux has no "dev" mtab option
* "nolock" is an NFS mount option, not a generic one
* Irix N32 ABI fixes with cc
* security: use mkstemp instead of mktemp
* correct timeo values for Linux tcp/udp NFS mounts
* hlfsd use of setuid() not seteuid()
* AIX ABI changes to nfs_args fixes
*** Notes specific to am-utils version 6.1a4:
*** Notes specific to am-utils version 6.0.7:
- full autofs support for Solaris 2.[67], including symlinks, sublinks and
direct mounts
- minor new ports: i386-unknown-freebsd5.0
- fixed mount/umount deadlock in Linux autofs
- bug fixes:
type:=host, don't fail mount if one share is already mounted
don't report NFS NE_IO error as success (Linux)
- fixed sublinks in Linux autofs
*** Notes specific to am-utils version 6.0.6:
- support for network/netmask pairs in the in_network() selector
- new ports:
Mac OS X support (Darwin, Rhapsody)
- support disabling LDAP and Hesiod support using configure
- reworked autoconf scripts so that newer versions of known OSs will default
their configuration to the last known version (better chance that it will
pass autoconf and work).
- forward-ported all the fixes from the stable branch (MacOS X support,
minor Linux fixes)
- linux support for lofs and "bind" mounts, so type:=lofs can work (whether
you're using autofs or not)
- bind-mount support for type==link and type==lofs with Linux 2.4+
- renamed amd.conf option "selectors_on_default" to "selectors_in_defaults"
(on -> in, and added "s"). Old name remains in place for compatibility.
- FiST lofs support under Linux (also in 6.0.6s2)
- lots of cleanups of debugging and logging messages
*** Notes specific to am-utils version 6.1a3:
- Bugs fixed:
lots of Linux-related ones, so it compiles for recent kernels
better checking on various mount options of the form foo=N or foo=STR
fixed NFS errno mapping bug which mapped ENOENT to success on Linux
- various things from the 6.0 branch:
compile fixes for Linux 2.4-ac and 2.2.19pre+
Darwin/Rhapsody/OS X support
much reduced configure script (works around a bug in Darwin's cpp)
*** Notes specific to am-utils version 6.0.5:
*** Notes specific to am-utils version 6.1a2:
- Minor ports:
alphaev6-dec-osf5.1
i386-unknown-freebsd4.2
support for Linux 2.4 kernels and newer GLIBC versions
cleanup of AIX and IRIX6 ports
- working autofs support for Solaris 2.[67], but incomplete
- Support new mount options:
proplist (ACLs over NFS, DU-4.0)
kerb, rdirplus, readdirsize, and xlatecookie (NetBSD-1.5K+)
nonlm, lock, nolock (Linux)
- forward-ported all the changes up to 6.0.5s2
- Don't force rsize/wsize on Linux 2.2.18+ and 2.4.x. Improves performance
a lot.
- removed support for amq -M
- Lots of documentation updates: texinfo, man pages, scripts, and more.
- known bugs
nfsx support is broken
linux NFS codes fixes
NFS cache aliasing fixes
lots of stuff ported from 6.0 branch
- LDAP: included proposed Schema and Internet Draft for LDAP Schema. See
README.ldap for more information.
*** Notes specific to am-utils version 6.1a1:
- Removed all remains of the dangerous amq -M code.
- working autofs (v3 and v4) support for Linux!
- Major bug fix: initialize NFS fileid field correctly, to avoid cache
aliasing problems, esp. on Linux.
- forward-ported all the changes in 6.0.4s4
- Major Linux bug fix: map errnos to NFS errors (mistakenly turned off a
while back). Also support unused errno 41.
- bugs fixed
client-side fail-over to NFSv2/UDP
- known bugs
autofs v3 will probably break with host maps
- Other bugs fixes:
default MAXHOSTNAMELEN (if undefined) is 256, not 64
truncate hostnames to MAXHOSTNAMELEN (security fix)
alignment problem in getwire() on ALPHA
other buf overflow problems (security fixes)
ctl-amd supports "condrestart" (Red Hat)
bell char is \g not \a
lostaltmail verify MAILDIR is defined
am-eject accepts "floppy" and "cdrom" as args
other assorted small bug fixes
*** Notes specific to am-utils version 6.0.4:
@@ -1030,7 +514,7 @@ the functions compute_nfs_args() and compute_automounter_nfs_args().
- bugs fixed:
mnttab name ufs/cdfs/pcfs/etc filesystems corrected
use pmap_ping for amq (a must for secure portmappers, bsdi2/3)
test for xfs (irix) as a disk-based file system
test for xfs (irix) as a disk-based filesystem
set correct nfs_prot headers for Solaris 2.5
removed stale code from lostaltmail.in
lostaltmail will look for conf file in multiple locations
@@ -1447,11 +931,11 @@ used anywhere were removed.
--enable-libs[=ARG]
configure/compile with ARG (-L/-l) library flags
- file system, mount table entries, and mount type tests can now look in
- filesystem, mount table entries, and mount type tests can now look in
/lib/modules and /proc/filesystems for statically/dyadically loadable kernel
modules (linux)
- prefer vfat over msdos/pc/etc file system for PCFS.
- prefer vfat over msdos/pc/etc filesystem for PCFS.
- moved all fixed headers to include/am_defs. Left only #define/#undef
entries in aux/acconfig.h.
-129
View File
@@ -1,129 +0,0 @@
NFS Attribute Caching OS Problems and Amd
Last updated September 18, 2005
* Summary:
Some OSs don't seem to have a way to turn off the NFS attribute cache, which
breaks the Amd automounter so badly that it is not recommend using Amd on
such OS for heavy use, not until this is fixed.
* Details:
Amd is a user-level NFSv2 server that manages automounts of all other file
systems. The kernel contacts Amd via RPCs, and Amd in turn performs the
actual mounts, and then responds back to the kernel's RPCs. Every kernel
caches attributes of files, in a cache called the Directory Name Lookup
Cache (DNLC), or a Directory Cache (dcache).
Amd manages its namespace in the user level, but the kernel caches names
itself. So the two must coordinate to ensure that both namespaces are in
sync. If the kernel uses a cached entry from the DNLC, without consulting
Amd, users may see corruption of the automounter namespace (symlinks
pointing to the wrong places, ESTALE errors, and more). For example,
suppose Amd timed out an entry and removed the entry from Amd's namespace.
Amd has to tell the kernel to purge its corresponding DNLC entry too. The
way Amd often does that is by incrementing the last modification time
(mtime) of the parent directory. This is the most common method for kernels
to check if their DNLC entries are stale: if the parent directory mtime is
newer, the kernel will discard all cached entries for that directory, and
will re-issue lookup methods. Those lookups will result in
NFS_GETATTR/NFS_LOOKUP calls sent from the kernel down to Amd, and Amd can
then properly inform the kernel of the new state of automounted entries.
In order to ensure that Amd is "in charge" of its namespace without
interference from the kernel, Amd will try to turn off the NFS attribute
cache. It does so by using the NFSMNT_NOAC flag, if it exists, or by
setting various "cache timeout" fields in struct nfs_args to 0 (acregmin,
acregmax, acdirmin, or acdirmax).
We have released a major new version of am-utils, version 6.1, in June 2005.
Since then, a lot of people have experimented with Amd, in anticipation of
migrating from the very old am-utils 6.0 to the new 6.1. For a couple of
months since the release of 6.1, we have received reports of problems with
Amd, especially under heavy use. Users reported getting ESTALE errors from
time to time, or seeing automounted entries whose symlinks don't point to
where it should be. After much debugging, we traced it to a few places in
Amd where it wasn't updating the parent directory mtime as it should have;
in some places where Amd was indeed updating the mtime, it was using a
resolution of only 1 second, which was not fine enough under heavy load. We
fixed this problem and switched to using a microsecond resolution mtime.
After fixing this in Amd, we went on to verify that things work for other
OSs. When we got to test certain BSDs, we found out that they always cache
directory entries, and there is no way to turn it off completely.
Specifically, if we set the ac{reg,dir}{min,max} fields in struct nfs_args
all to zero, the kernel seems to cache the entries for a default number of
seconds (something like 5-30 seconds). On some OSs, setting these four
fields to 0 turns off the attribute cache, but not on some BSDs. We were
able to verify this using Amd and a script that exercises the interaction of
the kernel's attrcache and Amd. (If you're interested, the script can be
made available.)
We then experimented by setting the ac{reg,dir}{min,max} fields in struct
nfs_args all to 1, the smallest non-zero value we could. When we ran the
Amd exercising script, we found that the value of 1 reduced the race between
the DNLC and Amd, and the script took a little longer to run before it
detected an incoherency. That makes sense: the smaller the DNLC cache
interval is, the shorter the window of vulnerability is. (BTW, the man
pages on some OSs say that the ac{reg,dir}{min,max} fields use a 1 second
resolution, but experimentation indicated it was in 0.1 second units.)
Clearly, setting the ac{reg,dir}{min,max} fields to 0 is worse than setting
it to 1 on those OSs that don't have a way to turn off the attribute cache.
So the current workaround I've implemented in am-utils is to create a
configuration parameter called "broken_attrcache" which, if turned on, will
set these nfs_args fields to 1 instead of 0. I wish I didn't have to create
such ugly workaround features in Amd, but I've got no choice.
The near term solution is for every OS to support a true 'noac' flag, which
can be added fairly easily. This'd make Amd work reliably.
The long term solution is to implement Autofs support for all OSs and to
support it in Amd. Currently, Amd supports autofs on Solaris and Linux;
FreeBSD is next. Still, we found that even with autofs support, many
sysadmins still prefer to use the good 'ol non-autofs mode.
* Confirmed Status
This is the confirmed status of various OSs' vulnerability to this attribute
cache bug. We are slowly checking the status of other OSs. The status of
any OS not listed is unknown as of the date at the top of this file.
** Not Vulnerable (support a proper "noac" flag):
Sun Solaris 8 and 9 (10 probably works fine)
Linux: 2.6.11 kernel (2.4.latest probably works fine)
FreeBSD 5.4 and 6.0-SNAP001 (older versions probably work fine)
OpenBSD 3.7 (older versions probably work fine)
** Vulnerable (don't support a proper "noac" flag natively):
NetBSD 2.0.2 (older versions are also probably affected)
Note: NetBSD has promised to support a noac flag hopefully after 2.1.0 is
released (maybe in 3.0 or 2.2). In the mean time, you can apply one of
these two kernel patchs to support a 'noac' flag in NetBSD 2.x or 3.x:
ftp://ftp.netbsd.org/pub/NetBSD/misc/christos/2x.nfs.noac.diff
ftp://ftp.netbsd.org/pub/NetBSD/misc/christos/3x.nfs.noac.diff
After applying this patch and rebuilding your kernel, reboot with the new
kernel. Then copy the new nfs.h and nfsmount.h from /sys/nfs/ to
/usr/include/nfs/, and finally rebuild am-utils from scratch.
** Testing
When you build am-utils, a script named scripts/test-attrcache is built,
which can be used to test the NFS attribute cache behavior of the current
OS. You can run this script as root as follows:
# make install
# cd scripts
# sh test-attrcache
If you run this script on an OS whose status is known (and not listed
above), please report it to [email protected], so we can record it in
this file.
Sincerely,
Erez.
+3 -6
View File
@@ -2,17 +2,14 @@ LDAP support for am-utils was originally done by Leif Johansson
<[email protected]>. He no longer maintains it.
The current LDAP support for am-utils is for LDAPv2 only. Reportedly,
LDAPv3 mostly works. Volunteers and patches are welcome.
small changes are needed to support LDAPv3. Volunteers and patches are
welcome.
The IANA has assigned the following Private Enterprise Number to:
10180 Am-utils Organization Erez Zadok [email protected]
There are three files in this directory that relate to LDAP:
ldap.schema:
This is the most current schema.
There are two files in this directory that relate to LDAP:
ldap-id.txt:
+62 -87
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997-2006 Erez Zadok
* Copyright (c) 1997-2004 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -36,8 +36,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* %W% (Berkeley) %G%
*
* File: am-utils/amd/am_ops.c
* $Id: am_ops.c,v 1.6.2.7 2004/01/06 03:15:16 ezk Exp $
*
*/
@@ -86,6 +87,9 @@ static am_ops *vops[] =
#ifdef HAVE_AMU_FS_UNION
&amfs_union_ops, /* union F/S */
#endif /* HAVE_AMU_FS_UNION */
#ifdef HAVE_AMU_FS_INHERIT
&amfs_inherit_ops, /* inheritance F/S */
#endif /* HAVE_AMU_FS_INHERIT */
/*
* A few more native filesystems.
@@ -122,7 +126,7 @@ static am_ops *vops[] =
#endif /* HAVE_FS_UMAPFS */
/*
* These 4 should be last, in the order:
* These 5 should be last, in the order:
* (1) amfs_auto
* (2) amfs_direct
* (3) amfs_toplvl
@@ -145,111 +149,107 @@ static am_ops *vops[] =
void
ops_showamfstypes(char *buf, size_t l)
ops_showamfstypes(char *buf)
{
struct am_ops **ap;
int linesize = 0;
int l = 0;
buf[0] = '\0';
for (ap = vops; *ap; ap++) {
xstrlcat(buf, (*ap)->fs_type, l);
strcat(buf, (*ap)->fs_type);
if (ap[1])
xstrlcat(buf, ", ", l);
linesize += strlen((*ap)->fs_type) + 2;
if (linesize > 62) {
linesize = 0;
xstrlcat(buf, "\n ", l);
strcat(buf, ", ");
l += strlen((*ap)->fs_type) + 2;
if (l > 62) {
l = 0;
strcat(buf, "\n ");
}
}
}
static void
ops_show1(char *buf, size_t l, int *linesizep, const char *name)
ops_show1(char *buf, int *lp, const char *name)
{
xstrlcat(buf, name, l);
xstrlcat(buf, ", ", l);
*linesizep += strlen(name) + 2;
if (*linesizep > 60) {
xstrlcat(buf, "\t\n", l);
*linesizep = 0;
strcat(buf, name);
strcat(buf, ", ");
*lp += strlen(name) + 2;
if (*lp > 60) {
strcat(buf, "\t\n");
*lp = 0;
}
}
void
ops_showfstypes(char *buf, size_t l)
ops_showfstypes(char *buf)
{
int linesize = 0;
int l = 0;
buf[0] = '\0';
#ifdef MNTTAB_TYPE_AUTOFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_AUTOFS);
#endif /* MNTTAB_TYPE_AUTOFS */
#ifdef MNTTAB_TYPE_CACHEFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_CACHEFS);
ops_show1(buf, &l, MNTTAB_TYPE_CACHEFS);
#endif /* MNTTAB_TYPE_CACHEFS */
#ifdef MNTTAB_TYPE_CDFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_CDFS);
ops_show1(buf, &l, MNTTAB_TYPE_CDFS);
#endif /* MNTTAB_TYPE_CDFS */
#ifdef MNTTAB_TYPE_CFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_CFS);
ops_show1(buf, &l, MNTTAB_TYPE_CFS);
#endif /* MNTTAB_TYPE_CFS */
#ifdef MNTTAB_TYPE_LOFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_LOFS);
ops_show1(buf, &l, MNTTAB_TYPE_LOFS);
#endif /* MNTTAB_TYPE_LOFS */
#ifdef MNTTAB_TYPE_EFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_EFS);
ops_show1(buf, &l, MNTTAB_TYPE_EFS);
#endif /* MNTTAB_TYPE_EFS */
#ifdef MNTTAB_TYPE_MFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_MFS);
ops_show1(buf, &l, MNTTAB_TYPE_MFS);
#endif /* MNTTAB_TYPE_MFS */
#ifdef MNTTAB_TYPE_NFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_NFS);
ops_show1(buf, &l, MNTTAB_TYPE_NFS);
#endif /* MNTTAB_TYPE_NFS */
#ifdef MNTTAB_TYPE_NFS3
ops_show1(buf, l, &linesize, "nfs3"); /* always hard-code as nfs3 */
ops_show1(buf, &l, "nfs3"); /* always hard-code as nfs3 */
#endif /* MNTTAB_TYPE_NFS3 */
#ifdef MNTTAB_TYPE_NULLFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_NULLFS);
ops_show1(buf, &l, MNTTAB_TYPE_NULLFS);
#endif /* MNTTAB_TYPE_NULLFS */
#ifdef MNTTAB_TYPE_PCFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_PCFS);
ops_show1(buf, &l, MNTTAB_TYPE_PCFS);
#endif /* MNTTAB_TYPE_PCFS */
#ifdef MNTTAB_TYPE_TFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_TFS);
ops_show1(buf, &l, MNTTAB_TYPE_TFS);
#endif /* MNTTAB_TYPE_TFS */
#ifdef MNTTAB_TYPE_TMPFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_TMPFS);
ops_show1(buf, &l, MNTTAB_TYPE_TMPFS);
#endif /* MNTTAB_TYPE_TMPFS */
#ifdef MNTTAB_TYPE_UFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_UFS);
ops_show1(buf, &l, MNTTAB_TYPE_UFS);
#endif /* MNTTAB_TYPE_UFS */
#ifdef MNTTAB_TYPE_UMAPFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_UMAPFS);
ops_show1(buf, &l, MNTTAB_TYPE_UMAPFS);
#endif /* MNTTAB_TYPE_UMAPFS */
#ifdef MNTTAB_TYPE_UNIONFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_UNIONFS);
ops_show1(buf, &l, MNTTAB_TYPE_UNIONFS);
#endif /* MNTTAB_TYPE_UNIONFS */
#ifdef MNTTAB_TYPE_XFS
ops_show1(buf, l, &linesize, MNTTAB_TYPE_XFS);
ops_show1(buf, &l, MNTTAB_TYPE_XFS);
#endif /* MNTTAB_TYPE_XFS */
/* terminate with a period, newline, and NULL */
@@ -257,7 +257,7 @@ ops_showfstypes(char *buf, size_t l)
buf[strlen(buf) - 4] = '\0';
else
buf[strlen(buf) - 2] = '\0';
xstrlcat(buf, ".\n", l);
strcat(buf, ".\n");
}
@@ -289,11 +289,11 @@ reverse_option(const char *opt)
/* check if string starts with 'no' and chop it */
if (NSTREQ(opt, "no", 2)) {
xstrlcpy(buf, &opt[2], sizeof(buf));
strcpy(buf, &opt[2]);
} else {
/* finally return a string prepended with 'no' */
xstrlcpy(buf, "no", sizeof(buf));
xstrlcat(buf, opt, sizeof(buf));
strcpy(buf, "no");
strcat(buf, opt);
}
return buf;
}
@@ -315,7 +315,7 @@ merge_opts(const char *opts1, const char *opts2)
char *eq; /* pointer to whatever follows '=' within temp */
char oneopt[80]; /* one option w/o value if any */
char *revoneopt; /* reverse of oneopt */
size_t len = strlen(opts1) + strlen(opts2) + 2; /* space for "," and NULL */
int len = strlen(opts1) + strlen(opts2) + 2; /* space for "," and NULL */
char *s1 = strdup(opts1); /* copy of opts1 to munge */
/* initialization */
@@ -327,30 +327,31 @@ merge_opts(const char *opts1, const char *opts2)
tmpstr;
tmpstr = strtok(NULL, ",")) {
/* copy option to temp buffer */
xstrlcpy(oneopt, tmpstr, 80);
strncpy(oneopt, tmpstr, 80);
oneopt[79] = '\0';
/* if option has a value such as rsize=1024, chop the value part */
if ((eq = haseq(oneopt)))
*eq = '\0';
/* find reverse option of oneopt */
revoneopt = reverse_option(oneopt);
/* if option orits reverse exist in opts2, ignore it */
if (amu_hasmntopt(&mnt2, oneopt) || amu_hasmntopt(&mnt2, revoneopt))
if (hasmntopt(&mnt2, oneopt) || hasmntopt(&mnt2, revoneopt))
continue;
/* add option to returned string */
if (newstr[0]) {
xstrlcat(newstr, ",", len);
xstrlcat(newstr, tmpstr, len);
if (newstr && newstr[0]) {
strcat(newstr, ",");
strcat(newstr, tmpstr);
} else {
xstrlcpy(newstr, tmpstr, len);
strcpy(newstr, tmpstr);
}
}
/* finally, append opts2 itself */
if (newstr[0]) {
xstrlcat(newstr, ",", len);
xstrlcat(newstr, opts2, len);
if (newstr && newstr[0]) {
strcat(newstr, ",");
strcat(newstr, opts2);
} else {
xstrlcpy(newstr, opts2, len);
strcpy(newstr, opts2);
}
XFREE(s1);
@@ -359,22 +360,10 @@ merge_opts(const char *opts1, const char *opts2)
am_ops *
ops_search(char *type)
ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map)
{
am_ops **vp;
am_ops *rop = 0;
for (vp = vops; (rop = *vp); vp++)
if (STREQ(rop->fs_type, type))
break;
return rop;
}
am_ops *
ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map)
{
am_ops *rop = 0;
char *link_dir;
/*
* First crack the global opts and the local opts
@@ -388,7 +377,9 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
/*
* Next find the correct filesystem type
*/
rop = ops_search(fo->opt_type);
for (vp = vops; (rop = *vp); vp++)
if (STREQ(rop->fs_type, fo->opt_type))
break;
if (!rop) {
plog(XLOG_USER, "fs type \"%s\" not recognized", fo->opt_type);
rop = &amfs_error_ops;
@@ -442,34 +433,18 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
}
}
/*
* Initialize opt_mount_type to "nfs", if it's not initialized already
*/
if (!fo->opt_mount_type)
fo->opt_mount_type = "nfs";
/* Normalize the sublink and make it absolute */
link_dir = fo->opt_sublink;
if (link_dir && link_dir[0] && link_dir[0] != '/') {
link_dir = str3cat((char *) 0, fo->opt_fs, "/", link_dir);
normalize_slash(link_dir);
XFREE(fo->opt_sublink);
fo->opt_sublink = link_dir;
}
/*
* Check the filesystem is happy
*/
if (fo->fs_mtab)
XFREE(fo->fs_mtab);
fo->fs_mtab = rop->fs_match(fo);
if (fo->fs_mtab)
if ((fo->fs_mtab = (*rop->fs_match) (fo)))
return rop;
/*
* Return error file system
*/
fo->fs_mtab = amfs_error_ops.fs_match(fo);
fo->fs_mtab = (*amfs_error_ops.fs_match) (fo);
return &amfs_error_ops;
}
+90 -118
View File
@@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1997-2006 Erez Zadok
.\" Copyright (c) 1997-2004 Erez Zadok
.\" Copyright (c) 1989 Jan-Simon Pendry
.\" Copyright (c) 1989 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1989 The Regents of the University of California.
@@ -38,34 +38,39 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" $Id: amd.8,v 1.14.2.1 2006/01/02 18:48:23 ezk Exp $
.\" $Id: amd.8,v 1.4.2.5 2004/01/06 03:15:16 ezk Exp $
.\" $FreeBSD$
.\"
.Dd January 2, 2006
.Dd April 19, 1994
.Dt AMD 8
.Os
.Sh NAME
.Nm amd
.Nd automatically mount file systems
.Sh SYNOPSIS
.Nm
.Nm amd
.Fl H
.Nm
.Nm amd
.Op Fl F Ar conf_file
.Nm
.Nm amd
.Op Fl nprvHS
.Op Fl a Ar mount_point
.Op Fl c Ar duration
.Op Fl d Ar domain
.Bk -words
.Op Fl k Ar kernel-arch
.Ek
.Op Fl l Ar logfile
.Op Fl o Ar op_sys_ver
.Op Fl t Ar timeout.retransmit
.Bk -words
.Op Fl w Ar interval
.Ek
.Op Fl x Ar log-option
.Op Fl y Ar YP-domain
.Op Fl A Ar arch
.Bk -words
.Op Fl C Ar cluster-name
.Ek
.Op Fl D Ar option
.Op Fl F Ar conf_file
.Op Fl O Ar op_sys_name
@@ -76,46 +81,41 @@
.Oc
.Ar ...
.Sh DESCRIPTION
The
.Nm
utility
is a daemon that automatically mounts file systems
whenever a file or directory
.Nm Amd
is a daemon that automatically mounts file systems whenever a file or directory
within that file system is accessed.
File systems are automatically unmounted when they
appear to be quiescent.
File systems are automatically unmounted
when they appear to be quiescent.
.Pp
The
.Nm
utility
.Nm Amd
operates by attaching itself as an
.Tn NFS
server to each of the specified
.Ar directories .
Lookups within the specified directories
are handled by
.Nm ,
.Nm amd ,
which uses the map defined by
.Ar mapname
to determine how to resolve the lookup.
Generally, this will be a host name, some file system information
and some mount options for the given file system.
Generally, this will be a host name,
some file system information and some mount options for the given file system.
.Pp
In the first form depicted above,
.Nm
.Nm amd
will print a short help string.
In the second form, if no options are
specified, or if the
.Fl F
is used,
.Nm
.Nm amd
will read configuration parameters from the file
.Ar conf_file
which defaults to
.Pa /etc/amd.conf .
The last form is described below.
.Sh OPTIONS
.Bl -tag -width indent
.Bl -tag -width Ds
.It Fl a Ar temporary-directory
Specify an alternative location for the real mount points.
The default is
@@ -139,63 +139,55 @@ Specify a logfile in which to record mount and unmount events.
If
.Ar logfile
is the string
.Dq Li syslog ,
then the log messages will be sent to the system log daemon by
.Em syslog ,
the log messages will be sent to the system log daemon by
.Xr syslog 3 .
The default syslog facility used is
.Dv LOG_DAEMON .
If you
wish to change it, append its name to the log file name, delimited by a
single colon.
The default syslog facility used is LOG_DAEMON.
If you wish to change it, append its name to the log file name,
delimited by a single colon.
For example, if
.Ar logfile
is the string
.Dq Li syslog:local7
then
.Nm
.Nm amd
will log messages via
.Xr syslog 3
using the
.Dv LOG_LOCAL7
facility (if it exists on the system).
using the LOG_LOCAL7 facility (if it exists on the system).
.It Fl n
Normalize hostnames.
The name referred to by ${rhost} is normalized relative to the
host database before being used.
The effect is to translate
aliases into
.Dq official
names.
aliases into ``official'' names.
.It Fl o Ar op_sys_ver
Override the compiled-in version number of the operating system.
Useful
when the built in version is not desired for backward compatibility reasons.
Useful when the built in version is not desired for backward
compatibility reasons.
For example, if the build in version is
.Dq Li 2.5.1 ,
.Dq 2.5.1 ,
you can override it to
.Dq Li 5.5.1 ,
.Dq 5.5.1 ,
and use older maps that were written with the latter in mind.
.It Fl p
Print PID.
Outputs the process ID of
.Nm
Print
.Em PID .
Outputs the process-id of
.Nm amd
to standard output where it can be saved into a file.
.It Fl r
Restart existing mounts.
The
.Nm
utility
.Nm Amd
will scan the mount file table to determine which file systems
are currently mounted.
Whenever one of these would have
been auto-mounted,
.Nm
.Nm amd
.Em inherits
it.
.It Fl t Ar timeout.retransmit
Specify the NFS
.Ar timeout
interval,
Specify the NFS timeout
.Ar interval ,
in tenths of a second, between
.Tn NFS/RPC
retries (for UDP only).
@@ -208,10 +200,7 @@ to communicate with amd.
Useful defaults are supplied if either or both
values are missing.
.Pp
The
.Xr amd 8
utility
relies on the kernel RPC retransmit mechanism to trigger mount retries.
Amd relies on the kernel RPC retransmit mechanism to trigger mount retries.
The values of these parameters change the overall retry interval.
Too long
an interval gives poor interactive response; too short an interval causes
@@ -222,14 +211,13 @@ Displays version and configuration information on standard error.
.It Fl w Ar interval
Specify an
.Ar interval ,
in seconds, between attempts to dismount
file systems that have exceeded their cached times.
in seconds, between attempts to dismount file systems that have exceeded their
cached times.
The default is 2 minutes.
.It Fl x Ar options
Specify run-time logging options.
The options are a comma separated
list chosen from:
.Li fatal , error , user , warn , info , map , stats , all .
The options are a comma separated list
chosen from: fatal, error, user, warn, info, map, stats, all.
.It Fl y Ar domain
Specify an alternative
.Tn NIS
@@ -240,21 +228,17 @@ The default is the system domain name.
This option is ignored if
.Tn NIS
support is not available.
.It Fl A Ar arch
Specifies the OS architecture.
This is used solely to set the ${arch}
selector.
.It Fl C Ar cluster-name
Specify an alternative HP-UX cluster name to use.
.It Fl D Ar option
Select from a variety of debug options.
Prefixing an
option with the string
.Dq Li no
.Em no
reverses the effect of that option.
Options are cumulative.
The most useful option is
.Dq Li all .
.Ar all .
.Pp
Since
.Fl D
@@ -265,7 +249,7 @@ option
and a fuller description is available in the program source.
.It Fl F Ar conf_file
Specify an
.Nm
.Nm amd
configuration file to use.
See
.Xr amd.conf 5
@@ -273,63 +257,59 @@ for description of this file's format.
This configuration file is used to
specify any options in lieu of typing many of them on the command line.
The
.Xr amd.conf 5
file includes directives for every command line option amd has, and many
more that are only available via the configuration file facility.
The
configuration file specified by this option is processed after all other
options had been processed, regardless of the actual location of this option
on the command line.
.Nm amd.conf
file includes directives for every command line option amd has,
and many more that are only available via the configuration file
facility.
The configuration file specified by this option is
processed after all other options have been processed, regardless
of the actual location of this option on the command line.
.It Fl H
Print help and usage string.
.It Fl O Ar op_sys_name
Override the compiled-in name of the operating system.
Useful when the
built in name is not desired for backward compatibility reasons.
For
example, if the build in name is
.Dq Li sunos5 ,
Useful when the built in name is not desired for backward
compatibility reasons.
For example, if the build in name is
.Dq sunos5 ,
you can override it to
.Dq Li sos5
.Dq sos5
and use older maps which were written with the latter in mind.
.It Fl S
Do not lock the running executable pages of
.Nm
.Nm amd
into memory.
To improve
.Nm Ns 's
.Nm amd's
performance, systems that support the
.Xr plock 3
call, could lock the
.Nm
.Nm amd
process into memory.
This way there is less chance
the operating system will schedule, page out, and swap the
.Nm
process as
needed.
This way there is less chance the operating system will
schedule, page out, and swap the
.Nm amd
process as needed.
This tends to improve
.Nm Ns 's
performance, at the cost of reserving the
memory used by the
.Nm
process (making it unavailable for other processes).
.Nm amd's
performance, at the cost of reserving the memory used by the
.Nm amd
process
(making it unavailable for other processes).
If this behavior is not desired, use the
.Fl S
option.
.It Fl T Ar tag
Specify a tag to use with
.Xr amd.conf 5 .
All map entries tagged with
.Ar tag
will be processed.
All Map entries tagged with tag will be processed.
Map entries that are not tagged are always processed.
Map entries that are tagged with a tag other than
.Ar tag
will not be processed.
.El
.Sh FILES
.Bl -tag -width ".Pa /etc/amd.conf"
.Bl -tag -width /axx
.It Pa /.amd_mnt
directory under which file systems are dynamically mounted
.It Pa /etc/amd.conf
@@ -343,17 +323,20 @@ Symbolic links on an
file system can be incredibly inefficient.
In most implementations of
.Tn NFS ,
their interpolations are not cached
by the kernel and each time a symbolic link is encountered during a
their interpolations are not cached by
the kernel and each time a symbolic link is
encountered during a
.Em lookuppn
translation it costs an
.Tn RPC
call to the
.Tn NFS
server.
It would appear that a large improvement in real-time
A large improvement in real-time
performance could be gained by adding a cache somewhere.
Replacing symlinks with a suitable incarnation of the auto-mounter
Replacing
.Xr symlink 2
with a suitable incarnation of the auto-mounter
results in a large real-time speedup, but also causes a large
number of process context switches.
.Pp
@@ -368,34 +351,23 @@ the features.
.Xr amq 8 ,
.Xr mount 8 ,
.Xr umount 8
.Pp
.Dq am-utils
.Xr info 1
entry.
.Rs
.%A Erez Zadok
.%B "Linux NFS and Automounter Administration"
.%O ISBN 0-7821-2739-8
.%I Sybex
.%D 2001
.Re
.Pp
.Pa http://www.am-utils.org/
.Rs
.%T Amd \- The 4.4 BSD Automounter
.Re
.Pp
.Pa http://www.am-utils.org/
.Sh HISTORY
The
.Nm
.Nm amd
utility first appeared in
.Bx 4.4 .
.Sh AUTHORS
.An Jan-Simon Pendry Aq [email protected] ,
Department of Computing, Imperial College, London, UK.
.Pp
.An Erez Zadok Aq ezk@cs.sunysb.edu ,
Computer Science Department, Stony Brook
University, Stony Brook, New York, USA.
.An Erez Zadok Aq ezk@am-utils.org ,
Department of Computer Science, Columbia University,
New York, USA.
.Pp
Other authors and contributors to am-utils are listed in the
.Pa AUTHORS
+116 -140
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997-2006 Erez Zadok
* Copyright (c) 1997-2004 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -36,15 +36,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* %W% (Berkeley) %G%
*
* $Id: amd.c,v 1.8.2.6 2004/01/06 03:15:16 ezk Exp $
* File: am-utils/amd/amd.c
* $FreeBSD$
*
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* Automounter
*/
@@ -57,10 +55,9 @@ __FBSDID("$FreeBSD$");
struct amu_global_options gopt; /* where global options are stored */
char pid_fsname[SIZEOF_PID_FSNAME]; /* "kiska.southseas.nz:(pid%d)" */
char pid_fsname[16 + MAXHOSTNAMELEN]; /* "kiska.southseas.nz:(pid%d)" */
char *hostdomain = "unknown.domain";
#define SIZEOF_HOSTD (2 * MAXHOSTNAMELEN + 1) /* Host+domain */
char hostd[SIZEOF_HOSTD]; /* Host+domain */
char hostd[2 * MAXHOSTNAMELEN + 1]; /* Host+domain */
char *endian = ARCH_ENDIAN; /* Big or Little endian */
char *cpu = HOST_CPU; /* CPU type */
char *PrimNetName; /* name of primary network */
@@ -75,10 +72,6 @@ struct amd_stats amd_stats; /* Server statistics */
struct in_addr myipaddr; /* (An) IP address of this host */
time_t do_mapc_reload = 0; /* mapc_reload() call required? */
#ifdef HAVE_FS_AUTOFS
int amd_use_autofs = 0;
#endif /* HAVE_FS_AUTOFS */
#ifdef HAVE_SIGACTION
sigset_t masked_sigs;
#endif /* HAVE_SIGACTION */
@@ -126,8 +119,10 @@ sighup(int sig)
signal(sig, sighup);
#endif /* REINSTALL_SIGNAL_HANDLER */
#ifdef DEBUG
if (sig != SIGHUP)
dlog("spurious call to sighup");
#endif /* DEBUG */
/*
* Force a reload by zero'ing the timer
*/
@@ -139,26 +134,7 @@ sighup(int sig)
static RETSIGTYPE
parent_exit(int sig)
{
/*
* This signal handler is called during Amd initialization. The parent
* forks a child to do all the hard automounting work, and waits for a
* SIGQUIT signal from the child. When the parent gets the signal it's
* supposed to call this handler and exit(3), thus completing the
* daemonizing process. Alas, on some systems, especially Linux 2.4/2.6
* with Glibc, exit(3) doesn't always terminate the parent process.
* Worse, the parent process now refuses to accept any more SIGQUIT
* signals -- they are blocked. What's really annoying is that this
* doesn't happen all the time, suggesting a race condition somewhere.
* (This happens even if I change the logic to use another signal.) I
* traced this to something which exit(3) does in addition to exiting the
* process, probably some atexit() stuff or other side-effects related to
* signal handling. Either way, since at this stage the parent process
* just needs to terminate, I'm simply calling _exit(2). Note also that
* the OpenGroup doesn't list exit(3) as a recommended "Base Interface"
* but they do list _exit(2) as one. This fix seems to work reliably all
* the time. -Erez (2/27/2005)
*/
_exit(0);
exit(0);
}
@@ -170,7 +146,6 @@ daemon_mode(void)
#ifdef HAVE_SIGACTION
struct sigaction sa, osa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = parent_exit;
sa.sa_flags = 0;
sigemptyset(&(sa.sa_mask));
@@ -243,7 +218,6 @@ init_global_options(void)
#if defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
static struct utsname un;
#endif /* defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME) */
int i;
memset(&gopt, 0, sizeof(struct amu_global_options));
@@ -253,15 +227,9 @@ init_global_options(void)
/* automounter temp dir */
gopt.auto_dir = "/.amd_mnt";
/* toplevel attribute cache timeout */
gopt.auto_attrcache = 0;
/* cluster name */
gopt.cluster = NULL;
/* executable map timeout */
gopt.exec_map_timeout = AMFS_EXEC_MAP_TIMEOUT;
/*
* kernel architecture: this you must get from uname() if possible.
*/
@@ -293,11 +261,11 @@ init_global_options(void)
/* local domain */
gopt.sub_domain = NULL;
/* reset NFS (and toplvl) retransmit counter and retry interval */
for (i=0; i<AMU_TYPE_MAX; ++i) {
gopt.amfs_auto_retrans[i] = -1; /* -1 means "never set before" */
gopt.amfs_auto_timeo[i] = -1; /* -1 means "never set before" */
}
/* NFS retransmit counter */
gopt.amfs_auto_retrans = -1;
/* NFS retry interval */
gopt.amfs_auto_timeo = -1;
/* cache duration */
gopt.am_timeo = AM_TTL;
@@ -305,13 +273,11 @@ init_global_options(void)
/* dismount interval */
gopt.am_timeo_w = AM_TTL_W;
/* map reload intervl */
gopt.map_reload_interval = ONE_HOUR;
/*
* various CFM_* flags that are on by default.
* various CFM_* flags.
* by default, only the "plock" option is on (if available).
*/
gopt.flags = CFM_DEFAULT_FLAGS;
gopt.flags = CFM_PROCESS_LOCK;
#ifdef HAVE_MAP_HESIOD
/* Hesiod rhs zone */
@@ -328,9 +294,6 @@ init_global_options(void)
/* LDAP cache */
gopt.ldap_cache_seconds = 0;
gopt.ldap_cache_maxmem = 131072;
/* LDAP protocol version */
gopt.ldap_proto_version = 2;
#endif /* HAVE_MAP_LDAP */
#ifdef HAVE_MAP_NIS
@@ -340,58 +303,17 @@ init_global_options(void)
}
/*
* Lock process text and data segment in memory (after forking the daemon)
*/
static void
do_memory_locking(void)
{
#if defined(HAVE_PLOCK) || defined(HAVE_MLOCKALL)
int locked_ok = 0;
#else /* not HAVE_PLOCK and not HAVE_MLOCKALL */
plog(XLOG_WARNING, "Process memory locking not supported by the OS");
#endif /* not HAVE_PLOCK and not HAVE_MLOCKALL */
#ifdef HAVE_PLOCK
# ifdef _AIX
/*
* On AIX you must lower the stack size using ulimit() before calling
* plock. Otherwise plock will reserve a lot of memory space based on
* your maximum stack size limit. Since it is not easily possible to
* tell what should the limit be, I print a warning before calling
* plock(). See the manual pages for ulimit(1,3,4) on your AIX system.
*/
plog(XLOG_WARNING, "AIX: may need to lower stack size using ulimit(3) before calling plock");
# endif /* _AIX */
if (!locked_ok && plock(PROCLOCK) != 0)
plog(XLOG_WARNING, "Couldn't lock process pages in memory using plock(): %m");
else
locked_ok = 1;
#endif /* HAVE_PLOCK */
#ifdef HAVE_MLOCKALL
if (!locked_ok && mlockall(MCL_CURRENT|MCL_FUTURE) != 0)
plog(XLOG_WARNING, "Couldn't lock process pages in memory using mlockall(): %m");
else
locked_ok = 1;
#endif /* HAVE_MLOCKALL */
#if defined(HAVE_PLOCK) || defined(HAVE_MLOCKALL)
if (locked_ok)
plog(XLOG_INFO, "Locked process pages in memory");
#endif /* HAVE_PLOCK || HAVE_MLOCKALL */
#if defined(HAVE_MADVISE) && defined(MADV_PROTECT)
madvise(0, 0, MADV_PROTECT); /* may be redundant of the above worked out */
#endif /* defined(HAVE_MADVISE) && defined(MADV_PROTECT) */
}
int
main(int argc, char *argv[])
{
char *domdot, *verstr, *vertmp;
char *domdot, *verstr;
int ppid = 0;
int error;
char *progname = NULL; /* "amd" */
char hostname[MAXHOSTNAMELEN + 1] = "localhost"; /* Hostname */
#ifdef HAVE_SIGACTION
struct sigaction sa;
#endif /* HAVE_SIGACTION */
/*
* Make sure some built-in assumptions are true before we start
@@ -442,6 +364,11 @@ main(int argc, char *argv[])
going_down(1);
}
#ifdef DEBUG
/* initialize debugging flags (Register AMQ, Enter daemon mode) */
debug_flags = D_AMQ | D_DAEMON;
#endif /* DEBUG */
/*
* Initialize global options structure.
*/
@@ -460,31 +387,73 @@ main(int argc, char *argv[])
*domdot++ = '\0';
hostdomain = domdot;
}
xstrlcpy(hostd, hostname, sizeof(hostd));
strcpy(hostd, hostname);
am_set_hostname(hostname);
/*
* Setup signal handlers
* Trap interrupts for shutdowns.
*/
/* SIGINT: trap interrupts for shutdowns */
setup_sighandler(SIGINT, sigterm);
/* SIGTERM: trap terminate so we can shutdown cleanly (some chance) */
setup_sighandler(SIGTERM, sigterm);
/* SIGHUP: hangups tell us to reload the cache */
setup_sighandler(SIGHUP, sighup);
/*
* SIGCHLD: trap Death-of-a-child. These allow us to pick up the exit
* status of backgrounded mounts. See "sched.c".
*/
setup_sighandler(SIGCHLD, sigchld);
#ifdef HAVE_SIGACTION
/* construct global "masked_sigs" used in nfs_start.c */
sa.sa_handler = sigterm;
sa.sa_flags = 0;
sigemptyset(&(sa.sa_mask));
sigaddset(&(sa.sa_mask), SIGINT);
sigaddset(&(sa.sa_mask), SIGTERM);
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
#else /* not HAVE_SIGACTION */
(void) signal(SIGINT, sigterm);
#endif /* not HAVE_SIGACTION */
/*
* Trap Terminate so that we can shutdown gracefully (some chance)
*/
#ifdef HAVE_SIGACTION
sa.sa_handler = sigterm;
sa.sa_flags = 0;
sigemptyset(&(sa.sa_mask));
sigaddset(&(sa.sa_mask), SIGTERM);
sigaction(SIGTERM, &sa, NULL);
#else /* not HAVE_SIGACTION */
(void) signal(SIGTERM, sigterm);
#endif /* not HAVE_SIGACTION */
/*
* Hangups tell us to reload the cache
*/
#ifdef HAVE_SIGACTION
sa.sa_handler = sighup;
sa.sa_flags = 0;
sigemptyset(&(sa.sa_mask));
sigaddset(&(sa.sa_mask), SIGHUP);
sigaction(SIGHUP, &sa, NULL);
#else /* not HAVE_SIGACTION */
(void) signal(SIGHUP, sighup);
#endif /* not HAVE_SIGACTION */
/*
* Trap Death-of-a-child. These allow us to
* pick up the exit status of backgrounded mounts.
* See "sched.c".
*/
#ifdef HAVE_SIGACTION
sa.sa_handler = sigchld;
sa.sa_flags = 0;
sigemptyset(&(sa.sa_mask));
sigaddset(&(sa.sa_mask), SIGCHLD);
sigaction(SIGCHLD, &sa, NULL);
/*
* construct global "masked_sigs" used in nfs_start.c
*/
sigemptyset(&masked_sigs);
sigaddset(&masked_sigs, SIGINT);
sigaddset(&masked_sigs, SIGTERM);
sigaddset(&masked_sigs, SIGHUP);
sigaddset(&masked_sigs, SIGCHLD);
#endif /* HAVE_SIGACTION */
sigaddset(&masked_sigs, SIGTERM);
sigaddset(&masked_sigs, SIGINT);
#else /* not HAVE_SIGACTION */
(void) signal(SIGCHLD, sigchld);
#endif /* not HAVE_SIGACTION */
/*
* Fix-up any umask problems. Most systems default
@@ -505,21 +474,18 @@ main(int argc, char *argv[])
/*
* Log version information.
*/
vertmp = get_version_string();
verstr = strtok(vertmp, "\n");
verstr = strtok(get_version_string(), "\n");
plog(XLOG_INFO, "AM-UTILS VERSION INFORMATION:");
while (verstr) {
plog(XLOG_INFO, "%s", verstr);
verstr = strtok(NULL, "\n");
}
XFREE(vertmp);
/*
* Get our own IP address so that we can mount the automounter. We pass
* localhost_address which could be used as the default localhost
* name/address in amu_get_myaddress().
* Get our own IP address so that we
* can mount the automounter.
*/
amu_get_myaddress(&myipaddr, gopt.localhost_address);
amu_get_myaddress(&myipaddr);
plog(XLOG_INFO, "My ip addr is %s", inet_ntoa(myipaddr));
/* avoid hanging on other NFS servers if started elsewhere */
@@ -534,6 +500,29 @@ main(int argc, char *argv[])
going_down(1);
}
/*
* Lock process text and data segment in memory.
*/
#ifdef HAVE_PLOCK
if (gopt.flags & CFM_PROCESS_LOCK) {
# ifdef _AIX
/*
* On AIX you must lower the stack size using ulimit() before calling
* plock. Otherwise plock will reserve a lot of memory space based on
* your maximum stack size limit. Since it is not easily possible to
* tell what should the limit be, I print a warning before calling
* plock(). See the manual pages for ulimit(1,3,4) on your AIX system.
*/
plog(XLOG_WARNING, "AIX: may need to lower stack size using ulimit(3) before calling plock");
# endif /* _AIX */
if (plock(PROCLOCK) != 0) {
plog(XLOG_WARNING, "Couldn't lock process text and data segment in memory: %m");
} else {
plog(XLOG_INFO, "Locked process text and data segment in memory");
}
}
#endif /* HAVE_PLOCK */
#ifdef HAVE_MAP_NIS
/*
* If the domain was specified then bind it here
@@ -546,17 +535,14 @@ main(int argc, char *argv[])
}
#endif /* HAVE_MAP_NIS */
if (!amuDebug(D_DAEMON))
#ifdef DEBUG
amuDebug(D_DAEMON)
#endif /* DEBUG */
ppid = daemon_mode();
/*
* Lock process text and data segment in memory.
*/
if (gopt.flags & CFM_PROCESS_LOCK) {
do_memory_locking();
}
sprintf(pid_fsname, "%s:(pid%ld)", am_get_hostname(), (long) am_mypid);
do_mapc_reload = clocktime(NULL) + gopt.map_reload_interval;
do_mapc_reload = clocktime() + ONE_HOUR;
/*
* Register automounter with system.
@@ -564,16 +550,6 @@ main(int argc, char *argv[])
error = mount_automounter(ppid);
if (error && ppid)
kill(ppid, SIGALRM);
#ifdef HAVE_FS_AUTOFS
/*
* XXX this should be part of going_down(), but I can't move it there
* because it would be calling non-library code from the library... ugh
*/
if (amd_use_autofs)
destroy_autofs_service();
#endif /* HAVE_FS_AUTOFS */
going_down(error);
abort();
+76 -645
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997-2006 Erez Zadok
* Copyright (c) 1997-2004 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -36,8 +36,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* %W% (Berkeley) %G%
*
* File: am-utils/amd/amd.h
* $Id: amd.h,v 1.8.2.8 2004/01/21 04:04:58 ib42 Exp $
*
*/
@@ -49,160 +50,33 @@
* MACROS:
*/
/*
* Define a default debug mtab path for systems
* that support mtab on file.
*/
#ifdef MOUNT_TABLE_ON_FILE
# define DEBUG_MNTTAB_FILE "/tmp/mnttab"
#endif /* MOUNT_TABLE_ON_FILE */
/* options for amd.conf */
#define CFM_BROWSABLE_DIRS 0x00000001
#define CFM_MOUNT_TYPE_AUTOFS 0x00000002 /* use kernel autofs support */
#define CFM_SELECTORS_IN_DEFAULTS 0x00000004
#define CFM_NORMALIZE_HOSTNAMES 0x00000008
#define CFM_PROCESS_LOCK 0x00000010
#define CFM_PRINT_PID 0x00000020
#define CFM_RESTART_EXISTING_MOUNTS 0x00000040
#define CFM_SHOW_STATFS_ENTRIES 0x00000080
#define CFM_FULLY_QUALIFIED_HOSTS 0x00000100
#define CFM_BROWSABLE_DIRS_FULL 0x00000200 /* allow '/' in readdir() */
#define CFM_UNMOUNT_ON_EXIT 0x00000400 /* when amd finishing */
#define CFM_USE_TCPWRAPPERS 0x00000800
#define CFM_AUTOFS_USE_LOFS 0x00001000
#define CFM_NFS_INSECURE_PORT 0x00002000
#define CFM_DOMAIN_STRIP 0x00004000
#define CFM_NORMALIZE_SLASHES 0x00008000 /* normalize slashes? */
#define CFM_FORCED_UNMOUNTS 0x00010000 /* forced unmounts? */
#define CFM_TRUNCATE_LOG 0x00020000 /* truncate log file? */
#if 0
/* XXX: reserved to sync up with am-utils-6.2 */
#define CFM_SUN_MAP_SYNTAX 0x00040000 /* Sun map syntax? */
#endif
#define CFM_NFS_ANY_INTERFACE 0x00080000 /* all interfaces are acceptable */
/* defaults global flags: plock, tcpwrappers, and autofs/lofs */
#define CFM_DEFAULT_FLAGS (CFM_PROCESS_LOCK|CFM_USE_TCPWRAPPERS|CFM_AUTOFS_USE_LOFS|CFM_DOMAIN_STRIP|CFM_NORMALIZE_SLASHES)
/*
* macro definitions for automounter vfs/vnode operations.
*/
#define VLOOK_CREATE 0x1
#define VLOOK_DELETE 0x2
#define VLOOK_LOOKUP 0x3
/*
* macro definitions for automounter vfs capabilities
*/
#define FS_DIRECTORY 0x0001 /* This looks like a dir, not a link */
#define FS_MBACKGROUND 0x0002 /* Should background this mount */
#define FS_NOTIMEOUT 0x0004 /* Don't bother with timeouts */
#define FS_MKMNT 0x0008 /* Need to make the mount point */
#define FS_UBACKGROUND 0x0010 /* Unmount in background */
#define FS_BACKGROUND (FS_MBACKGROUND|FS_UBACKGROUND)
#define FS_DISCARD 0x0020 /* Discard immediately on last reference */
#define FS_AMQINFO 0x0040 /* Amq is interested in this fs type */
#define FS_AUTOFS 0x0080 /* This filesystem can be an autofs f/s */
#define FS_DIRECT 0x0100 /* Direct mount */
#define FS_ON_AUTOFS 0x0200 /* This filesystem can be mounted directly
onto an autofs mountpoint */
/*
* macros for struct am_node (map of auto-mount points).
*/
#define AMF_NOTIMEOUT 0x0001 /* This node never times out */
#define AMF_ROOT 0x0002 /* This is a root node */
#define AMF_AUTOFS 0x0004 /* This node is part of an autofs filesystem */
#define AMF_REMOUNT 0x0008 /* This node needs to be remounted */
#define AMF_SOFTLOOKUP 0x0010 /* This node returns EIO if server is down */
/*
* macros for struct mntfs (list of mounted filesystems)
*/
#define MFF_MOUNTED 0x0001 /* Node is mounted */
#define MFF_MOUNTING 0x0002 /* Mount is in progress */
#define MFF_UNMOUNTING 0x0004 /* Unmount is in progress */
#define MFF_RESTART 0x0008 /* Restarted node */
#define MFF_MKMNT 0x0010 /* Delete this node's am_mount */
#define MFF_ERROR 0x0020 /* This node failed to mount */
#define MFF_LOGDOWN 0x0040 /* Logged that this mount is down */
#define MFF_RSTKEEP 0x0080 /* Don't timeout this filesystem - restarted */
#define MFF_WANTTIMO 0x0100 /* Need a timeout call when not busy */
#define MFF_NFSLINK 0x0200 /* nfsl type, and deemed a link */
#define MFF_IS_AUTOFS 0x0400 /* this filesystem is of type autofs */
#define MFF_NFS_SCALEDOWN 0x0800 /* the mount failed, retry with v2/UDP */
#define MFF_ON_AUTOFS 0x1000 /* autofs has a lofs/link to this f/s */
#define MFF_WEBNFS 0x2000 /* use public filehandle */
/*
* macros for struct fserver.
*/
#define FSF_VALID 0x0001 /* Valid information available */
#define FSF_DOWN 0x0002 /* This fileserver is thought to be down */
#define FSF_ERROR 0x0004 /* Permanent error has occurred */
#define FSF_WANT 0x0008 /* Want a wakeup call */
#define FSF_PINGING 0x0010 /* Already doing pings */
#define FSF_WEBNFS 0x0020 /* Don't try to contact portmapper */
#define FSF_PING_UNINIT 0x0040 /* ping values have not been initilized */
#define FSF_FORCE_UNMOUNT 0x0080 /* force umount of this fserver */
#define FSRV_ERROR(fs) ((fs) && (((fs)->fs_flags & FSF_ERROR) == FSF_ERROR))
#define FSRV_ISDOWN(fs) ((fs) && (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_DOWN|FSF_VALID)))
#define FSRV_ISUP(fs) (!(fs) || (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_VALID)))
#define CFM_BROWSABLE_DIRS 0x0001
#define CFM_MOUNT_TYPE_AUTOFS 0x0002
#define CFM_SELECTORS_IN_DEFAULTS 0x0004
#define CFM_NORMALIZE_HOSTNAMES 0x0008
#define CFM_PROCESS_LOCK 0x0010
#define CFM_PRINT_PID 0x0020
#define CFM_RESTART_EXISTING_MOUNTS 0x0040
#define CFM_SHOW_STATFS_ENTRIES 0x0080
#define CFM_FULLY_QUALIFIED_HOSTS 0x0100
#define CFM_BROWSABLE_DIRS_FULL 0x0200 /* allow '/' in readdir() */
#define CFM_UNMOUNT_ON_EXIT 0x0400 /* when amd finishing */
#define CFM_NFS_INSECURE_PORT 0x0800
/* some systems (SunOS 4.x) neglect to define the mount null message */
#ifndef MOUNTPROC_NULL
# define MOUNTPROC_NULL ((u_long)(0))
#endif /* not MOUNTPROC_NULL */
/*
* Error to return if remote host is not available.
* Try, in order, "host down", "host unreachable", "invalid argument".
*/
#ifdef EHOSTDOWN
# define AM_ERRNO_HOST_DOWN EHOSTDOWN
#else /* not EHOSTDOWN */
# ifdef EHOSTUNREACH
# define AM_ERRNO_HOST_DOWN EHOSTUNREACH
# else /* not EHOSTUNREACH */
# define AM_ERRNO_HOST_DOWN EINVAL
# endif /* not EHOSTUNREACH */
#endif /* not EHOSTDOWN */
/* Hash table size */
#define NKVHASH (1 << 2) /* Power of two */
/* Max entries to return in one call */
#define MAX_READDIR_ENTRIES 16
/*
* default amfs_auto retrans - 1/10th seconds
*/
#define AMFS_AUTO_RETRANS(x) ((ALLOWED_MOUNT_TIME*10+5*gopt.amfs_auto_timeo[(x)])/gopt.amfs_auto_timeo[(x)] * 2)
/*
* The following values can be tuned...
*/
#define AM_TTL (300) /* Default cache period (5 min) */
#define AM_TTL_W (120) /* Default unmount interval (2 min) */
#define AM_PINGER 30 /* NFS ping interval for live systems */
#define AMFS_AUTO_TIMEO 8 /* Default amfs_auto timeout - .8s */
#define AMFS_EXEC_MAP_TIMEOUT 10 /* default 10sec exec map timeout */
/* interval between forced retries of a mount */
#define RETRY_INTERVAL 2
#ifndef ROOT_MAP
# define ROOT_MAP "\"root\""
#endif /* not ROOT_MAP */
#define ereturn(x) { *error_return = x; return 0; }
#define ereturn(x) do { *error_return = x; return 0; } while (0)
#define NEVER (time_t) 0
#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP)
# define AMD_SERVICE_NAME "amd" /* for tcpwrappers */
#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
/*
* TYPEDEFS:
@@ -210,16 +84,6 @@
typedef struct cf_map cf_map_t;
typedef struct kv kv;
typedef struct am_node am_node;
typedef struct mntfs mntfs;
typedef struct am_opts am_opts;
typedef struct am_ops am_ops;
typedef struct am_stats am_stats;
typedef struct fserver fserver;
typedef voidp wchan_t;
typedef voidp opaque_t;
/*
* Cache map operations
*/
@@ -229,28 +93,6 @@ typedef int mtime_fn(mnt_map *, char *, time_t *);
typedef int isup_fn(mnt_map *, char *);
typedef int reload_fn(mnt_map *, char *, add_fn *);
typedef int search_fn(mnt_map *, char *, char *, char **, time_t *);
typedef int task_fun(opaque_t);
typedef void cb_fun(int, int, opaque_t);
typedef void fwd_fun(voidp, int, struct sockaddr_in *,
struct sockaddr_in *, opaque_t, int);
typedef int key_fun(char *, opaque_t);
typedef void callout_fun(opaque_t);
/*
* automounter vfs/vnode operations.
*/
typedef char *(*vfs_match) (am_opts *);
typedef int (*vfs_init) (mntfs *);
typedef int (*vmount_fs) (am_node *, mntfs *);
typedef int (*vumount_fs) (am_node *, mntfs *);
typedef am_node *(*vlookup_child) (am_node *, char *, int *, int);
typedef am_node *(*vmount_child) (am_node *, int *);
typedef int (*vreaddir) (am_node *, nfscookie, nfsdirlist *, nfsentry *, u_int);
typedef am_node *(*vreadlink) (am_node *, int *);
typedef void (*vmounted) (mntfs *);
typedef void (*vumounted) (mntfs *);
typedef fserver *(*vffserver) (mntfs *);
typedef wchan_t (*vget_wchan) (mntfs *);
@@ -262,7 +104,6 @@ typedef wchan_t (*vget_wchan) (mntfs *);
struct amu_global_options {
char *arch; /* name of current architecture */
char *auto_dir; /* automounter temp dir */
int auto_attrcache; /* attribute cache timeout for auto dirs */
char *cluster; /* cluster name */
char *karch; /* kernel architecture */
char *logfile; /* amd log file */
@@ -272,33 +113,16 @@ struct amu_global_options {
char *op_sys_vendor; /* name of OS vendor ${vendor} */
char *pid_file; /* PID file */
char *sub_domain; /* local domain */
char *localhost_address; /* localhost address (NULL means use 127.0.0.1) */
char *map_defaults; /* global map /default options */
char *map_options; /* global map options */
int map_reload_interval; /* map reload interval */
char *map_type; /* global map type */
char *search_path; /* search path for maps */
char *mount_type; /* mount type for map */
char *debug_mtab_file; /* path for the mtab file during debug mode */
u_int flags; /* various CFM_* flags */
#define AMU_TYPE_NONE -1 /* for amfs_auto_{timeo,retrans,toplvl} */
#define AMU_TYPE_UDP 0 /* for amfs_auto_{timeo,retrans,toplvl} */
#define AMU_TYPE_TCP 1 /* for amfs_auto_{timeo,retrans,toplvl} */
/*
* Note: toplvl is only UDP, but we want to separate it from regular
* NFS mounts which Amd makes, because the toplvl mount is a localhost
* mount for which different timeo/retrans parameters may be desired.
*/
#define AMU_TYPE_TOPLVL 2 /* for amfs_auto_{timeo,retrans,toplvl} */
#define AMU_TYPE_MAX 3 /* for amfs_auto_{timeo,retrans,toplvl} */
int amfs_auto_retrans[AMU_TYPE_MAX]; /* NFS retransmit counter */
int amfs_auto_timeo[AMU_TYPE_MAX]; /* NFS retry interval */
int amfs_auto_retrans; /* NFS retransmit counter */
int amfs_auto_timeo; /* NFS retry interval */
int am_timeo; /* cache duration */
int am_timeo_w; /* dismount interval */
u_long portmap_program; /* amd RPC program number */
u_short preferred_amq_port; /* preferred amq service RPC port number (0 means "any") */
int portmap_program; /* amd RPC program number */
#ifdef HAVE_MAP_HESIOD
char *hesiod_base; /* Hesiod rhs */
#endif /* HAVE_MAP_HESIOD */
@@ -307,14 +131,12 @@ struct amu_global_options {
char *ldap_hostports; /* LDAP host ports */
long ldap_cache_seconds; /* LDAP internal cache - keep seconds */
long ldap_cache_maxmem; /* LDAP internal cache - max memory (bytes) */
long ldap_proto_version; /* LDAP protocol version */
#endif /* HAVE_MAP_LDAP */
#ifdef HAVE_MAP_NIS
char *nis_domain; /* YP domain name */
#endif /* HAVE_MAP_NIS */
char *nfs_proto; /* NFS protocol (NULL, udp, tcp) */
int nfs_vers; /* NFS version (0, 2, 3, 4) */
u_int exec_map_timeout; /* timeout (seconds) for executable maps */
};
/* if you add anything here, update conf.c:reset_cf_map() */
@@ -322,12 +144,10 @@ struct cf_map {
char *cfm_dir; /* /home, /u, /src */
char *cfm_name; /* amd.home, /etc/amd.home ... */
char *cfm_type; /* file, hesiod, ndbm, nis ... */
char *cfm_defaults; /* map /defaults options in amd.conf */
char *cfm_opts; /* -cache:=all, etc. */
char *cfm_search_path; /* /etc/local:/etc/amdmaps:/misc/yp */
char *cfm_tag; /* optional map tag for amd -T */
u_int cfm_flags; /* browsable_dirs? mount_type? */
struct cf_map *cfm_next; /* pointer to next in list (if any) */
};
/*
@@ -356,173 +176,52 @@ struct mnt_map {
search_fn *search; /* Function to be used for searching */
mtime_fn *mtime; /* Modify time function */
kv *kvhash[NKVHASH]; /* Cached data */
cf_map_t *cfm; /* pointer to per-map amd.conf opts, if any */
/* options available via amd conf file */
char *cf_map_type; /* file, hesiod, ndbm, nis, etc. */
char *cf_search_path; /* /etc/local:/etc/amdmaps:/misc/yp */
void *map_data; /* Map data black box */
};
/*
* Options
* Mounting a file system may take a significant period of time. The
* problem is that if this is done in the main process thread then the
* entire automounter could be blocked, possibly hanging lots of processes
* on the system. Instead we use a continuation scheme to allow mounts to
* be attempted in a sub-process. When the sub-process exits we pick up the
* exit status (by convention a UN*X error number) and continue in a
* notifier. The notifier gets handed a data structure and can then
* determine whether the mount was successful or not. If not, it updates
* the data structure and tries again until there are no more ways to try
* the mount, or some other permanent error occurs. In the mean time no RPC
* reply is sent, even after the mount is successful. We rely on the RPC
* retry mechanism to resend the lookup request which can then be handled.
*/
struct am_opts {
char *fs_glob; /* Smashed copy of global options */
char *fs_local; /* Expanded copy of local options */
char *fs_mtab; /* Mount table entry */
/* Other options ... */
char *opt_dev;
char *opt_delay;
char *opt_dir;
char *opt_fs;
char *opt_group;
char *opt_mount;
char *opt_opts;
char *opt_remopts;
char *opt_pref;
char *opt_cache;
char *opt_rfs;
char *opt_rhost;
char *opt_sublink;
char *opt_type;
char *opt_mount_type; /* "nfs" or "autofs" */
char *opt_unmount;
char *opt_umount; /* an "alias" for opt_unmount (type:=program) */
char *opt_user;
char *opt_maptype; /* map type: file, nis, hesiod, etc. */
char *opt_cachedir; /* cache directory */
char *opt_addopts; /* options to add to opt_opts */
struct continuation {
char **ivec; /* Current mount info */
am_node *mp; /* Node we are trying to mount */
char *key; /* Map key */
char *info; /* Info string */
char **xivec; /* Saved strsplit vector */
char *auto_opts; /* Automount options */
am_opts fs_opts; /* Filesystem options */
char *def_opts; /* Default automount options */
int retry; /* Try again? */
int tried; /* Have we tried any yet? */
time_t start; /* Time we started this mount */
int callout; /* Callout identifier */
};
struct am_ops {
char *fs_type; /* type of filesystems e.g. "nfsx" */
vfs_match fs_match; /* fxn: match */
vfs_init fs_init; /* fxn: initialization */
vmount_fs mount_fs; /* fxn: mount my own vnode */
vumount_fs umount_fs; /* fxn: unmount my own vnode */
vlookup_child lookup_child; /* fxn: lookup path-name */
vmount_child mount_child; /* fxn: mount path-name */
vreaddir readdir; /* fxn: read directory */
vreadlink readlink; /* fxn: read link */
vmounted mounted; /* fxn: after-mount extra actions */
vumounted umounted; /* fxn: after-umount extra actions */
vffserver ffserver; /* fxn: find a file server */
vget_wchan get_wchan; /* fxn: get the waiting channel */
int nfs_fs_flags; /* filesystem flags FS_* for nfs mounts */
#ifdef HAVE_FS_AUTOFS
int autofs_fs_flags;/* filesystem flags FS_* for autofs mounts */
#endif /* HAVE_FS_AUTOFS */
};
/*
* List of mounted filesystems
*/
struct mntfs {
qelem mf_q; /* List of mounted filesystems */
am_ops *mf_ops; /* Operations on this mountpoint */
am_opts *mf_fo; /* File opts */
char *mf_mount; /* "/a/kiska/home/kiska" */
char *mf_info; /* Mount info */
char *mf_auto; /* Automount opts */
char *mf_mopts; /* FS mount opts */
char *mf_remopts; /* Remote FS mount opts */
char *mf_loopdev; /* loop device name for /dev/loop mounts */
fserver *mf_server; /* File server */
int mf_fsflags; /* Flags FS_* copied from mf_ops->*_fs_flags */
int mf_flags; /* Flags MFF_* */
int mf_error; /* Error code from background mount */
int mf_refc; /* Number of references to this node */
int mf_cid; /* Callout id */
void (*mf_prfree) (opaque_t); /* Free private space */
opaque_t mf_private; /* Private - per-fs data */
};
/*
* List of fileservers
*/
struct fserver {
qelem fs_q; /* List of fileservers */
int fs_refc; /* Number of references to this server */
char *fs_host; /* Normalized hostname of server */
struct sockaddr_in *fs_ip; /* Network address of server */
int fs_cid; /* Callout id */
int fs_pinger; /* Ping (keepalive) interval */
int fs_flags; /* Flags */
char *fs_type; /* File server type */
u_long fs_version; /* NFS version of server (2, 3, etc.)*/
char *fs_proto; /* NFS protocol of server (tcp, udp, etc.) */
opaque_t fs_private; /* Private data */
void (*fs_prfree) (opaque_t); /* Free private data */
};
/*
* Per-mountpoint statistics
*/
struct am_stats {
time_t s_mtime; /* Mount time */
u_short s_uid; /* Uid of mounter */
int s_getattr; /* Count of getattrs */
int s_lookup; /* Count of lookups */
int s_readdir; /* Count of readdirs */
int s_readlink; /* Count of readlinks */
int s_statfs; /* Count of statfs */
};
/*
* System statistics
*/
struct amd_stats {
int d_drops; /* Dropped requests */
int d_stale; /* Stale NFS handles */
int d_mok; /* Successful mounts */
int d_merr; /* Failed mounts */
int d_uerr; /* Failed unmounts */
};
extern struct amd_stats amd_stats;
/*
* Map of auto-mount points.
*/
struct am_node {
int am_mapno; /* Map number */
mntfs *am_mnt; /* Mounted filesystem */
mntfs **am_mfarray; /* Filesystem sources to try to mount */
char *am_name; /* "kiska": name of this node */
char *am_path; /* "/home/kiska": path of this node's mount point */
char *am_link; /* "/a/kiska/home/kiska/this/that": link to sub-dir */
am_node *am_parent; /* Parent of this node */
am_node *am_ysib; /* Younger sibling of this node */
am_node *am_osib; /* Older sibling of this node */
am_node *am_child; /* First child of this node */
nfsattrstat am_attr; /* File attributes */
#define am_fattr am_attr.ns_u.ns_attr_u
int am_flags; /* Boolean flags AMF_* */
int am_error; /* Specific mount error */
time_t am_ttl; /* Time to live */
int am_timeo_w; /* Dismount wait interval */
int am_timeo; /* Cache timeout interval */
u_int am_gen; /* Generation number */
char *am_pref; /* Mount info prefix */
am_stats am_stats; /* Statistics gathering */
SVCXPRT *am_transp; /* Info for quick reply */
dev_t am_dev; /* Device number */
dev_t am_rdev; /* Remote/real device number */
#ifdef HAVE_FS_AUTOFS
autofs_fh_t *am_autofs_fh;
time_t am_autofs_ttl; /* Time to expire autofs nodes */
#endif /* HAVE_FS_AUTOFS */
};
/*
* EXTERNALS:
*/
/*
* Amq server global functions
*/
/* Amq server global functions */
extern amq_mount_info_list *amqproc_getmntfs_1_svc(voidp argp, struct svc_req *rqstp);
extern amq_mount_stats *amqproc_stats_1_svc(voidp argp, struct svc_req *rqstp);
extern amq_mount_tree_list *amqproc_export_1_svc(voidp argp, struct svc_req *rqstp);
extern amq_mount_tree_p *amqproc_mnttree_1_svc(voidp argp, struct svc_req *rqstp);
extern amq_string *amqproc_getvers_1_svc(voidp argp, struct svc_req *rqstp);
extern amq_string *amqproc_pawd_1_svc(voidp argp, struct svc_req *rqstp);
extern int *amqproc_getpid_1_svc(voidp argp, struct svc_req *rqstp);
extern int *amqproc_mount_1_svc(voidp argp, struct svc_req *rqstp);
extern int *amqproc_setopt_1_svc(voidp argp, struct svc_req *rqstp);
@@ -530,134 +229,44 @@ extern voidp amqproc_null_1_svc(voidp argp, struct svc_req *rqstp);
extern voidp amqproc_umnt_1_svc(voidp argp, struct svc_req *rqstp);
/* other external definitions */
extern am_nfs_fh *get_root_nfs_fh(char *dir);
extern am_nfs_fh *root_fh(char *dir);
extern am_node *find_ap(char *);
extern am_node *get_ap_child(am_node *, char *);
extern am_node *find_ap2(char *, am_node *);
extern bool_t xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead);
extern fserver *find_nfs_srvr(mntfs *mf);
extern int mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf);
extern int process_all_regular_maps(void);
extern cf_map_t *find_cf_map(const char *name);
extern int auto_fmount(am_node *mp);
extern int auto_fumount(am_node *mp);
extern int mount_nfs_fh(am_nfs_handle_t *fhp, char *dir, char *fs_name, char *opts, mntfs *mf);
extern int process_last_regular_map(void);
extern int set_conf_kv(const char *section, const char *k, const char *v);
extern int mount_node(opaque_t arg);
extern int unmount_mp(am_node *mp);
extern int try_mount(voidp mvp);
extern int yyparse (void);
extern void amfs_mkcacheref(mntfs *mf);
extern int amfs_mount(am_node *mp, mntfs *mf, char *opts);
extern nfsentry *make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable);
extern void amfs_auto_cont(int rc, int term, voidp closure);
extern void amfs_auto_mkcacheref(mntfs *mf);
extern void amfs_auto_retry(int rc, int term, voidp closure);
extern void assign_error_mntfs(am_node *mp);
extern am_node *next_nonerror_node(am_node *xp);
extern void flush_srvr_nfs_cache(fserver *fs);
extern void am_mounted(am_node *);
extern void mf_mounted(mntfs *mf, bool_t call_free_opts);
extern void am_unmounted(am_node *);
extern am_node *get_exported_ap(int index);
extern am_node *get_first_exported_ap(int *index);
extern am_node *get_next_exported_ap(int *index);
extern am_node *path_to_exported_ap(char *path);
extern am_node *exported_ap_alloc(void);
extern am_node *find_mf(mntfs *);
extern am_node *next_map(int *);
extern am_ops *ops_match(am_opts *, char *, char *, char *, char *, char *);
extern am_ops *ops_search(char *);
extern fserver *dup_srvr(fserver *);
extern void srvrlog(fserver *, char *);
extern int get_mountd_port(fserver *, u_short *, wchan_t);
extern void flush_nfs_fhandle_cache(fserver *);
extern mntfs *dup_mntfs(mntfs *);
extern mntfs *find_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *);
extern mntfs *locate_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *);
extern mntfs *new_mntfs(void);
extern mntfs *realloc_mntfs(mntfs *, am_ops *, am_opts *, char *, char *, char *, char *, char *);
extern void flush_mntfs(void);
extern void free_mntfs(voidp);
extern void amq_program_1(struct svc_req *rqstp, SVCXPRT *transp);
extern int background(void);
extern void deslashify(char *);
extern void do_task_notify(void);
extern int eval_fs_opts(am_opts *, char *, char *, char *, char *, char *);
extern void forcibly_timeout_mp(am_node *);
extern void free_map(am_node *);
extern void free_opts(am_opts *);
extern void free_srvr(fserver *);
extern int fwd_init(void);
extern int fwd_packet(int, char *, int, struct sockaddr_in *, struct sockaddr_in *, opaque_t, fwd_fun *);
extern void fwd_reply(void);
extern void get_args(int argc, char *argv[]);
extern wchan_t get_mntfs_wchan(mntfs *mf);
extern void host_normalize(char **);
extern void init_map(am_node *, char *);
extern void ins_que(qelem *, qelem *);
extern void insert_am(am_node *, am_node *);
extern int make_nfs_auth(void);
extern void make_root_node(void);
extern void map_flush_srvr(fserver *);
extern void mapc_add_kv(mnt_map *, char *, char *);
extern mnt_map *mapc_find(char *, char *, const char *);
extern void mapc_free(opaque_t);
extern int mapc_keyiter(mnt_map *, key_fun, opaque_t);
extern void mapc_reload(void);
extern int mapc_search(mnt_map *, char *, char **);
extern void mapc_showtypes(char *buf, size_t l);
extern int mapc_type_exists(const char *type);
extern void mk_fattr(nfsfattr *, nfsftype);
extern int mount_auto_node(char *, opaque_t);
extern int mount_automounter(int);
extern int mount_exported(void);
extern void mp_to_fh(am_node *, am_nfs_fh *);
extern void new_ttl(am_node *);
extern void nfs_quick_reply(am_node *mp, int error);
extern void normalize_slash(char *);
extern void ops_showamfstypes(char *buf, size_t l);
extern void ops_showfstypes(char *outbuf, size_t l);
extern void rem_que(qelem *);
extern void reschedule_timeout_mp(void);
extern void restart(void);
extern void restart_automounter_nodes(void);
extern int root_keyiter(key_fun *, opaque_t);
extern void flush_srvr_nfs_cache(void);
extern void free_continuation(struct continuation *cp);
extern void mf_mounted(mntfs *mf);
extern void quick_reply(am_node *mp, int error);
extern void root_newmap(const char *, const char *, const char *, const cf_map_t *);
extern void run_task(task_fun *, opaque_t, cb_fun *, opaque_t);
extern void sched_task(cb_fun *, opaque_t, wchan_t);
extern int softclock(void);
extern int timeout(u_int, void (*fn)(opaque_t), opaque_t);
extern void timeout_mp(opaque_t);
extern void untimeout(int);
extern void umount_exported(void);
extern int valid_key(char *);
extern void wakeup(wchan_t);
extern void wakeup_srvr(fserver *);
extern void wakeup_task(int, int, wchan_t);
#define SIZEOF_PID_FSNAME (16 + MAXHOSTNAMELEN)
extern char pid_fsname[SIZEOF_PID_FSNAME]; /* "kiska.southseas.nz:(pid%d)" */
#define SIZEOF_HOSTD (2 * MAXHOSTNAMELEN + 1)
extern char hostd[SIZEOF_HOSTD]; /* Host+domain */
#define SIZEOF_OPTS 256 /* used for char opts[] and preopts[] */
/*
* Global variables.
*/
/* amd global variables */
extern FILE *yyin;
extern SVCXPRT *current_transp; /* For nfs_quick_reply() */
extern SVCXPRT *nfs_program_2_transp; /* For quick_reply() */
extern char *conf_tag;
#define SIZEOF_UID_STR 12
#define SIZEOF_GID_STR 12
extern char *opt_gid, gid_str[SIZEOF_GID_STR];
extern char *opt_uid, uid_str[SIZEOF_UID_STR];
extern int NumChildren;
extern char *opt_gid;
extern char *opt_uid;
extern int NumChild;
extern int fwd_sock;
extern int select_intr_valid;
extern int immediate_abort; /* Should close-down unmounts be retried */
extern int usage;
extern int use_conf_file; /* use amd configuration file */
extern int task_notify_todo; /* Task notifier needs running */
extern jmp_buf select_intr;
extern qelem mfhead;
extern struct am_opts fs_static; /* copy of the options to play with */
extern struct amu_global_options gopt; /* where global options are stored */
extern time_t do_mapc_reload; /* Flush & reload mount map cache */
extern time_t next_softclock; /* Time to call softclock() */
#ifdef HAVE_SIGACTION
extern sigset_t masked_sigs;
@@ -665,88 +274,16 @@ extern sigset_t masked_sigs;
#if defined(HAVE_AMU_FS_LINK) || defined(HAVE_AMU_FS_LINKX)
extern char *amfs_link_match(am_opts *fo);
extern int amfs_link_fumount(mntfs *mf);
#endif /* defined(HAVE_AMU_FS_LINK) || defined(HAVE_AMU_FS_LINKX) */
#ifdef HAVE_FS_AUTOFS
extern int amd_use_autofs;
#ifdef HAVE_AMU_FS_NFSL
extern char *nfs_match(am_opts *fo);
#endif /* HAVE_AMU_FS_NFSL */
extern int autofs_get_fh(am_node *mp);
extern void autofs_release_fh(am_node *mp);
extern void autofs_get_mp(am_node *mp);
extern void autofs_release_mp(am_node *mp);
extern void autofs_add_fdset(fd_set *readfds);
extern int autofs_handle_fdset(fd_set *readfds, int nsel);
extern void autofs_mounted(am_node *mp);
extern void autofs_mount_succeeded(am_node *mp);
extern void autofs_mount_failed(am_node *mp);
extern int autofs_umount_succeeded(am_node *mp);
extern int autofs_umount_failed(am_node *mp);
extern int autofs_mount_fs(am_node *mp, mntfs *mf);
extern int autofs_umount_fs(am_node *mp, mntfs *mf);
extern void autofs_get_opts(char *opts, size_t l, autofs_fh_t *fh);
extern int autofs_compute_mount_flags(mntent_t *);
extern void autofs_timeout_mp(am_node *);
extern int create_autofs_service(void);
extern int destroy_autofs_service(void);
#endif /* HAVE_FS_AUTOFS */
/**************************************************************************/
/*** Generic file-system types, implemented as part of the native O/S. ***/
/**************************************************************************/
/*
* Loopback File System
* Many systems can't support this, and in any case most of the
* functionality is available with Symlink FS.
*/
#ifdef HAVE_FS_LOFS
extern am_ops lofs_ops;
extern int mount_lofs(char *mntdir, char *fs_name, char *opts, int on_autofs);
#endif /* HAVE_FS_LOFS */
/*
* CD-ROM File System (CD-ROM)
* (HSFS: High Sierra F/S on some machines)
* Many systems can't support this, and in any case most of the
* functionality is available with program FS.
*/
#ifdef HAVE_FS_CDFS
extern am_ops cdfs_ops;
#endif /* HAVE_FS_CDFS */
/*
* PC File System (MS-DOS)
* Many systems can't support this, and in any case most of the
* functionality is available with program FS.
*/
#ifdef HAVE_FS_PCFS
extern am_ops pcfs_ops;
#endif /* HAVE_FS_PCFS */
/*
* Caching File System (Solaris)
*/
#ifdef HAVE_FS_CACHEFS
extern am_ops cachefs_ops;
#endif /* HAVE_FS_CACHEFS */
/*
* Network File System
* Good, slow, NFS V.2.
*/
#ifdef HAVE_FS_NFS
extern am_ops nfs_ops; /* NFS */
extern fserver *find_nfs_srvr (mntfs *);
extern qelem nfs_srvr_list;
#endif /* HAVE_FS_NFS */
/*
* Un*x File System
* Normal local disk file system.
*/
#ifdef HAVE_FS_UFS
extern am_ops ufs_ops; /* Un*x file system */
#endif /* HAVE_FS_UFS */
#if defined(HAVE_FS_NFS3) && !defined(HAVE_XDR_MOUNTRES3)
extern bool_t xdr_mountres3(XDR *xdrs, mountres3 *objp);
#endif /* defined(HAVE_FS_NFS3) && !defined(HAVE_XDR_MOUNTRES3) */
/* Unix file system (irix) */
#ifdef HAVE_FS_XFS
@@ -758,110 +295,4 @@ extern am_ops xfs_ops; /* Un*x file system */
extern am_ops efs_ops; /* Un*x file system */
#endif /* HAVE_FS_EFS */
/**************************************************************************/
/*** Automounter file-system types, implemented by amd. ***/
/**************************************************************************/
/*
* Root AMD File System
*/
extern am_ops amfs_root_ops; /* Root file system */
/*
* Generic amfs helper methods
*/
extern am_node *amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op);
extern am_node *amfs_generic_mount_child(am_node *ap, int *error_return);
extern int amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count);
extern int amfs_generic_umount(am_node *mp, mntfs *mf);
extern void amfs_generic_mounted(mntfs *mf);
extern char *amfs_generic_match(am_opts *fo);
extern fserver *amfs_generic_find_srvr(mntfs *);
/*
* Automount File System
*/
#ifdef HAVE_AMU_FS_AUTO
extern am_ops amfs_auto_ops; /* Automount file system (this!) */
#endif /* HAVE_AMU_FS_AUTO */
/*
* Toplvl Automount File System
*/
#ifdef HAVE_AMU_FS_TOPLVL
extern am_ops amfs_toplvl_ops; /* Toplvl Automount file system */
extern int amfs_toplvl_mount(am_node *mp, mntfs *mf);
extern int amfs_toplvl_umount(am_node *mp, mntfs *mf);
#endif /* HAVE_AMU_FS_TOPLVL */
/*
* Direct Automount File System
*/
#ifdef HAVE_AMU_FS_DIRECT
extern am_ops amfs_direct_ops; /* Direct Automount file system (this too) */
#endif /* HAVE_AMU_FS_DIRECT */
/*
* Error File System
*/
#ifdef HAVE_AMU_FS_ERROR
extern am_ops amfs_error_ops; /* Error file system */
extern am_node *amfs_error_lookup_child(am_node *mp, char *fname, int *error_return, int op);
extern am_node *amfs_error_mount_child(am_node *ap, int *error_return);
extern int amfs_error_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count);
#endif /* HAVE_AMU_FS_ERROR */
/*
* NFS mounts with local existence check.
*/
#ifdef HAVE_AMU_FS_NFSL
extern am_ops amfs_nfsl_ops; /* NFSL */
#endif /* HAVE_AMU_FS_NFSL */
/*
* Multi-nfs mounts.
*/
#ifdef HAVE_AMU_FS_NFSX
extern am_ops amfs_nfsx_ops; /* NFSX */
#endif /* HAVE_AMU_FS_NFSX */
/*
* NFS host - a whole tree.
*/
#ifdef HAVE_AMU_FS_HOST
extern am_ops amfs_host_ops; /* NFS host */
#endif /* HAVE_AMU_FS_HOST */
/*
* Program File System
* This is useful for things like RVD.
*/
#ifdef HAVE_AMU_FS_PROGRAM
extern am_ops amfs_program_ops; /* Program File System */
#endif /* HAVE_AMU_FS_PROGRAM */
/*
* Symbolic-link file system.
* A "filesystem" which is just a symbol link.
*/
#ifdef HAVE_AMU_FS_LINK
extern am_ops amfs_link_ops; /* Symlink FS */
#endif /* HAVE_AMU_FS_LINK */
/*
* Symbolic-link file system, which also checks that the target of
* the symlink exists.
* A "filesystem" which is just a symbol link.
*/
#ifdef HAVE_AMU_FS_LINKX
extern am_ops amfs_linkx_ops; /* Symlink FS with existence check */
#endif /* HAVE_AMU_FS_LINKX */
/*
* Union file system
*/
#ifdef HAVE_AMU_FS_UNION
extern am_ops amfs_union_ops; /* Union FS */
#endif /* HAVE_AMU_FS_UNION */
#endif /* not _AMD_H */
Loaded 100 of 11109 files, more files were not shown because too many files have changed in this diff. Show more