summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qhostinfo_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QHostInfo::localDomainName: use QBAV moreAnton Kudryavtsev2023-09-011-6/+9
| | | | | | | to reduce allocations Change-Id: If75c3818333880ba34f2e58038b05869979ae14d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Don't include resolv.h when libresolv is disabledJacek Poplawski2023-07-261-1/+4
| | | | | Change-Id: I5b216ed02452549b69847b34139613669905023c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: remove "res_ninit" feature and collapse to just "libresolv"Thiago Macieira2023-05-271-3/+3
| | | | | | | | | | | | | Testing for "res_ninit" when WrapResolv.cmake has already checked for far more complex functions was pointless. Instead, just accept the library that was found by find_package() as good enough and rename the feature as "libresolv". Amends 4a46ba1209907796f4a14f6feb35ed4d70155d7d and 68b625901f9eb7c34e3d7aa302e1c0a454d3190b. Change-Id: Ib5ce7a497e034ebabb2cfffd1762c0afa2fac6e0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Network: link directly to libresolv instead of dlopen()ing itAmir Masoud Abdol2023-05-111-147/+67
| | | | | | | | | | | | | | | | | | There's little need for us to dynamically load it. The reasons why that was necessary aren't in the public history (Qt 4.5 already had it[1]). I remember writing the code in 2007-2008, I just don't remember why. On modern Linux and FreeBSD, there's no libresolv.so any more and those symbols have been rolled up into libc.so. It's still necessary on Darwin systems, so this commit introduces WrapResolv. It also resolves the unity build issues relating to libresolv symbols. [1] https://code.qt.io/cgit/qt/qt.git/tree/src/network/kernel/qhostinfo_unix.cpp?h=v4.5.1 Task-number: QTBUG-109394 Change-Id: Ic5799e4d000b6c9395109e008780643bac52122b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtNetwork: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-211-2/+4
| | | | | | Task-number: QTBUG-98434 Change-Id: Ic235b92377203f7a1429ae7fd784c4a1fa893e9f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QHostInfo/Unix: Fix resolv never unloadingMårten Nordheim2022-03-091-1/+0
| | | | | | | | Due to some unfortunate shadowing Pick-to: 6.3 6.2 5.15 Change-Id: Ib2660516f9ba9974c84a043bd2677b7890fc76f9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Introduce Q_APPLICATION_STATICMike Achtelik2021-11-181-18/+3
| | | | | | | | | | | | | | QObjects must be deleted if the QCoreApplication is being destroyed. This was previously done by implementing custom code in qtbase and other modules. So unify it and introduce a Q_APPLICATION_STATIC, based on the Q_GLOBAL_STATIC, which centralises the logic. Since we still have a few remaining living QObjects, this comes in handy to fix those as well. Task-number: QTBUG-84234 Change-Id: I3040a2280ff56291f2b1c39948c06a23597865c4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix living QLibrary member after shutdown of QCoreApplicationMike Achtelik2020-06-231-1/+19
| | | | | | | | | | | | LibResolv uses a QLibrary which is a QObject that must be deleted if the QCoreApplication is being destroyed to release the underlying library. A Q_GLOBAL_STATIC won't release any memory and is not able to manually release it. Pick-to: 5.15 Task-number: QTBUG-84234 Change-Id: I97fe5faca309e9c1e85435f602ad7f8c3f633b48 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-4/+4
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Consolidate Unix and Windows implementations of QHostInfo::fromNameVolker Hilsheimer2019-04-301-136/+3
| | | | | | | | | | | | | The implementations were practically identical, so we can just move the code into qhostinfo.cpp, cleaning up things along the way. Since QHostInfoAgent is an internal class, add the shared code as additional static helper functions. And since half the code already used QCoreApplication::translate anyway, we can remove the QObject inheritance which was only added for getting a tr(). Change-Id: I58eafbdc3e7d06d2e898486a1add63cd63d98c96 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHostInfo: use dlsym() with RTLD_DEFAULT in case libs cannot be loadedDavide Beatrici2019-04-061-9/+24
| | | | | | | | | | | | | | | | The current code only tries to load the required functions from LIBRESOLV_SO (if defined) and resolv, but on FreeBSD they are in libc: https://www.freebsd.org/cgi/man.cgi?query=res_query&sektion=3&apropos=0&manpath=freebsd This commit changes the code so that, after failing to load the non-existent libraries, it attempts to load the functions with dlsym() using the special handle RTLD_DEFAULT, which searches for the specified symbol in the loaded libraries. This is a follow-up to 8eeb5150ed99914e252a84f1637f179e3de04659. Change-Id: I19d90b0ca8703398bf4f5f4edd5ae31e346ef251 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.10' into devAllan Sandfeld Jensen2017-10-241-50/+0
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/windows/qwindowsmousehandler.cpp src/plugins/platforms/xcb/qxcbimage.cpp tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/manual/qtabletevent/regular_widgets/main.cpp Done-with: Friedemann Kleint<Friedemann.Kleint@qt.io> Done-with: Mårten Nordheim<marten.nordheim@qt.io> Change-Id: I5b2499513a92c590ed0756f7d2e93c35a64b7f30
| * QHostInfo: Make getaddrinfo() mandatoryThiago Macieira2017-10-181-50/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | All systems must implement it by now. If there's any system still without it, that means it has no IPv6 support, so they can disable QtNetwork entirely. [ChangeLog][Deprecation Notice] Starting with Qt 5.10, IPv6 support is mandatory for all platforms. Systems without proper IPv6 support, such as the getaddrinfo() function or the proper socket address structures, will not be able to build QtNetwork anymore. Change-Id: I3868166e5efc45538544fffd14d8c28046f9191b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QHostInfo: adapt to glibc 2.26 no longer requiring us to res_initThiago Macieira2017-09-221-18/+56
|/ | | | | | | | | | | | | | | | | | | | | From the announcement[1] - The GNU C Library will now detect when /etc/resolv.conf has been modified and reload the changed configuration. The new resolver option “no-reload” (RES_NORELOAD) disables this behavior. Since glibc can do it, we don't have to call res_init before every single getaddrinfo() call. And since we don't need to call res_init, we don't need to load libresolv.so at all, until we need res_ninit. We won't do it even if the user configured "no-reload" in /etc/resolv.conf or RES_NORELOAD in the res variable -- let's assume that it is the intent, like when /etc/resolv.conf is known to never change. [1] https://sourceware.org/ml/libc-alpha/2017-08/msg00010.html Change-Id: I3868166e5efc45538544fffd14d738d40c375fd1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QHostInfo: Remove Darwin refusal to use getnameinfo(3)Thiago Macieira2017-08-241-2/+1
| | | | | | | | | | | | | | | | | This #if has been there since 0248ec4054b (Oct 2005), presumably due to bugs reported after the Qt 4.0 release (the first containing QHostInfo). Any macOS issues with getnameinfo() have long since been gone. I've confirmed that it works on 10.9, 10.10, 10.11 and 10.12, so I'm dropping the #ifndef. [ChangeLog][Deprecation Notice] Starting with Qt 5.10, IPv6 support will be mandatory for all platforms. Systems without proper IPv6 support, such as the getaddrinfo() function or the proper socket address structures, will not be able to build QtNetwork anymore. Change-Id: I320d9d2f42284a69a4cbfffd14dd5bf479e5f678 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use QT_CONFIG(library) instead of QT_NO_LIBRARYUlf Hermann2017-03-061-1/+3
| | | | | | | | | | | | | For the windows file system engine, we add an extra macro to use library loading if configured to do so, but avoid it on WinRT, as none of the symbols would be found. We also QT_REQUIRE_CONFIG(library) in the library headers and exclude the sources from the build if library loading is disabled. This, in turn, makes it necessary to clean up some header inclusions. Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-061-11/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/qtestlib/tutorial5/containers.cpp examples/widgets/tools/tools.pro src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/network/kernel/qdnslookup_unix.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp tools/configure/configureapp.cpp Change-Id: I838ae7f082535a67a4a53aa13a21ba5580758be8
| * Remove the use of QMutexPool in QHostInfo and QDnsLookupThiago Macieira2016-04-301-11/+6
| | | | | | | | | | | | | | | | Q_GLOBAL_STATIC does the thread-safe protection for us. And who said we could only use non-POD types? We can just use a boolean! Change-Id: Ifea6e497f11a461db432ffff1449b0a88d75d194 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge the multiple implementations of getting the local hostnameThiago Macieira2015-08-131-9/+0
| | | | | | | | | | | | | | | | This commit moves the functionality from QtNetwork's QHostInfo to QtCore. Note that due to Windows ws2_32.dll's quirky behavior of requiring WSAStartup before calling gethostname, this change required moving the initialization to QtCore too. On Linux systems, gethostname() gets the name from uname(), so we bypass the middle man and save one memcpy. Change-Id: I27eaacb532114dd188c4ffff13d32655a6301346 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com> Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-071-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformintegration.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/android/qandroidplatformopenglcontext.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/sql/doc/src/sql-driver.qdoc src/widgets/widgets/qtoolbararealayout.cpp Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
| * Don't include <gnu/lib-names.h> when compiling with uClibcJorgen Lind2014-01-231-1/+1
| | | | | | | | | | Change-Id: I5264280b7ce1e94eaf410a070f9670984f7a655b Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
* | expand tabs and related whitespace fixes in *.{cpp,h,qdoc}Oswald Buddenhagen2014-01-131-3/+3
|/ | | | | | | | the diff -w for this commit is empty. Started-by: Thiago Macieira <thiago.macieira@intel.com> Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix loading of libresolv when the .so file (not .so.2) isn't installedThiago Macieira2013-10-161-2/+13
| | | | | | | | | | | glibc is nice to us and provides a #define with the actual name. On most Linux systems, the .so file is installed only if the glibc-devel package is installed. For all of us Qt developers, it's installed. But for end users, it might not be. Change-Id: Id455371db91a074befd3bcd071f285c725d7e7e5 Reviewed-by: Ian Monroe <imonroe@kde.org> Reviewed-by: Richard J. Moore <rich@kde.org>
* QNX host lookup: do not try to load libresolv.so, it is not therePeter Hartmann2013-04-241-1/+1
| | | | | | | | | | Not trying to load the lib saves 30 - 50ms upon an apps' 1st host lookup. Task-number: QTBUG-30809 Change-Id: Id893cec09ff57494776625700c93f7efe96fcc6b Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* Introducing the Qt Android portPaul Olav Tvete2013-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | Based on the Necessitas project by Bogdan Vatra. Contributors to the Qt5 project: BogDan Vatra <bogdan@kde.org> Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> hjk <hjk121@nokiamail.com> Oswald Buddenhagen <oswald.buddenhagen@digia.com> Paul Olav Tvete <paul.tvete@digia.com> Robin Burchell <robin+qt@viroteck.net> Samuel Rødal <samuel.rodal@digia.com> Yoann Lopes <yoann.lopes@digia.com> The full history of the Qt5 port can be found in refs/old-heads/android, SHA-1 249ca9ca2c7d876b91b31df9434dde47f9065d0d Change-Id: Iff1a7b2dbb707c986f2639e65e39ed8f22430120 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QHostInfo: replace a volatile bool with an atomic intMarc Mutz2012-08-291-4/+5
| | | | | | | | | | | | A volatile bool read/store is documented on MSVC to have acquire/release semantics, respectively, but that doesn't need to be true for MinGW, so use explicit memory ordering. Apply the same fix to the Unix implementation, too. Change-Id: Ica466cec50beed830aafa4e3384d82f02e1a47e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Android's resolv.h is busted, so stub out QHostInfo::localDomainName().Robin Burchell2012-05-021-1/+1
| | | | | | Change-Id: Idcf5ca7298eed55121b690906885af0eb3fe0b9e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Use QBasicMutex instead of Q_GLOBAL_STATIC QMutexOlivier Goffart2012-02-011-6/+3
| | | | | | | | | | | | | | QBasicMutex is a POD and can be used as a static global object. in qpicture.cpp factoryLoader is used only once, and under the mutex, so there is no need for Q_GLOBAL_STATIC for it, it can be a function static in qhostinfo_unix.cpp the code seemed wrong while compiled with namespace and QT_NO_GETADDRINFO. I also could get rid of one include because it was included earlier. Change-Id: I3c700203c3e067266c20733f4bda8031446dbb86 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove all non-inline of qMalloc/qFree/qRealloc.Robin Burchell2012-01-061-2/+2
| | | | | | | | | | | | We're trying to deprecate these, so don't use them anymore. The inline uses of these have been left intact, for the moment. Inline code will need to create their own non-inline allocation methods (for future-proofing to allow alterations in how e.g. individual containers allocate) Change-Id: I1071a487c25e95b7bb81a3327b20c5481fb5ed22 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Always assume IPv6 supportMarkus Goetz2011-07-041-6/+0
| | | | | | | | | | | It's 2011 baby! And until Qt5 is released probably 2012 :-) Change-Id: I397aabf25e93c8afb5f562636710985cf0c7acfa Reviewed-on: http://codereview.qt.nokia.com/1008 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com> Reviewed-by: Markus Goetz
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+396
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12