Commit Graph

14213 Commits

Author SHA1 Message Date
njoly
4c968434a3 Make setenv(3) follow the standard, by rejecting invalid strings. It
now fails with EINVAL errno when variable is NULL, empty or contains
an `=' character; or value is NULL.

Adjust the man page accordingly, and exercize them in the existing
environment testcase.
2010-10-16 11:23:41 +00:00
skrll
e6cdac9c4b Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
2010-10-16 10:27:06 +00:00
christos
f207e61c08 replace `` with $(). Hopefully with enough examples around people will
forget about ``.
2010-10-12 12:57:51 +00:00
christos
e6dabc3c76 PR/43961: YAMAMOTO Takashi: uninitialized variable in termcap.c
Remove dead code.
2010-10-12 12:49:27 +00:00
manu
f4f951a0c1 Remove code supporting SOCK_STREAM, as SOCK_DGRAM works fine 2010-10-11 05:37:58 +00:00
manu
f782f0a9e3 FUSE filesystems' readlink returns a resolved link with a NUL trailing
character, and PUFFS do not want it. This fixes this bug, that returned
stat the informations for x instead of reporting ENOENT:
mkdir x && ln x z && stat -x z/whatever/you/want
2010-10-11 01:52:05 +00:00
manu
5b646d774b - fix access control: pcn->pcn_cred is not user credentials
- Keep track of file generation
- remove size tracking in pnd_size, we have it in pn_va.va_size
2010-10-11 01:08:26 +00:00
enami
3cef3e6eba The was is not an argument but simply a part of sentense. 2010-10-07 00:14:14 +00:00
jym
f15c6971d1 Import PAE support for kvm(3):
- add kvm_i386pae.c (used for PAE memory translations), and update Makefile
  for libkvm build.
- in pdppaddr: pass a flag to indicate PAE mode. Use a bit ignored
  by the MMU. Mask address with PG_FRAME to avoid side effects.

Tested with vmstat(1)/netstat(1) to debug core files of PAE and !PAE
kernels. Older kernel dumps will default to native i386 (!PAE) mode.

XXX Currently, savecore(8) will fail to dump a PAE kernel in a !PAE
    environment (and reciprocally). So you need to sync and reboot
    with a kernel of the same mode as the one that crashed. Once the dump
    is successful, this does not matter anymore.
2010-10-05 23:48:16 +00:00
enami
4a94dc0b8f Avoid unnecessary malloc(). Since __findenv() kindly treats
equal sign as an end of string, we can pass the string of
form "key=value" to lookup "key".
2010-10-05 02:23:38 +00:00
manu
3a9497b97a - delete an obsoelte comment about inactive
- remove a test for getattr return field that was never filled
- correctly send filehandle and filehandle flags for getaattr
2010-10-04 03:56:24 +00:00
manu
2ff0ea03a7 - Correctly handle rename whith overwritten destination
- Keep track of file name to avoid lookups when we can. This makes sure we
  do not have two cookies for the same inode, a situation that cause wreak
  havoc when we come to remove or rename a node.
- Do not use PUFFS_FLAG_BUILDPATH at all, since we now track file names
- In open, queue requests after checking for access, as there is no merit
  to queue a will-be-denied request while we can deny it immediatly
- request reclaim of removed nodes at inactive stage
2010-10-03 05:46:47 +00:00
tron
ae557324e5 Restore binary compatibility with applications which use putenv(3)
on constant strings (e.g. postdrop(1)):
- Don't write to the environment string passed to putenv(3).
- Don't overwrite the value of an existing environment string
  unless the memory was actually allocated by setenv(3).
2010-10-02 16:56:03 +00:00
tron
c3bcf19cf7 Make sure that all extra elements of the environment vector are set
to NULL. This stop su(1) from crashing.
2010-10-02 10:51:07 +00:00
tron
12c10b36d2 Remember that we didn't malloc() memory for an environment variable
if it has been set via putenv(3).
2010-10-02 10:05:55 +00:00
wiz
732dd678dd Fix a typo, remove trailing whitespace. 2010-10-01 20:57:50 +00:00
christos
7acc3301d8 make putenv POSIX compliant. 2010-10-01 20:11:32 +00:00
tron
2445ce72d2 Be slightly more careful about freeing memory allocated for environment
variables: only free memory if the current value points to the same
memory area as the allocated block. This will prevent crashes if an
application changes the order of the environment array.

Unfortunately this is still not enough to stop zsh 4.2.* from crashing.
zsh 4.3.* works fine before and after this change.
2010-09-30 12:41:33 +00:00
manu
f7174423c5 = Open files =
- Restore open on our own in fsycn and readdir, as the node may not already
be open, and FUSE really wants it to be. No need to close immediatly, it
can be done at inactive time.

= Write operations =
- fix a nasty bug that corrupted files on write (written added twice)
- Keep track of file size in order to honour PUFFS_IO_APPEND

= many fixes in rename =
- handler overwritten nodes correctly
- wait for all operations on the node to drain before doing rename, as
filesystems may not cope with operations on a moving file.
- setback PUFFS_SETBACK_INACT_N1 cannot be used from rename, we therefore
miss the inactive time for an overwritten node. This bounds us to give up
PUFFS_KFLAG_IAONDEMAND.

= Removed files =
- forbid most operations on a removed node, return ENOENT
- setback PUFFS_SETBACK_NOREF_N1 at inactive stage to cause removed
file reclaim

= Misc =
- Update outdated ARGSUSED for lint
- Fix a memory leak (puffs_pn_remove instead of puffs_pn_put)
- Do not use PUFFS_FLAG_BUILDPATH except for debug output. It makes the
lookup code much simplier.
2010-09-29 08:01:10 +00:00
enami
be59ef257e If new length is exactly equals to the current length,
there is nothing to do.
2010-09-29 00:44:04 +00:00
enami
248290ef3a Don't put space before close paren. 2010-09-29 00:40:17 +00:00
enami
abfd061908 Add missing period at the end of sentense. 2010-09-28 00:39:56 +00:00
tnozaki
9ef74dfbcf validate flags/oflags from __sflag() befere call __sfp().
reviewed by enami-san, thanks.
2010-09-27 17:08:29 +00:00
tnozaki
6d102a3218 fix off-by-one, pointed out by enami-san, thanks! 2010-09-27 16:50:13 +00:00
jym
8bb0c87c7e Define KREAD() inside kvm_private.h, for reusability. 2010-09-26 22:28:05 +00:00
yamt
ab5972b02c fix rewinddir on nfs. fix PR/42879 (and probably PR/40229.) 2010-09-26 02:26:59 +00:00
christos
0588f13b3b be more conservative about allocing. 2010-09-25 19:31:51 +00:00
tron
ed5e497e60 Remember the correct pointer which we will free later. 2010-09-25 19:10:37 +00:00
tron
1f5de17d4a Unlock the environment lock if __alocenv() fails. 2010-09-25 18:37:24 +00:00
tron
5cdca2e600 Remember memory used by allocated environment variables instead of
using a bitmap. This deals with the case where a variable is first
set via setenv(3) or putenv(3), then overwritten by changing
"environ" directory and afterwards overwritten with setenv(3) again.

This stops "zsh" from crashing under NetBSD-current.

Code reviewed by Christos Zoulas.
2010-09-25 18:11:40 +00:00
tron
ac440cccfd Change last commit to Use "ptrdiff_t" instead of "intptr_t" because the
former is more appropriate in this case.
2010-09-25 14:00:30 +00:00
tron
abf0c843b2 Add explicit cast to fix lint error on 32bit platforms. 2010-09-25 13:45:11 +00:00
wiz
14087bca56 Remove trailing whitespace, merge error sections for same error, nits. 2010-09-25 09:44:08 +00:00
uwe
46b35128cb Make groff happy. 2010-09-25 01:19:39 +00:00
christos
97fddff649 add man page as promised. 2010-09-24 21:50:56 +00:00
matt
3edad85883 If not using O32 on mips, we need to read ELF64 symbols too. 2010-09-24 15:57:15 +00:00
christos
da3a4052e4 protect the __allocenv call with the mutex; from Enami 2010-09-24 14:34:44 +00:00
christos
f6033a77ae Fix memory leaks; thanks Enami! 2010-09-24 14:31:15 +00:00
tnozaki
93b7363c93 add fmemopen(3) derrived from POSIX:2008.
libc minor bump.
2010-09-24 09:21:53 +00:00
christos
7db74b9a82 Use a bit array to keep track of malloced environment entries so we can
free them.
2010-09-23 17:30:49 +00:00
christos
e957123b85 PR/43899: Nicolas Joly: setenv(3)/unsetenv(3) memory leak.
Partial fix: Don't allocate a new string if the length is equal to the
old length, because presumably the old string was also nul terminated
so it has the extra byte needed.
The real fix is to keep an adjunct array of bits, one for each environment
variable and keep track if the entry was allocated or not so that we can
free it in unsetenv.
2010-09-23 16:02:41 +00:00
manu
bcf6f2f32a == file close operations ==
- use PUFFS_KFLAG_WTCACHE to puffs_init so that all writes are
immediatly send to the filesystem, and we do not have anymore write
after inactive. As a consequence, we can close files at inactive
stage, and there is not any concern left with files opened at
create time. We also do not have anymore to open ourselves in readdir and
fsync.

- Fsync on close (inactive stage). That makes sure we will not need to
do these operations once the file is closed (FUSE want an open file).
short sircuit the request that come after the close, bu not fsinc'ing
closed files,

- Use PUFFS_KFLAG_IAONDEMAND to get less inactive calls

== Removed nodes ==
- more ENOENT retunred for operations on removed node (but there
are probably some still missing): getattr, ooen, setattr, fsync

- set PND_REMOVE before sending the UNLINK/RMDIR operations so that we avoid
races during UNLINK completion. Also set PND_REMOVED on node we overwirte
in rename

== Filehandle fixes ==
- queue open operation to avoid getting two fh for one file

- set FH in getattr, if the file is open

- Just requires a read FH for fsyncdir, as we always opendir in read
mode. Ok, this is misleading :-)

== Misc ==
- do not set FUSE_FATTR_ATIME_NOW in setattr, as we provide the time

- short circuit nilpotent operations in setattr

- add a filename diagnostic flag to dump file names
2010-09-23 16:02:34 +00:00
njoly
abdcf63ade Add empty line in ERRORS section. 2010-09-23 12:49:31 +00:00
wiz
98890d79a7 Bump date for O_DIRECTORY, more markup, merge two error sections. 2010-09-22 17:58:09 +00:00
roy
215c5976aa Our API just uses typedefs, so don't use the struct symbol which will avoid
any potential conflicts with userland.
2010-09-22 06:10:51 +00:00
chs
38b9dc3505 implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
2010-09-21 19:26:18 +00:00
jym
962a341df6 Change kvm_pa2off() and kvm_kvatop() prototypes (private to kvm(3)):
-int     _kvm_kvatop(kvm_t *, u_long, u_long *);
-off_t   _kvm_pa2off(kvm_t *, u_long);
+int     _kvm_kvatop(kvm_t *, vaddr_t, paddr_t *);
+off_t   _kvm_pa2off(kvm_t *, paddr_t);

Basically, use vaddr_t for VA and paddr_t for PA. In addition, for variables
representing addresses, use paddr_t or vaddr_t, depending on the context.

For most arches, vaddr_t and paddr_t are equivalent to unsigned long. However,
the change was needed for exotic situations, like i386 PAE, were unsigned long
is not suitable for PA which are 64 bits long. As this required a complete
change of the function prototypes, all arches had to be adapted accordingly.

Core files from before this commit should still work with the new code; I did
not see any direct dependency between core's structure and kvatop/pa2off.

The change was compile tested for all arches, as it impacts all of them.

See also:

http://mail-index.netbsd.org/current-users/2010/09/07/msg014249.html
2010-09-20 23:23:16 +00:00
christos
fda2d7ca9f deal with infinity on the vax. 2010-09-20 17:51:38 +00:00
christos
c80a34bc23 no more ieee ifdefs 2010-09-20 16:55:20 +00:00
christos
0a9ef41cbe get rid of ieee dependencies. 2010-09-20 16:53:30 +00:00