* h_errno? @ 2013-02-15 9:10 Eli Zaretskii 2013-02-15 9:46 ` h_errno? Dmitry Antipov 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2013-02-15 9:10 UTC (permalink / raw) To: emacs-devel In process.c we have: #ifndef HAVE_H_ERRNO extern int h_errno; #endif There's also a configure-time test for this variable. But no code ever references h_errno in process.c, and the only place that it is used is in sysdep.c: #else /* !HAVE_GETADDRINFO */ struct hostent *hp; for (count = 0;; count++) { #ifdef TRY_AGAIN h_errno = 0; #endif hp = gethostbyname (hostname); #ifdef TRY_AGAIN if (! (hp == 0 && h_errno == TRY_AGAIN)) #endif break; if (count >= 5) break; Fsleep_for (make_number (1), Qnil); } What is this variable about, and why do we have its declaration in process.c? Can we use errno instead of h_errno in sysdep.c? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: h_errno? 2013-02-15 9:10 h_errno? Eli Zaretskii @ 2013-02-15 9:46 ` Dmitry Antipov 2013-02-15 10:19 ` h_errno? Eli Zaretskii 2013-02-15 11:57 ` h_errno? Andreas Schwab 0 siblings, 2 replies; 7+ messages in thread From: Dmitry Antipov @ 2013-02-15 9:46 UTC (permalink / raw) To: Eli Zaretskii; +Cc: emacs-devel On 02/15/2013 01:10 PM, Eli Zaretskii wrote: > What is this variable about, and why do we have its declaration in > process.c? http://www.linuxmanpages.com/man3/gethostbyname.3.php > Can we use errno instead of h_errno in sysdep.c? IIUC errno is orthogonal here. The whole code snippet is obsolete and should be rewritten to use getaddrinfo/getnameinfo. Dmitry ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: h_errno? 2013-02-15 9:46 ` h_errno? Dmitry Antipov @ 2013-02-15 10:19 ` Eli Zaretskii 2013-02-15 19:09 ` h_errno? Paul Eggert 2013-02-15 11:57 ` h_errno? Andreas Schwab 1 sibling, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2013-02-15 10:19 UTC (permalink / raw) To: Dmitry Antipov; +Cc: emacs-devel > Date: Fri, 15 Feb 2013 13:46:17 +0400 > From: Dmitry Antipov <dmantipov@yandex.ru> > CC: emacs-devel@gnu.org > > On 02/15/2013 01:10 PM, Eli Zaretskii wrote: > > > What is this variable about, and why do we have its declaration in > > process.c? > > http://www.linuxmanpages.com/man3/gethostbyname.3.php Thanks. I guess most of w32 functions that set h_errno can stop doing that now. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: h_errno? 2013-02-15 10:19 ` h_errno? Eli Zaretskii @ 2013-02-15 19:09 ` Paul Eggert 2013-02-15 19:44 ` h_errno? Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Paul Eggert @ 2013-02-15 19:09 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Dmitry Antipov, emacs-devel On 02/15/2013 02:19 AM, Eli Zaretskii wrote: > I guess most of w32 functions that set h_errno can stop doing > that now. If memory serves, h_errno is part of an obsolete POSIX interface that Emacs no longer uses now, if the platform supports the current POSIX interface. As I understand it, the w32 code emulates the obsolete interface, so if the policy is to emulate the interface rather than do the minimal work needed to support Emacs, then w32 code needs to set h_errno when it emulates that interface. The declaration of h_errno isn't needed in src/process.c; it's a leftover from some old code that was removed. So I removed the unused decl in trunk bzr 111791. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: h_errno? 2013-02-15 19:09 ` h_errno? Paul Eggert @ 2013-02-15 19:44 ` Eli Zaretskii 2013-02-16 11:11 ` h_errno? Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2013-02-15 19:44 UTC (permalink / raw) To: Paul Eggert; +Cc: dmantipov, emacs-devel > Date: Fri, 15 Feb 2013 11:09:14 -0800 > From: Paul Eggert <eggert@cs.ucla.edu> > CC: Dmitry Antipov <dmantipov@yandex.ru>, emacs-devel@gnu.org > > On 02/15/2013 02:19 AM, Eli Zaretskii wrote: > > I guess most of w32 functions that set h_errno can stop doing > > that now. > > If memory serves, h_errno is part of an obsolete POSIX > interface that Emacs no longer uses now, if the platform > supports the current POSIX interface. As I understand it, > the w32 code emulates the obsolete interface, so if the > policy is to emulate the interface rather than do the > minimal work needed to support Emacs, then w32 code needs to > set h_errno when it emulates that interface. The problem is that (a) w32 code sets h_errno to values that come from errno.h, which is clearly wrong, and (b) it sets h_errno in many network functions that are not documented to set h_errno, like accept, recvfrom, sendto, listen, etc. I will fix both of these soon. > The declaration of h_errno isn't needed in src/process.c; > it's a leftover from some old code that was removed. So I > removed the unused decl in trunk bzr 111791. Thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: h_errno? 2013-02-15 19:44 ` h_errno? Eli Zaretskii @ 2013-02-16 11:11 ` Eli Zaretskii 0 siblings, 0 replies; 7+ messages in thread From: Eli Zaretskii @ 2013-02-16 11:11 UTC (permalink / raw) To: eggert, dmantipov; +Cc: emacs-devel > Date: Fri, 15 Feb 2013 21:44:54 +0200 > From: Eli Zaretskii <eliz@gnu.org> > Cc: dmantipov@yandex.ru, emacs-devel@gnu.org > > > Date: Fri, 15 Feb 2013 11:09:14 -0800 > > From: Paul Eggert <eggert@cs.ucla.edu> > > CC: Dmitry Antipov <dmantipov@yandex.ru>, emacs-devel@gnu.org > > > > On 02/15/2013 02:19 AM, Eli Zaretskii wrote: > > > I guess most of w32 functions that set h_errno can stop doing > > > that now. > > > > If memory serves, h_errno is part of an obsolete POSIX > > interface that Emacs no longer uses now, if the platform > > supports the current POSIX interface. As I understand it, > > the w32 code emulates the obsolete interface, so if the > > policy is to emulate the interface rather than do the > > minimal work needed to support Emacs, then w32 code needs to > > set h_errno when it emulates that interface. > > The problem is that (a) w32 code sets h_errno to values that come from > errno.h, which is clearly wrong, and (b) it sets h_errno in many > network functions that are not documented to set h_errno, like accept, > recvfrom, sendto, listen, etc. I will fix both of these soon. Done in trunk revision 111804. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: h_errno? 2013-02-15 9:46 ` h_errno? Dmitry Antipov 2013-02-15 10:19 ` h_errno? Eli Zaretskii @ 2013-02-15 11:57 ` Andreas Schwab 1 sibling, 0 replies; 7+ messages in thread From: Andreas Schwab @ 2013-02-15 11:57 UTC (permalink / raw) To: Dmitry Antipov; +Cc: Eli Zaretskii, emacs-devel Dmitry Antipov <dmantipov@yandex.ru> writes: > The whole code snippet is obsolete and should be rewritten to use > getaddrinfo/getnameinfo. It already has been. This is the fallback. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-02-16 11:11 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-02-15 9:10 h_errno? Eli Zaretskii 2013-02-15 9:46 ` h_errno? Dmitry Antipov 2013-02-15 10:19 ` h_errno? Eli Zaretskii 2013-02-15 19:09 ` h_errno? Paul Eggert 2013-02-15 19:44 ` h_errno? Eli Zaretskii 2013-02-16 11:11 ` h_errno? Eli Zaretskii 2013-02-15 11:57 ` h_errno? Andreas Schwab
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.