X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; q=dns; s=default; b=TU 51gM/Z1vIC4p641uxCjj9BdWRWqCDDP5HBLQxVVIoSeVKZBai6p+Ibhr0vWayAWm rUHGGoq28XsGiORJrDi4nodHvbOhSaAsNB+q9HwkXGMzP7ZGVltsz2L0A3CX9e+Y C28uKC2G67BLYt0LGijxnYW8AXuIKfV/7cK5f26R8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; s=default; bh=+ZMneWjo qyr7jeOlcw0V4qatnus=; b=SB0+/s+U+BxRtYk6cLbNp6mmzhLtTyESYqfHJ++Y 5Wq5MO6yc3VP3LhF1VEEdR3Vz9sxecq1MktoJx/HompYyQsJBx755oAIIzYTJMpm uH0ohGN89zaC6jGp6M5K3/T+QVzovUnDMDIXxDnAnuUSgpyD5QJ7lN7zwQZLHAxt 7YQ= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2762, UD:ca, sk:systema, reserved X-HELO: mail-io0-f171.google.com MIME-Version: 1.0 X-Received: by 10.107.136.226 with SMTP id s95mr34083769ioi.38.1451877112531; Sun, 03 Jan 2016 19:11:52 -0800 (PST) In-Reply-To: References: Date: Mon, 4 Jan 2016 11:11:52 +0800 Message-ID: Subject: Re: Issues in utmp/utmpx headers From: David Lee To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Sorry I am totally unfamiliar with Cygwin internals, here are some related questions: 1. how does one test a code path that involves a failed syscall (strdup() in this case, but can be others) in cygwin dll? 2. If the call to strdup() fails, I want to debug_print() the errno value set by strdup(). Do I have to save errno before debug_print() that and restore afterwards? 3. Does the instruction from 6.21 in https://cygwin.com/faq/faq.html#faq.prog5asdramming.building-cygwin generates a debugging dll (i.e. contains debug symbols usable by gdb)? If not, what modifications are needed to create one? Thanks. On 29 December 2015 at 13:16, Brian Inglis wrote: >> > David Lee gmail.com> writes: >> >> While trying to port bsdgames to Cygwin I spotted the following issues: >> >> (1) In /usr/include/utmpx.h, utmpxname() is declared a void function. >> >> Should it return int? >> >> (2) In /usr/include/sys/utmp.h, utmpname() is declared a void >> >> function. Should it return int? >> >> (3) _PATH_UTMPX is not defined in any system headers. > >> On 28 December 2015 at 03:02, Brian Inglis >> systematicsw.ab.ca> wrote: >> > Search packages for missing files e.g. >> > https://cygwin.com/cgi-bin2/package-grep.cgi?grep=utmp.h&arch=x86_64 >> > brings up package cygwin-devel and cygwin32. >> > Download and run setup and select cygwin-devel to install the headers and >> > libraries. > > David Lee gmail.com> writes: >> The issue isn't missing, not-installed packages. The issues are (1) >> some function declaration seem wrong; and (2) a constant is missing. > > Pardon my reading comprehension bork! > > The utmpname implementation in newlib-cygwin/winsup/cygwin/syscalls.cc > could probably be improved to: avoid a memory leak; return -1 if > strdup fails, zero otherwise; default the path if a null pointer or string > argument is passed. > That would also fix utmpxname which is an alias. > Such a change would have little likely impact on downstream apps, but could > produce warnings about ignoring return values. > > Unfortunately there appears to be no standard defined names to access the > default file name although GNU and Cygwin provide UTMP_FILE and UTMPX_FILE; > GNU also provide UTMP_FILENAME and UTMPX_FILENAME. > _PATH_UTMP and _PATH_UTMPX are implementation reserved names which may or > may not be provided, though adding the latter in paths.h would be trivial. > > As the developers say, patches always welcome. > > > > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple