From owner-freebsd-arch@FreeBSD.ORG Thu Dec 4 18:24:10 2008 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30FC71065672 for ; Thu, 4 Dec 2008 18:24:10 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from mail.solomo.de (mail.solomo.de [85.214.49.72]) by mx1.freebsd.org (Postfix) with ESMTP id E38D68FC19 for ; Thu, 4 Dec 2008 18:24:09 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from localhost (localhost [127.0.0.1]) by mail.solomo.de (Postfix) with ESMTP id 6AB763F48C for ; Thu, 4 Dec 2008 19:13:43 +0100 (CET) X-Virus-Scanned: amavisd-new at vistream.de Received: from mail.solomo.de ([127.0.0.1]) by localhost (mail.solomo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hWXFDHWVrZa8 for ; Thu, 4 Dec 2008 19:13:40 +0100 (CET) Received: from nibbler.lan (i53876182.versanet.de [83.135.97.130]) by mail.solomo.de (Postfix) with ESMTPA id A25613F40A for ; Thu, 4 Dec 2008 19:13:40 +0100 (CET) Message-ID: <49381DD4.2000506@kasimir.com> Date: Thu, 04 Dec 2008 19:13:40 +0100 From: Florian Smeets User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3pre) Gecko/20081204 Shredder/3.0b2pre MIME-Version: 1.0 To: freebsd-arch@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Adding strndup(3) to libc viable/useful? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 18:24:10 -0000 Hi, first of all i hope arch is the correct place to discuss this. While porting an application to FreeBSD i found that FreeBSDs libc does not have strndup. NetBSD added this about 2 years ago. A port of this to FreeBSD was very easy. There are 13 ports in the ports tree right now that patch in strndup via a patch in the files/ dir, well actually 12 bring there own version of strndup and one replaces it with a call to malloc/strncpy. Would it make sense to add this to our libc? A patch which does this is available here at http://webmail.solomo.de/~flo/strndup.patch I don't know if there is such a thing as minimum number of ports to require a function so that it can be added to the base system... Any feedback appreciated. Cheers, Florian