From e9e35680bf651139ee6ce153e0aaa7308ab01ca5 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 28 Mar 2009 20:40:32 +0100 Subject: provide more details for PATH_MAX --- unsorted/PortingIssues.mdwn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unsorted/PortingIssues.mdwn b/unsorted/PortingIssues.mdwn index ff63bda3..03980ef3 100644 --- a/unsorted/PortingIssues.mdwn +++ b/unsorted/PortingIssues.mdwn @@ -51,15 +51,15 @@ If you get Bad File Descriptor error when trying to read from a file (or accessi ## `PATH_MAX` / `MAX_PATH` / `MAXPATHLEN` -Every unconditionalized use of `PATH_MAX`, `MAX_PATH` or `MAXPATHLEN` is a POSIX incompatibility. If there is no upper limit on the length of a path (as its the case for GNU), this symbol is not defined in any header file. Instead, you need to either use a different implementation that does not rely on the length of a string or use `sysconf()` to query the length at runtime. If `sysconf()` returns -1, you have to use `realloc()` to allocate the needed memory dynamically. +Every unconditionalized use of `PATH_MAX`, `MAX_PATH` or `MAXPATHLEN` is a POSIX incompatibility. If there is no upper limit on the length of a path (as its the case for GNU), this symbol is not defined in any header file. Instead, you need to either use a different implementation that does not rely on the length of a string or use `sysconf()` to query the length at runtime. If `sysconf()` returns -1, you have to use `realloc()` to allocate the needed memory dynamically. Usually it is thus simpler to just use dynamic allocation. Sometimes the amount is actually known. Else, a geometrically growing loop can be used: for instance, see [Alioth patch](http://alioth.debian.org/tracker/download.php/30628/410472/303735/1575/cpulimit-path-max-fix.patch). Note that in some cases there are GNU extensions that just work fine: when the `__GLIBC__` macro is defined, `getcwd()` calls can be just replaced by `get_current_dir_name()` calls. ## `ARG_MAX` -Same as `PATH_MAX`. There is no limit on the number of arguments. +Same rationale as `PATH_MAX`. There is no limit on the number of arguments. ## `IOV_MAX` -Same as `PATH_MAX`. There is no limit on the number of iovec items. +Same rationale as `PATH_MAX`. There is no limit on the number of iovec items. ## `MAXHOSTNAMELEN` -- cgit v1.2.3