I am sponsoring the following case for Ed Pilatowicz as approved
automatic, with a requested release binding of minor.
-Chris
Template Version: @(#)sac_nextcase %I% %G% SMI
This information is Copyright 2009 Sun Microsystems
1. Introduction
1.1. Project/Component Working Name:
ddi_strdup
1.2. Name of Document Author/Supplier:
Author: Edward Pilatowicz
1.3 Date of This Document:
11 January, 2009
4. Technical Description
Add ddi_strdup(9F), strdup(9F), and strfree(9F) to the DDI
PROBLEM:
Currently there are 6 version of strfree() and 18 versions of
strdup() in the kernel.
SOLUTION:
The following interfaces will be introduced as Committed in
<sys/sunddi.h> when _KERNEL is defined.
char *ddi_strdup(const char *str, int flag);
char *strdup(const char *str);
void strfree(char *str);
This is targeting Nevada/OpenSolaris.
No patch binding is requested since introduction of this change
in an update could break compilation of existing source which
defines private versions of these commonly used functions.
TECHNICAL DESCRIPTION:
ddi_strdup(9F) is a simple wrapper around kmem_alloc() and it
will allow the caller to specify KM_SLEEP or KM_NOSLEEP.
strdup(9F) will invoke ddi_strdup(9F) with the KM_SLEEP flag.
The behavior of these functions is undefined if 'str' is NULL.
strfree() is not limited to freeing strings allocated by
strdup(), it can accept any kmem_{z}alloc()'d memory with a
size of "strlen(str) + 1".
These functions will be documented in a new man page,
string(9F). For consistency with string(3C), the new
string(9F) man page will also subsume contents of strchr(9F),
strcmp(9F), strspn(9F), and strlen(9F).
6. Resources and Schedule
6.4. Steering Committee requested information
6.4.1. Consolidation C-team Name:
ON
6.5. ARC review type: Automatic
6.6. ARC Exposure: open