public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Issues in utmp/utmpx headers
@ 2015-12-27  2:58 David Lee
  2015-12-27 19:02 ` Brian Inglis
  2016-01-07 14:41 ` Corinna Vinschen
  0 siblings, 2 replies; 8+ messages in thread
From: David Lee @ 2015-12-27  2:58 UTC (permalink / raw)
  To: cygwin

Hi all,

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.

Thanks

David Lee

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Issues in utmp/utmpx headers
  2015-12-27  2:58 Issues in utmp/utmpx headers David Lee
@ 2015-12-27 19:02 ` Brian Inglis
  2015-12-28  3:24   ` David Lee
  2016-01-07 14:41 ` Corinna Vinschen
  1 sibling, 1 reply; 8+ messages in thread
From: Brian Inglis @ 2015-12-27 19:02 UTC (permalink / raw)
  To: cygwin

David Lee <mailtolky <at> 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.

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.


--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Issues in utmp/utmpx headers
  2015-12-27 19:02 ` Brian Inglis
@ 2015-12-28  3:24   ` David Lee
  2015-12-29  5:16     ` Brian Inglis
  0 siblings, 1 reply; 8+ messages in thread
From: David Lee @ 2015-12-28  3:24 UTC (permalink / raw)
  To: cygwin

Hi,

The issue isn't missing, not-installed packages. The issues are (1)
some function declaration seem wrong; and (2) a constant is missing.

Thanks.

David Lee

On 28 December 2015 at 03:02, Brian Inglis
<Brian.Inglis@systematicsw.ab.ca> wrote:
> David Lee <mailtolky <at> 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.
>
> 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.
>
>
> --
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Issues in utmp/utmpx headers
  2015-12-28  3:24   ` David Lee
@ 2015-12-29  5:16     ` Brian Inglis
  2016-01-04  3:11       ` David Lee
  2016-01-07 14:43       ` Corinna Vinschen
  0 siblings, 2 replies; 8+ messages in thread
From: Brian Inglis @ 2015-12-29  5:16 UTC (permalink / raw)
  To: cygwin

> > David Lee <mailtolky <at> 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
> <Brian.Inglis <at> 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 <mailtolky <at> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Issues in utmp/utmpx headers
  2015-12-29  5:16     ` Brian Inglis
@ 2016-01-04  3:11       ` David Lee
  2016-01-04 18:31         ` Brian Inglis
  2016-01-07 14:43       ` Corinna Vinschen
  1 sibling, 1 reply; 8+ messages in thread
From: David Lee @ 2016-01-04  3:11 UTC (permalink / raw)
  To: cygwin

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
<Brian.Inglis@systematicsw.ab.ca> wrote:
>> > David Lee <mailtolky <at> 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
>> <Brian.Inglis <at> 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 <mailtolky <at> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Issues in utmp/utmpx headers
  2016-01-04  3:11       ` David Lee
@ 2016-01-04 18:31         ` Brian Inglis
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Inglis @ 2016-01-04 18:31 UTC (permalink / raw)
  To: cygwin

> On 29 December 2015 at 13:16, Brian Inglis
> <Brian.Inglis <at> systematicsw.ab.ca> wrote:
>> 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.

David Lee <mailtolky <at> gmail.com> writes:
> 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?

Unlikely to happen, but could test in your code for errno == ENOMEM, 
as errno should never be cleared, but relies on appropriate tests. 

> 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?

Save only and use your saved copy. 

> 3. Does the instruction from 6.21 in
>    https://cygwin.com/faq/faq.html#faq.programming.building-cygwin
>    generates a debugging dll (i.e. contains debug symbols usable by
> gdb)? If not, what modifications are needed to create one?

https://cygwin.com/faq/faq.html#faq.programming.debugging-cygwin
FAQ 6.22 explains to install cygwin-debuginfo for released dll 
and that 6.21 generates debug info for custom dll.



--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Issues in utmp/utmpx headers
  2015-12-27  2:58 Issues in utmp/utmpx headers David Lee
  2015-12-27 19:02 ` Brian Inglis
@ 2016-01-07 14:41 ` Corinna Vinschen
  1 sibling, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2016-01-07 14:41 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

On Dec 27 10:56, David Lee wrote:
> Hi all,
> 
> 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.

Changed in the git repo.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Issues in utmp/utmpx headers
  2015-12-29  5:16     ` Brian Inglis
  2016-01-04  3:11       ` David Lee
@ 2016-01-07 14:43       ` Corinna Vinschen
  1 sibling, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2016-01-07 14:43 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1639 bytes --]

On Dec 29 05:16, Brian Inglis wrote:
> > > David Lee <mailtolky <at> 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
> > <Brian.Inglis <at> 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 <mailtolky <at> 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;

This function is supposed to be called only once, so is it worth the
additional effort?

> default the path if a null pointer or string
> argument is passed. 

The function now returns int and -1 if path is invalid.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-01-07 14:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-27  2:58 Issues in utmp/utmpx headers David Lee
2015-12-27 19:02 ` Brian Inglis
2015-12-28  3:24   ` David Lee
2015-12-29  5:16     ` Brian Inglis
2016-01-04  3:11       ` David Lee
2016-01-04 18:31         ` Brian Inglis
2016-01-07 14:43       ` Corinna Vinschen
2016-01-07 14:41 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).