aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSean Farley <scf@FreeBSD.org>2007-07-04 00:00:41 +0000
committerSean Farley <scf@FreeBSD.org>2007-07-04 00:00:41 +0000
commit2966d28c322dcfa4b9db2558da0b91839e7798b9 (patch)
tree423c7d016f87f6541b9ef8231a14f8b267bc5d5e /include
parentf6c1ecca50279edac3eb930eecd72ff23bfd85dc (diff)
downloadsrc-2966d28c322dcfa4b9db2558da0b91839e7798b9.tar.gz
src-2966d28c322dcfa4b9db2558da0b91839e7798b9.zip
Significantly reduce the memory leak as noted in BUGS section for
setenv(3) by tracking the size of the memory allocated instead of using strlen() on the current value. Convert all calls to POSIX from historic BSD API: - unsetenv returns an int. - putenv takes a char * instead of const char *. - putenv no longer makes a copy of the input string. - errno is set appropriately for POSIX. Exceptions involve bad environ variable and internal initialization code. These both set errno to EFAULT. Several patches to base utilities to handle the POSIX changes from Andrey Chernov's previous commit. A few I re-wrote to use setenv() instead of putenv(). New regression module for tools/regression/environ to test these functions. It also can be used to test the performance. Bump __FreeBSD_version to 700050 due to API change. PR: kern/99826 Approved by: wes Approved by: re (kensmith)
Notes
Notes: svn path=/head/; revision=171195
Diffstat (limited to 'include')
-rw-r--r--include/stdlib.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index 98fe8b7756c6..98cb465c8f33 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -161,7 +161,7 @@ void _Exit(int) __dead2;
int posix_memalign(void **, size_t, size_t); /* (ADV) */
int rand_r(unsigned *); /* (TSF) */
int setenv(const char *, const char *, int);
-void unsetenv(const char *);
+int unsetenv(const char *);
#endif
/*
@@ -197,7 +197,7 @@ long mrand48(void);
long nrand48(unsigned short[3]);
int posix_openpt(int);
char *ptsname(int);
-int putenv(const char *);
+int putenv(char *);
long random(void);
char *realpath(const char *, char resolved_path[]);
unsigned short