Linux-Systemd-1.201600000755001751001751 013667351766 13555 5ustar00ioanioan000000000000Changes100644001751001751 214113667351766 15127 0ustar00ioanioan000000000000Linux-Systemd-1.201600Changelog for Linux-Systemd 1.201600 2020-06-08T05:59:06Z - [Closes #4] Fix test failure from mixing `no_plan` and `done_testing` - Repo migrated to Gitlab 1.191790 2019-06-28T16:27:06Z - [really closes #3] don't use Try::Tiny 1.172840 2017-10-11T01:38:08Z - [closes #3] don't be lazy by using Try::Tiny during configure stage - Fix some POD 1.172760 2017-10-03T03:56:02Z - Better caller information - Added license and readme 1.162700 2016-09-26T03:45:31Z - Renamed dist from Linux-Systemd-Journal to Linux-Systemd - Add Linux::Systemd::Daemon::sd_notify (Ioan Rogers) 0.004 2016-08-07T20:59:20Z - [closes #2] replace call to av_top_index to av_len because it is available on perls < 5.18 (Ioan Rogers) 0.003 2015-10-11T03:51:42Z - [Closes #1] fix missing params to C calls - Add a previous method - Add a tail example. - some non-visible improvements to some of the XS 0.002 2015-03-30T03:50:49Z - Initial journal read support - Added a Linux::Systemd::Journal placeholder to get the namespace. The previous release was never actually indexed. 0.001 2014-05-11T20:56:13Z - First release typemap100644001751001751 5413667351766 15177 0ustar00ioanioan000000000000Linux-Systemd-1.201600TYPEMAP sd_journal * T_PTR uint64_t T_IV LICENSE100644001751001751 6012013667351766 14662 0ustar00ioanioan000000000000Linux-Systemd-1.201600This software is Copyright (c) 2020 by Ioan Rogers. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999 The GNU Lesser General Public License (LGPL) Version 2.1, February 1999 (The master copy of this license lives on the GNU website.) Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS dist.ini100644001751001751 36113667351766 15262 0ustar00ioanioan000000000000Linux-Systemd-1.201600name = Linux-Systemd author = Ioan Rogers license = LGPL_2_1 copyright_holder = Ioan Rogers [@Author::IOANR] major_version = 1 assert_os = Linux custom_builder = 1 [Prereqs / ConfigureRequires] ExtUtils::PkgConfig = 0 MANIFEST100644001751001751 163713667351766 14776 0ustar00ioanioan000000000000Linux-Systemd-1.201600# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.014. Build.PL Changes LICENSE MANIFEST META.json README.md SIGNATURE dist.ini eg/perl-daemon eg/perl-daemon.service eg/read_journal.pl eg/tail.pl eg/write_journal.pl inc/Devel/AssertOS.pm inc/Devel/AssertOS/Android.pm inc/Devel/AssertOS/Linux.pm inc/Devel/CheckOS.pm inc/My/Builder.pm lib/Linux/Systemd.pm lib/Linux/Systemd/Daemon.pm lib/Linux/Systemd/Daemon.xs lib/Linux/Systemd/Journal/Read.pm lib/Linux/Systemd/Journal/Read.xs lib/Linux/Systemd/Journal/Write.pm lib/Linux/Systemd/Journal/Write.xs t/00-check-deps.t t/00-compile.t t/00-report-prereqs.dd t/00-report-prereqs.t t/daemon.t t/journal/read.t t/journal/write.t typemap xt/author/eol.t xt/author/mojibake.t xt/author/no-tabs.t xt/author/pod-no404s.t xt/author/portability.t xt/author/signature.t xt/author/synopsis.t xt/author/test-version.t xt/release/kwalitee.t xt/release/unused-vars.t Build.PL100644001751001751 320513667351766 15132 0ustar00ioanioan000000000000Linux-Systemd-1.201600use if ! ( grep { $_ eq '.' } @INC ), qw[lib .]; use lib 'inc'; use Devel::AssertOS qw[Linux]; # This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.014. use strict; use warnings; use Module::Build 0.28; use lib qw{inc}; use My::Builder; my %module_build_args = ( "build_requires" => { "Module::Build" => "0.28" }, "configure_requires" => { "ExtUtils::PkgConfig" => 0, "Module::Build" => "0.28" }, "dist_abstract" => "Bindings for C APIs", "dist_author" => [ "Ioan Rogers " ], "dist_name" => "Linux-Systemd", "dist_version" => "1.201600", "license" => "lgpl", "module_name" => "Linux::Systemd", "recursive_test_files" => 1, "requires" => { "Carp" => 0, "Exporter" => 0, "File::Basename" => 0, "Moo" => 0, "XSLoader" => 0, "perl" => "v5.16.0", "strictures" => 2 }, "test_requires" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::CheckDeps" => "0.010", "Test::Fatal" => 0, "Test::More" => "0.94", "strict" => 0, "warnings" => 0 } ); my %fallback_build_requires = ( "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Module::Build" => "0.28", "Test::CheckDeps" => "0.010", "Test::Fatal" => 0, "Test::More" => "0.94", "strict" => 0, "warnings" => 0 ); unless ( eval { Module::Build->VERSION(0.4004) } ) { delete $module_build_args{test_requires}; $module_build_args{build_requires} = \%fallback_build_requires; } my $build = My::Builder->new(%module_build_args); $build->create_build_script; META.json100644001751001751 1033213667351766 15276 0ustar00ioanioan000000000000Linux-Systemd-1.201600{ "abstract" : "Bindings for C APIs", "author" : [ "Ioan Rogers " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.014, CPAN::Meta::Converter version 2.150010", "license" : [ "lgpl_2_1" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Linux-Systemd", "no_index" : { "directory" : [ "inc" ] }, "prereqs" : { "build" : { "requires" : { "Module::Build" : "0.28" } }, "configure" : { "requires" : { "ExtUtils::PkgConfig" : "0", "Module::Build" : "0.28" } }, "develop" : { "requires" : { "Dist::Zilla" : "5", "Dist::Zilla::Plugin::Prereqs" : "0", "Dist::Zilla::PluginBundle::Author::IOANR" : "0", "Software::License::LGPL_2_1" : "0", "Test::EOL" : "0", "Test::Kwalitee" : "1.21", "Test::Mojibake" : "0", "Test::More" : "0.96", "Test::NoTabs" : "0", "Test::Pod::No404s" : "0", "Test::Portability::Files" : "0", "Test::Signature" : "0", "Test::Synopsis" : "0", "Test::Vars" : "0", "Test::Version" : "1", "strict" : "0", "warnings" : "0" } }, "runtime" : { "requires" : { "Carp" : "0", "Exporter" : "0", "File::Basename" : "0", "Moo" : "0", "XSLoader" : "0", "perl" : "v5.16.0", "strictures" : "2" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::CheckDeps" : "0.010", "Test::Fatal" : "0", "Test::More" : "0.94", "strict" : "0", "warnings" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://gitlab.com/ioanrogers/Linux-Systemd/issues" }, "homepage" : "https://metacpan.org/release/Linux-Systemd", "repository" : { "type" : "git", "url" : "https://gitlab.com:ioanrogers/Linux-Systemd.git", "web" : "https://gitlab.com/ioanrogers/Linux-Systemd" } }, "version" : "1.201600", "x_BuiltWith" : { "modules" : { "CPAN::Meta" : "2.150010", "Carp" : "1.50", "Dist::Zilla" : "6.014", "Dist::Zilla::Plugin::Prereqs" : "6.014", "Dist::Zilla::PluginBundle::Author::IOANR" : "1.201400", "Exporter" : "5.74", "ExtUtils::MakeMaker" : "7.44", "ExtUtils::PkgConfig" : "1.16", "File::Basename" : "2.85", "File::Spec" : "3.78", "IO::Handle" : "1.42", "IPC::Open3" : "1.20", "Module::Build" : "0.4231", "Moo" : "2.004000", "Software::License::LGPL_2_1" : "0.103014", "Test::CheckDeps" : "0.010", "Test::EOL" : "2.00", "Test::Fatal" : "0.014", "Test::Kwalitee" : "1.28", "Test::Mojibake" : "1.3", "Test::More" : "1.302175", "Test::NoTabs" : "2.02", "Test::Pod::No404s" : "0.02", "Test::Portability::Files" : "0.10", "Test::Signature" : "1.11", "Test::Synopsis" : "0.16", "Test::Vars" : "0.014", "Test::Version" : "2.09", "XSLoader" : "0.30", "strict" : "1.11", "strictures" : "2.000006", "warnings" : "1.44" }, "perl" : { "original" : "v5.30.1", "qv" : 1, "version" : [ 5, 30, 1 ] }, "perl-config" : { "gccversion" : "Clang 9.0.1 (Fedora 9.0.1-2.fc31)", "myarchname" : "x86_64-linux", "osname" : "linux" }, "platform" : "linux" }, "x_generated_by_perl" : "v5.30.1", "x_serialization_backend" : "Cpanel::JSON::XS version 4.19", "x_spdx_expression" : "LGPL-2.1" } README.md100644001751001751 351413667351766 15120 0ustar00ioanioan000000000000Linux-Systemd-1.201600# NAME Linux::Systemd - Bindings for `systemd` APIs # VERSION version 1.201600 # DESCRIPTION The following `systemd` components are wrapped to some to degree. ## Journal To log to the journal, see [Linux::Systemd::Journal::Write](https://metacpan.org/pod/Linux%3A%3ASystemd%3A%3AJournal%3A%3AWrite). To read from the journal, see [Linux::Systemd::Journal::Read](https://metacpan.org/pod/Linux%3A%3ASystemd%3A%3AJournal%3A%3ARead). ## Daemon To report status and use service watchdogs, see [Linux::Systemd::Daemon](https://metacpan.org/pod/Linux%3A%3ASystemd%3A%3ADaemon). # SUPPORT ## Perldoc You can find documentation for this module with the perldoc command. ``` perldoc Linux::Systemd ``` ## Websites The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. - MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. [https://metacpan.org/release/Linux-Systemd](https://metacpan.org/release/Linux-Systemd) ## Bugs / Feature Requests Please report any bugs or feature requests through the web interface at [https://gitlab.com/ioanrogers/Linux-Systemd/issues](https://gitlab.com/ioanrogers/Linux-Systemd/issues). You will be automatically notified of any progress on the request by the system. ## Source Code The source code is available for from the following locations: [https://gitlab.com/ioanrogers/Linux-Systemd](https://gitlab.com/ioanrogers/Linux-Systemd) ``` git clone https://gitlab.com:ioanrogers/Linux-Systemd.git ``` # AUTHOR Ioan Rogers # COPYRIGHT AND LICENSE This software is Copyright (c) 2020 by Ioan Rogers. This is free software, licensed under: ``` The GNU Lesser General Public License, Version 2.1, February 1999 ``` SIGNATURE100644001751001751 1167713667351766 15156 0ustar00ioanioan000000000000Linux-Systemd-1.201600This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.83. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 SHA256 ab6a65c0cebb5bc6b2e1f34f86c9781fff1d095680a329f6c94fafbd31f3cd49 Build.PL SHA256 acc0eeab46111e98b101fb9a2b1327cdc6113cf176e365479f2c5f5f8dad0f29 Changes SHA256 6278198052823b046c7aba551f88e6ffe7025640563d73e092a0b5a1fea9e60e LICENSE SHA256 29e94c5de7435918bc8e21b257879d8be13d22cc50c78940dfd56c272815e747 MANIFEST SHA256 70a0615371884ab3cc9926717ea1f7d1b63aea7fc8b5c3565b3d944f4ca8b771 META.json SHA256 f22db4c40217412c2d2970e39cb584011b4b2c3f59e62f3afda873d1c9ec4c24 README.md SHA256 c00a59389489779b5f6f8e01a37733a69e3b8017a78a25d7e469ca06fc2b879f dist.ini SHA256 9270b881e64821d8604e49bf9e1a818611903dd9a60f886c20eab709a449d022 eg/perl-daemon SHA256 035f1cd3fcd91b0ec66195d980569bc2857abf7bb6473b8aac6abca5cd18bef0 eg/perl-daemon.service SHA256 f4223699bf5230036048d69f0a809a522b2f33ea2c062816c4bb9cf4e990bdcd eg/read_journal.pl SHA256 d0493adf50ce9c362d213ba58e7aa5864cf612adc03eca174d7c24ce48e9f2a2 eg/tail.pl SHA256 4ce48fbbe951eac11b855dd8456903c2f3fefa93606af31ff69e11143aaffff8 eg/write_journal.pl SHA256 dafefee97d7bad8ab8fc719a1f8333d5afc3a5d577cc99c76081b97ff985aca4 inc/Devel/AssertOS.pm SHA256 f4ca0807bb917d53b30af0bf5d63acf110570d00bb91a1da1797f59a029fe5bb inc/Devel/AssertOS/Android.pm SHA256 0da20b5824ddfcccfb2214c2c45c0f77e2e2f379b076242c8d3889e88dfa1486 inc/Devel/AssertOS/Linux.pm SHA256 889b03a08b378a7de8982cd790520fcdac114c6af23d69894a472d4ee26091c2 inc/Devel/CheckOS.pm SHA256 22572f203daf03b8007a4a199308754be6868886075bf4188dafe7551aae5ada inc/My/Builder.pm SHA256 b96af74773f07b9534e6041f633de70bf772795226d91b45c461c6bb94b8639a lib/Linux/Systemd.pm SHA256 9758235d7d0f5060ac712ced1c595776dadef66831b52349870e7391e894076f lib/Linux/Systemd/Daemon.pm SHA256 e79a027e3972aeecd451140bbab8890f47d5978b20aec1bb48245106ecec9615 lib/Linux/Systemd/Daemon.xs SHA256 1d9dba3027d7fe9b53183b4519bc18474fc8904048add44ee3a4c37665c6f70c lib/Linux/Systemd/Journal/Read.pm SHA256 77e6d65563c266a272c189d3f39352b3a7090bcbc4a37e5e3dbee5c7f39348d4 lib/Linux/Systemd/Journal/Read.xs SHA256 e915ead78e0c1cd5527297b31d07f1683b91f9704458bba262361a2a9496a2f3 lib/Linux/Systemd/Journal/Write.pm SHA256 a05fe68a85153329271d91875db90fa1831c1f9c59aa1d75f38cde4a9a4c54f7 lib/Linux/Systemd/Journal/Write.xs SHA256 8e90f388b41e448885513ca9b71e13844a7795cec2f9837453225a21321797f6 t/00-check-deps.t SHA256 321a397abd8fbf6f9868b2673ef0fdf4bd49990fcf30515f50c8f311d84df398 t/00-compile.t SHA256 890344a9472b1e00ea28d208fd6a3fac54cff772db43b9516ad672a8371a9bd0 t/00-report-prereqs.dd SHA256 32862ed3cdb28367324e2dd1f20af158acc637de8e0487bb296157634e12e08c t/00-report-prereqs.t SHA256 5f48be9c42e306bb883a3fe955def6d6ee726af82208c3b87d72556031004fd6 t/daemon.t SHA256 00f578f6f04bc490d0fcae27894a7bfc1198dcc209b40033cc4fc09b5a1aacc2 t/journal/read.t SHA256 077905eee865db9a544d2c04845843f575caa0f85ad66c93b7c71d6c53db69b1 t/journal/write.t SHA256 4d96e2305deb67d9062e31b77df9142f5d8fb626802e37eb63cf200a8dde336f typemap SHA256 b09e1b0df8261aa9277992dbb66729f965c88c00c5603e19fceaef13ecda44cd xt/author/eol.t SHA256 89f6335b90cbedf340afef47053adab386d8b38faded020e58c76beda202e14f xt/author/mojibake.t SHA256 2f1b428408ed2073fd5729e33ddc2e7733eb8e7116db7f7433b3fc162d90786a xt/author/no-tabs.t SHA256 ffd348681df0089b7a0c1b93f80abc05b179d075e2bfcc01257ea10a15411db2 xt/author/pod-no404s.t SHA256 419849c8760d9c5b43870f3b0bc3247ddf4b5284374e86fef6cbe58ceda61fb0 xt/author/portability.t SHA256 93ab74868095d3904efc7c1d257c6f8aa654532a16eb782e304c21a7c7067bef xt/author/signature.t SHA256 e0f7231f875bb7b8a5f22ea4104ce06a2e6824fa4367846d7d2e02200073904e xt/author/synopsis.t SHA256 aa25d3dc3ed499cce2f80e827aa3743b52424ea4f98abe8a389b8dd94b9f3e35 xt/author/test-version.t SHA256 04e76f55efd7139e6a099b61be60a1856c289f01f8ee02095fe980a9d665525e xt/release/kwalitee.t SHA256 63d9827f7014ae7145a2f3dde173b115b0f529a713aad5f747933bd381a6bd05 xt/release/unused-vars.t -----BEGIN PGP SIGNATURE----- iQGzBAEBCAAdFiEE8yrDhIfmTcHpKT/J0zu3t5NbEiUFAl7d0/YACgkQ0zu3t5Nb EiU13gv/erIMRm+kYm8CGfcjHWJTAGihomT+X2CwId+GPCMyV4tlamGdfBDsTRzQ /1JC2GZv5Mkle9zULwta2QOcLZRy1+rMjibf76vOV9gQ30mjt0SdaYz+JsVTUalj xAYkyA5WI9ajfwC0FtGDW6X3/Rvyt5Wwl7v7XGYOedC0PJ24awN1G4G+MyVsSjwY /jNmCH1AsNGBSnr8jh6djCFOFAgwbYPosiXf9HD+0qFfb8u6UQVb8vvV0hHDv0pX Blft8yVtYapmMn4MDvmQ2rVb2DiMv7tQPcmWxiTipmvClSFQu8SWAyGabpBg6jHd bEnwg9C4T5hQUgNFdJYPkv2B5Qw560gF/j7ATSKhG7XeqRw/fLlaZGZyFkGgxc+s jZcXVEsEtDXwYGzFl9cHGP1Uo70M1uZuaw4Zh+aovoKOJt59XmurJpqBK89/Gp2Z OudOyJm1OnOpCh8c6Fou9d8PtaZdp8NRX85OWCMhNxW1+Z/6oBjAy+rYmM+HY5mL i8s96EA8 =8m6R -----END PGP SIGNATURE----- eg000755001751001751 013667351766 14071 5ustar00ioanioan000000000000Linux-Systemd-1.201600tail.pl100644001751001751 127013667351766 15517 0ustar00ioanioan000000000000Linux-Systemd-1.201600/eg#!/usr/bin/env perl use v5.16.2; use strictures; use Time::Moment; use Linux::Systemd::Journal::Read; sub print_entry { my $entry = shift; if ($entry->{_SOURCE_REALTIME_TIMESTAMP}) { my $epoch_ms = $entry->{_SOURCE_REALTIME_TIMESTAMP}; my $tm = Time::Moment->from_epoch($epoch_ms / 1_000_000); print "$tm "; } say $entry->{MESSAGE} if $entry->{MESSAGE}; } my $jnl = Linux::Systemd::Journal::Read->new; $jnl->seek_tail; $jnl->previous(10); while (my $entry = $jnl->get_next_entry) { print_entry($entry); } while (1) { $jnl->wait; say "Done waiting"; while (my $entry = $jnl->get_next_entry) { print_entry($entry); } } t000755001751001751 013667351766 13741 5ustar00ioanioan000000000000Linux-Systemd-1.201600daemon.t100644001751001751 35713667351766 15516 0ustar00ioanioan000000000000Linux-Systemd-1.201600/tuse Test::More; use Test::Fatal; use_ok 'Linux::Systemd::Daemon', qw/sd_notify sd_ready/; is exception { sd_notify(ready => 1) }, undef, 'sent notification'; is exception { sd_ready() }, undef, 'sent ready notification'; done_testing; perl-daemon100755001751001751 212613667351766 16363 0ustar00ioanioan000000000000Linux-Systemd-1.201600/eg#!/usr/bin/env perl use v5.20; use strictures 2; use sigtrap qw/handler handle_signal normal-signals/; use experimental qw/smartmatch signatures/; use Linux::Systemd::Daemon ':all'; use Linux::Systemd::Journal::Write; my $sleep_max = 8; my $jnl = Linux::Systemd::Journal::Write->new; sub handle_signal($signal) { $jnl->print("Got a SIG$signal"); given ($signal) { when ('HUP') { sd_notify(reloading => 1, status => 'Reloading configuration...'); $jnl->print('pretending to reload configuration'); sleep rand($sleep_max); Linux::Systemd::Daemon::notify("READY=1"); } when (/TERM|INT/) { sd_notify(stopping => 1, status => 'Shutting down...'); $jnl->print('pretending to do some clean up tasks'); sleep rand($sleep_max); exit; } } } $jnl->print('pretending to do some initialisation tasks'); sleep rand($sleep_max); sd_ready(); while (1) { $jnl->print('looping'); sd_notify(watchdog => 1, status => 'Main loop running'); sleep rand($sleep_max); } 00-compile.t100644001751001751 301013667351766 16125 0ustar00ioanioan000000000000Linux-Systemd-1.201600/tuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 4 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Linux/Systemd.pm', 'Linux/Systemd/Daemon.pm', 'Linux/Systemd/Journal/Read.pm', 'Linux/Systemd/Journal/Write.pm' ); # no fake home requested my @switches = ( -d 'blib' ? '-Mblib' : '-Ilib', ); use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; author000755001751001751 013667351766 15433 5ustar00ioanioan000000000000Linux-Systemd-1.201600/xteol.t100644001751001751 104013667351766 16532 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/authoruse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/Linux/Systemd.pm', 'lib/Linux/Systemd/Daemon.pm', 'lib/Linux/Systemd/Journal/Read.pm', 'lib/Linux/Systemd/Journal/Write.pm', 't/00-check-deps.t', 't/00-compile.t', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/daemon.t', 't/journal/read.t', 't/journal/write.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; journal000755001751001751 013667351766 15413 5ustar00ioanioan000000000000Linux-Systemd-1.201600/tread.t100644001751001751 53313667351766 16634 0ustar00ioanioan000000000000Linux-Systemd-1.201600/t/journaluse Test::More; use Test::Fatal; use_ok 'Linux::Systemd::Journal::Read'; my $jnl = new_ok 'Linux::Systemd::Journal::Read'; is exception { $jnl->seek_tail }, undef, 'Moved cursor to tail'; is exception { $jnl->previous }, undef, 'Moved cursor to previous entry'; is exception { $jnl->seek_head }, undef, 'Moved cursor to head'; done_testing; My000755001751001751 013667351766 14634 5ustar00ioanioan000000000000Linux-Systemd-1.201600/incBuilder.pm100644001751001751 135513667351766 16724 0ustar00ioanioan000000000000Linux-Systemd-1.201600/inc/Mypackage My::Builder; use v5.16; use strict; use warnings; use base 'Module::Build'; use ExtUtils::PkgConfig; sub new { my ($class, %args) = @_; my $pkg_name = 'libsystemd'; my %pkg_info; eval { %pkg_info = ExtUtils::PkgConfig->find($pkg_name); }; if ($@) { say 'Do you need to install libsystemd-dev (debian) or systemd-devel (fedora)?'; exit; } say "Found libsystemd-dev version: $pkg_info{modversion}"; if (defined $pkg_info{cflags}) { $args{extra_compiler_flags} = $pkg_info{cflags}; } $args{extra_compiler_flags} .= ' -std=c99'; $args{extra_linker_flags} = $pkg_info{libs}; my $builder = Module::Build->new(%args); return $builder; } 1; write.t100644001751001751 464113667351766 17077 0ustar00ioanioan000000000000Linux-Systemd-1.201600/t/journaluse Test::More; use Linux::Systemd::Journal::Write; my $jnl = new_ok 'Linux::Systemd::Journal::Write' => [id => 'test']; ok $jnl->print('flarg'), 'print string'; # { # "PRIORITY" : "6", # "SYSLOG_IDENTIFIER" : "perl", # "MESSAGE" : "flarg", # } ok $jnl->print('Hello world', 4), 'print with priority'; # { # "PRIORITY" : "4", # "SYSLOG_IDENTIFIER" : "perl", # "MESSAGE" : "Hello world", # } ok $jnl->perror('An error was set'), 'perror'; # { # "PRIORITY" : "3", # "SYSLOG_IDENTIFIER" : "perl", # "ERRNO" : "0", # "MESSAGE" : "An error was set: Success", # } my $hashref = { message => 'Test send a hashref', abstract => 'XS wrapper around sd-journal', author => 'Ioan Rogers ', dynamic_config => 0, }; ok $jnl->send($hashref), 'send a hashref'; # { # "PRIORITY" : "6", # "DYNAMIC_CONFIG" : "0", # "AUTHOR" : "Ioan Rogers ", # "CODE_LINE" : "35", # "MESSAGE" : "Test send a hashref", # "ABSTRACT" : "XS wrapper around sd-journal", # "CODE_FILE" : "t/01-main.t", # "SYSLOG_IDENTIFIER" : "01-main.t", # } my $arrayref = [ message => 'Test send an arrayref', abstract => 'XS wrapper around sd-journal', author => 'Ioan Rogers ', dynamic_config => 0, ]; ok $jnl->send($arrayref), 'send an arrayref'; # { # "PRIORITY" : "6", # "DYNAMIC_CONFIG" : "0", # "AUTHOR" : "Ioan Rogers ", # "ABSTRACT" : "XS wrapper around sd-journal", # "CODE_FILE" : "t/01-main.t", # "SYSLOG_IDENTIFIER" : "01-main.t", # "MESSAGE" : "Test send an arrayref", # "CODE_LINE" : "47", # } ok $jnl->send( message => 'Test send an array', abstract => 'XS wrapper around sd-journal', author => 'Ioan Rogers ', dynamic_config => 0, ), 'send an array'; # { # "PRIORITY" : "6", # "DYNAMIC_CONFIG" : "0", # "AUTHOR" : "Ioan Rogers ", # "ABSTRACT" : "XS wrapper around sd-journal", # "CODE_FILE" : "t/01-main.t", # "SYSLOG_IDENTIFIER" : "01-main.t", # "MESSAGE" : "Test send an array", # "CODE_LINE" : "65", # } ok $jnl->send('I am a string'), 'send a string'; # { # "PRIORITY" : "6", # "CODE_FILE" : "t/01-main.t", # "SYSLOG_IDENTIFIER" : "01-main.t", # "MESSAGE" : "I am a string", # "CODE_LINE" : "83", # } done_testing; 00-check-deps.t100644001751001751 43513667351766 16473 0ustar00ioanioan000000000000Linux-Systemd-1.201600/tuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CheckDeps 0.014 use Test::More 0.94; use Test::CheckDeps 0.010; check_dependencies('classic'); if (0) { BAIL_OUT("Missing dependencies") if !Test::More->builder->is_passing; } done_testing; read_journal.pl100755001751001751 172013667351766 17236 0ustar00ioanioan000000000000Linux-Systemd-1.201600/eg#!/usr/bin/env perl use v5.10.1; use strict; use warnings; use Linux::Systemd::Journal::Read; my $jnl = Linux::Systemd::Journal::Read->new; sub dump_messages { my $i = 0; while (my $entry = $jnl->get_next_entry) { for my $key (sort keys %$entry) { say "$key: " . $entry->{$key}; } say '-' x 40; last if $i++ == 5; # limit for the example } } my $bytes = $jnl->get_usage; say "Journal size: $bytes bytes"; $jnl->seek_head; $jnl->next; say 'MESSAGE: ' . $jnl->get_data('MESSAGE'); say '_EXE: ' . $jnl->get_data('_EXE'); ## try filtering on priority $jnl->match(priority => 2); say "Showing on priority=2"; dump_messages; $jnl->flush_matches; $jnl->match(_systemd_unit => 'gdm.service'); say "Showing gdm.service"; dump_messages; $jnl->flush_matches; say 'x' x 24; $jnl->match(priority => 6, _systemd_unit => 'packagekit.service'); $jnl->match_or(priority => 7); # $jnl->match_or(_pid => 25811); dump_messages; write_journal.pl100755001751001751 63113667351766 17435 0ustar00ioanioan000000000000Linux-Systemd-1.201600/eg#!/usr/bin/env perl use v5.10.1; use strict; use warnings; use Linux::Systemd::Journal::Write; my $jnl = Linux::Systemd::Journal::Write->new; $jnl->print('flarg'); $jnl->print('Hello world', 4); my %hash = (DAY_ONE => 'Monday', DAY_TWO => 'Tuesday', DAY_THREE => 'Wednesday'); $jnl->send('Here is a message', \%hash); open my $fh, '<', 'nosuchfile' or $jnl->perror('Failed to open some fake file'); no-tabs.t100644001751001751 100613667351766 17320 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/authoruse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/Linux/Systemd.pm', 'lib/Linux/Systemd/Daemon.pm', 'lib/Linux/Systemd/Journal/Read.pm', 'lib/Linux/Systemd/Journal/Write.pm', 't/00-check-deps.t', 't/00-compile.t', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/daemon.t', 't/journal/read.t', 't/journal/write.t' ); notabs_ok($_) foreach @files; done_testing; Linux000755001751001751 013667351766 15343 5ustar00ioanioan000000000000Linux-Systemd-1.201600/libSystemd.pm100644001751001751 347013667351766 17475 0ustar00ioanioan000000000000Linux-Systemd-1.201600/lib/Linuxpackage Linux::Systemd 1.201600; use v5.16; # ABSTRACT: Bindings for C APIs 1; __END__ =pod =encoding UTF-8 =for :stopwords Ioan Rogers cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 NAME Linux::Systemd - Bindings for C APIs =head1 VERSION version 1.201600 =head1 DESCRIPTION The following C components are wrapped to some to degree. =head2 Journal To log to the journal, see L. To read from the journal, see L. =head2 Daemon To report status and use service watchdogs, see L. =head1 SUPPORT =head2 Perldoc You can find documentation for this module with the perldoc command. perldoc Linux::Systemd =head2 Websites The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. =over 4 =item * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. L =back =head2 Bugs / Feature Requests Please report any bugs or feature requests through the web interface at L. You will be automatically notified of any progress on the request by the system. =head2 Source Code The source code is available for from the following locations: L git clone https://gitlab.com:ioanrogers/Linux-Systemd.git =head1 AUTHOR Ioan Rogers =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2020 by Ioan Rogers. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999 =cut mojibake.t100644001751001751 15113667351766 17516 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/author#!perl use strict; use warnings qw(all); use Test::More; use Test::Mojibake; all_files_encoding_ok(); synopsis.t100644001751001751 6013667351766 17603 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/author#!perl use Test::Synopsis; all_synopsis_ok(); Devel000755001751001751 013667351766 15306 5ustar00ioanioan000000000000Linux-Systemd-1.201600/incCheckOS.pm100644001751001751 2350713667351766 17312 0ustar00ioanioan000000000000Linux-Systemd-1.201600/inc/Develpackage # Devel::CheckOS; use strict; use warnings; use Exporter; use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS); our $VERSION = '1.83'; @ISA = qw(Exporter); @EXPORT_OK = qw(os_is os_isnt die_if_os_is die_if_os_isnt die_unsupported list_platforms list_family_members); %EXPORT_TAGS = ( all => \@EXPORT_OK, booleans => [qw(os_is os_isnt die_unsupported)], fatal => [qw(die_if_os_is die_if_os_isnt)] ); =head1 NAME Devel::CheckOS - check what OS we're running on =head1 DESCRIPTION A learned sage once wrote on IRC: $^O is stupid and ugly, it wears its pants as a hat Devel::CheckOS provides a more friendly interface to $^O, and also lets you check for various OS "families" such as "Unix", which includes things like Linux, Solaris, AIX etc. It spares perl the embarrassment of wearing its pants on its head by covering them with a splendid Fedora. =head1 SYNOPSIS use Devel::CheckOS qw(os_is); print "Hey, I know this, it's a Unix system\n" if(os_is('Unix')); print "You've got Linux 2.6\n" if(os_is('Linux::v2_6')); =head1 USING IT IN Makefile.PL or Build.PL If you want to use this from Makefile.PL or Build.PL, do not simply copy the module into your distribution as this may cause problems when PAUSE and search.cpan.org index the distro. Instead, use the use-devel-assertos script. =head1 FUNCTIONS Devel::CheckOS implements the following functions, which load subsidiary OS-specific modules on demand to do the real work. They can be exported by listing their names after C. You can also export groups of functions thus: use Devel::CheckOS qw(:booleans); # export the boolean functions # and 'die_unsupported' use Devel::CheckOS qw(:fatal); # export those that die on no match use Devel::CheckOS qw(:all); # export everything =head2 Boolean functions =head3 os_is Takes a list of OS names. If the current platform matches any of them, it returns true, otherwise it returns false. The names can be a mixture of OSes and OS families, eg ... os_is(qw(Unix VMS)); # Unix is a family, VMS is an OS =cut sub os_is { my @targets = @_; my $rval = 0; foreach my $target (@targets) { die("Devel::CheckOS: $target isn't a legal OS name\n") unless($target =~ /^\w+(::\w+)*$/); eval "use Devel::AssertOS::$target"; if(!$@) { no strict 'refs'; $rval = 1 if(&{"Devel::AssertOS::${target}::os_is"}()); } } return $rval; } =head3 os_isnt If the current platform matches any of the parameters it returns false, otherwise it returns true. =cut sub os_isnt { my @targets = @_; my $rval = 1; foreach my $target (@targets) { $rval = 0 if(os_is($target)); } return $rval; } =head2 Fatal functions =head3 die_if_os_isnt As C, except that it dies instead of returning false. The die() message matches what the CPAN-testers look for to determine if a module doesn't support a particular platform. =cut sub die_if_os_isnt { os_is(@_) ? 1 : die_unsupported(); } =head3 die_if_os_is As C, except that it dies instead of returning false. =cut sub die_if_os_is { os_isnt(@_) ? 1 : die_unsupported(); } =head2 And some utility functions ... =head3 die_unsupported This function simply dies with the message "OS unsupported", which is what the CPAN testers look for to figure out whether a platform is supported or not. =cut sub die_unsupported { die("OS unsupported\n"); } =head3 list_platforms When called in list context, return a list of all the platforms for which the corresponding Devel::AssertOS::* module is available. This includes both OSes and OS families, and both those bundled with this module and any third-party add-ons you have installed. In scalar context, returns a hashref keyed by platform with the filename of the most recent version of the supporting module that is available to you. This is to make sure that the use-devel-assertos script Does The Right Thing in the case where you have installed the module in one version of perl, then upgraded perl, and installed it again in the new version. Sometimes the old version of perl and all its modules will still be hanging around and perl "helpfully" includes the old perl's search path in its own. Unfortunately, on some platforms this list may have file case broken. eg, some platforms might return 'freebsd' instead of 'FreeBSD'. This is because they have case-insensitive filesystems so things should Just Work anyway. =cut my ($re_Devel, $re_AssertOS); sub list_platforms { # need to lazily load these cos the module gets use()d in Makefile.PL, # at which point pre-reqs might not be installed. This function isn't # used in Makefile.PL so we can live without 'em. eval " # only load these if needed use File::Find::Rule; use File::Spec; "; die($@) if($@); if (!$re_Devel) { my $case_flag = File::Spec->case_tolerant ? '(?i)' : ''; $re_Devel = qr/$case_flag ^Devel$/x; $re_AssertOS = qr/$case_flag ^AssertOS$/x; } # sort by mtime, so oldest last my @modules = sort { (stat($a->{file}))[9] <=> (stat($b->{file}))[9] } map { my (undef, $dir_part, $file_part) = File::Spec->splitpath($_); $file_part =~ s/\.pm$//; my (@dirs) = grep {+length} File::Spec->splitdir($dir_part); foreach my $i (reverse 1..$#dirs) { next unless $dirs[$i] =~ $re_AssertOS && $dirs[$i - 1] =~ $re_Devel; splice @dirs, 0, $i + 1; last; } { module => join('::', @dirs, $file_part), file => File::Spec->canonpath($_) } } File::Find::Rule->file()->name('*.pm')->in( grep { -d } map { File::Spec->catdir($_, qw(Devel AssertOS)) } @INC ); my %modules = map { $_->{module} => $_->{file} } @modules; if(wantarray()) { return sort keys %modules; } else { return \%modules; } } =head3 list_family_members Takes the name of an OS 'family' and returns a list of all its members. In list context, you get a list, in scalar context you get an arrayref. If called on something that isn't a family, you get an empty list (or a ref to an empty array). =cut sub list_family_members { my $family = shift() || die(__PACKAGE__."::list_family_members needs a parameter\n"); # this will die if it's the wrong OS, but the module is loaded ... eval qq{use Devel::AssertOS::$family}; # ... so we can now query it my @members = eval qq{ no strict 'refs'; &{"Devel::AssertOS::${family}::matches"}() }; return wantarray() ? @members : \@members; } =head1 PLATFORMS SUPPORTED To see the list of platforms for which information is available, run this: perl -MDevel::CheckOS -e 'print join(", ", Devel::CheckOS::list_platforms())' Note that capitalisation is important. These are the names of the underlying Devel::AssertOS::* modules which do the actual platform detection, so they have to be 'legal' filenames and module names, which unfortunately precludes funny characters, so platforms like OS/2 are mis-spelt deliberately. Sorry. Also be aware that not all of them have been properly tested. I don't have access to most of them and have had to work from information gleaned from L and a few other places. For a complete list of OS families, see L. If you want to add your own OSes or families, see L and please feel free to upload the results to the CPAN. =head1 BUGS and FEEDBACK I welcome feedback about my code, including constructive criticism. Bug reports should be made using L. You will need to include in your bug report the exact value of $^O, what the OS is called (eg Windows Vista 64 bit Ultimate Home Edition), and, if relevant, what "OS family" it should be in and who wrote it. If you are feeling particularly generous you can encourage me in my open source endeavours by buying me something from my wishlist: L =head1 SEE ALSO $^O in L L L L L The use-devel-assertos script L =head1 AUTHOR David Cantrell EFE Thanks to David Golden for the name and ideas about the interface, and to the cpan-testers-discuss mailing list for prompting me to write it in the first place. Thanks to Ken Williams, from whose L I lifted some of the information about what should be in the Unix family. Thanks to Billy Abbott for finding some bugs for me on VMS. Thanks to Matt Kraai for information about QNX. Thanks to Kenichi Ishigaki and Gabor Szabo for reporting a bug on Windows, and to the former for providing a patch. Thanks to Paul Green for some information about VOS. Thanks to Yanick Champoux for a patch to let Devel::AssertOS support negative assertions. Thanks to Brian Fraser for adding Android support. Thanks to Dale Evans for Debian detection, a bunch of Mac OS X specific version detection modules, and perl 5.6 support. Thanks to Graham Knop for fixing a build bug on perl 5.8. =head1 SOURCE CODE REPOSITORY L =head1 COPYRIGHT and LICENCE Copyright 2007-2020 David Cantrell This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively. =head1 HATS I recommend buying a Fedora from L. =head1 CONSPIRACY This module is also free-as-in-mason software. =cut 1; signature.t100644001751001751 45513667351766 17745 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/author#!perl -w # This file was automatically generated by Dist::Zilla::Plugin::AuthorSignatureTest use strict; use warnings; use Test::More; unless (eval { require Test::Signature; 1 }) { plan skip_all => 'Test::Signature is required for this test'; } Test::Signature::signature_ok(); done_testing; release000755001751001751 013667351766 15551 5ustar00ioanioan000000000000Linux-Systemd-1.201600/xtkwalitee.t100644001751001751 32013667351766 17656 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/release# this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.12 use strict; use warnings; use Test::More 0.88; use Test::Kwalitee 1.21 'kwalitee_ok'; kwalitee_ok( qw( -has_readme ) ); done_testing; 00-report-prereqs.t100644001751001751 1342613667351766 17523 0ustar00ioanioan000000000000Linux-Systemd-1.201600/t#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass; # vim: ts=4 sts=4 sw=4 et: AssertOS.pm100644001751001751 456613667351766 17522 0ustar00ioanioan000000000000Linux-Systemd-1.201600/inc/Develpackage # Devel::AssertOS; use Devel::CheckOS; use strict; use warnings; our $VERSION = '1.21'; =head1 NAME Devel::AssertOS - require that we are running on a particular OS =head1 DESCRIPTION Devel::AssertOS is a utility module for Devel::CheckOS and Devel::AssertOS::*. It is nothing but a magic C that lets you do this: use Devel::AssertOS qw(Linux FreeBSD Cygwin); which will die unless the platform the code is running on is Linux, FreeBSD or Cygwin. To assert that the OS is B a specific platform, prepend the platform name with a minus sign. For example, to run on anything but Amiga, do: use Devel::AssertOS qw(-Amiga); =cut sub import { shift; die("Devel::AssertOS needs at least one parameter\n") unless(@_); my @oses = @_; my ( @must, @must_not ); for my $os ( @oses ) { if ( $os =~ s/^-// ) { push @must_not, $os; } else { push @must, $os; } } Devel::CheckOS::die_if_os_is(@must_not) if @must_not; Devel::CheckOS::die_if_os_isnt(@must) if @must; } =head1 BUGS and FEEDBACK I welcome feedback about my code, including constructive criticism. Bug reports should be made using L. You will need to include in your bug report the exact value of $^O, what the OS is called (eg Windows Vista 64 bit Ultimate Home Edition), and, if relevant, what "OS family" it should be in and who wrote it. If you are feeling particularly generous you can encourage me in my open source endeavours by buying me something from my wishlist: L =head1 SEE ALSO $^O in L L L L The use-devel-assertos script L =head1 AUTHOR David Cantrell EFE Thanks to David Golden for suggesting that I add this utility module. =head1 COPYRIGHT and LICENCE Copyright 2007 David Cantrell This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively. =head1 CONSPIRACY This module is also free-as-in-mason software. =cut $^O; perl-daemon.service100644001751001751 27613667351766 20003 0ustar00ioanioan000000000000Linux-Systemd-1.201600/eg[Unit] Description = Test service for systemd Perl bindings [Service] Type = notify ExecStart = /usr/bin/env perl $PATH_TO/perl-daemon ExecReload = /bin/kill -HUP $MAINPID WatchdogSec = 30 pod-no404s.t100644001751001751 52713667351766 17553 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/author#!perl use strict; use warnings; use Test::More; foreach my $env_skip ( qw( SKIP_POD_NO404S AUTOMATED_TESTING ) ){ plan skip_all => "\$ENV{$env_skip} is set, skipping" if $ENV{$env_skip}; } eval "use Test::Pod::No404s"; if ( $@ ) { plan skip_all => 'Test::Pod::No404s required for testing POD'; } else { all_pod_files_ok(); } 00-report-prereqs.dd100644001751001751 565413667351766 17633 0ustar00ioanioan000000000000Linux-Systemd-1.201600/tdo { my $x = { 'build' => { 'requires' => { 'Module::Build' => '0.28' } }, 'configure' => { 'requires' => { 'ExtUtils::PkgConfig' => '0', 'Module::Build' => '0.28' } }, 'develop' => { 'requires' => { 'Dist::Zilla' => '5', 'Dist::Zilla::Plugin::Prereqs' => '0', 'Dist::Zilla::PluginBundle::Author::IOANR' => '0', 'Software::License::LGPL_2_1' => '0', 'Test::EOL' => '0', 'Test::Kwalitee' => '1.21', 'Test::Mojibake' => '0', 'Test::More' => '0.96', 'Test::NoTabs' => '0', 'Test::Pod::No404s' => '0', 'Test::Portability::Files' => '0', 'Test::Signature' => '0', 'Test::Synopsis' => '0', 'Test::Vars' => '0', 'Test::Version' => '1', 'strict' => '0', 'warnings' => '0' } }, 'runtime' => { 'requires' => { 'Carp' => '0', 'Exporter' => '0', 'File::Basename' => '0', 'Moo' => '0', 'XSLoader' => '0', 'perl' => 'v5.16.0', 'strictures' => '2' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Test::CheckDeps' => '0.010', 'Test::Fatal' => '0', 'Test::More' => '0.94', 'strict' => '0', 'warnings' => '0' } } }; $x; }portability.t100644001751001751 26713667351766 20307 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/authoruse strict; use warnings; use Test::More; eval 'use Test::Portability::Files'; plan skip_all => 'Test::Portability::Files required for testing portability' if $@; run_tests(); unused-vars.t100644001751001751 36213667351766 20333 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/release#!perl use Test::More 0.96 tests => 1; eval { require Test::Vars }; SKIP: { skip 1 => 'Test::Vars required for testing for unused vars' if $@; Test::Vars->import; subtest 'unused vars' => sub { all_vars_ok(); }; }; test-version.t100644001751001751 63713667351766 20410 0ustar00ioanioan000000000000Linux-Systemd-1.201600/xt/authoruse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 0, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Systemd000755001751001751 013667351766 16773 5ustar00ioanioan000000000000Linux-Systemd-1.201600/lib/LinuxDaemon.pm100644001751001751 531113667351766 20674 0ustar00ioanioan000000000000Linux-Systemd-1.201600/lib/Linux/Systemdpackage Linux::Systemd::Daemon 1.201600; # ABSTRACT: Systemd daemon API use v5.16; use strictures 2; use Exporter 'import'; use XSLoader; our @EXPORT = qw/sd_notify/; our @EXPORT_OK = qw/sd_notify sd_ready sd_stopping sd_reloading sd_status sd_watchdog/; our %EXPORT_TAGS = (all => [qw/sd_notify sd_ready sd_stopping sd_reloading sd_status sd_watchdog/]); XSLoader::load; # TODO optimise by pushing this into the XS # *sd_notify = \&Linux::Systemd::Daemon::notify; sub sd_notify { my %hash = @_; my $str; for my $k (keys %hash) { $str .= uc($k) . "=$hash{$k}\n"; } return notify($str); } sub sd_watchdog { return notify('WATCHDOG=1'); } sub sd_ready { return notify('READY=1'); } sub sd_stopping { return notify('STOPPING=1'); } sub sd_reloading { return notify('RELOADING=1'); } sub sd_status { my $status = shift; return notify("STATUS=$status"); } 1; __END__ =pod =encoding UTF-8 =for :stopwords Ioan Rogers =head1 NAME Linux::Systemd::Daemon - Systemd daemon API =head1 VERSION version 1.201600 =head1 SYNOPSIS use Linux::Systemd::Daemon 'sd_ready'; # program initialisation sd_ready; while (1) { sd_notify(watchdog => 1, status => 'Main loop running'); # do something here } sd_notify(stopping => 1, status => 'Shutting down...'); =head1 DESCRIPTION An XS wrapper for L, the systemd daemon interface. Exports one function, L, by default. A variety of convenience functions are also available for import, either individually or with the C<:all> tag. For a fully featured example, see the C script and C examples in C. =head1 FUNCTIONS =head2 C The main function, exported by default. Takes a list of pairs and converts them to a string to be passed to the C function L e.g. sd_notify(ready => 1, status => 'Processing requests'); =head2 C Convenience function. Optional export. =head2 C Convenience function. Optional export. =head2 C Convenience function. Optional export. =head2 C Convenience function. Optional export. =head2 C Convenience function. Optional export. =head1 SEE ALSO https://www.freedesktop.org/software/systemd/man/sd-daemon.html =head1 AUTHOR Ioan Rogers =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2020 by Ioan Rogers. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999 =cut Daemon.xs100644001751001751 56313667351766 20676 0ustar00ioanioan000000000000Linux-Systemd-1.201600/lib/Linux/Systemd#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include MODULE = Linux::Systemd::Daemon PACKAGE = Linux::Systemd::Daemon PROTOTYPES: DISABLE NO_OUTPUT int notify(const char *state) CODE: RETVAL = sd_notify( 0, state ); POSTCALL: if (RETVAL < 0) croak("Error %d while sending notification", RETVAL); AssertOS000755001751001751 013667351766 17011 5ustar00ioanioan000000000000Linux-Systemd-1.201600/inc/DevelLinux.pm100644001751001751 150313667351766 20605 0ustar00ioanioan000000000000Linux-Systemd-1.201600/inc/Devel/AssertOSpackage # Devel::AssertOS::Linux; use Devel::CheckOS; use strict; use warnings; no warnings 'redefine'; our $VERSION = '1.3'; sub subtypes { qw(Android) } sub matches { ('Linux', subtypes()) } sub os_is { ( # order is important Devel::CheckOS::os_is(subtypes()) || $^O =~ /^linux$/i ) ? 1 : 0; } Devel::CheckOS::die_unsupported() unless(os_is()); sub expn { "The operating system has a Linux kernel" } =head1 COPYRIGHT and LICENCE Copyright 2007 - 2014 David Cantrell This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively. =cut 1; Android.pm100644001751001751 34613667351766 21052 0ustar00ioanioan000000000000Linux-Systemd-1.201600/inc/Devel/AssertOSpackage # Devel::AssertOS::Android; use Devel::CheckOS; use strict; use warnings; no warnings 'redefine'; our $VERSION = '1.2'; sub os_is { $^O =~ /^android$/i ? 1 : 0; } Devel::CheckOS::die_unsupported() unless(os_is()); 1; Journal000755001751001751 013667351766 20405 5ustar00ioanioan000000000000Linux-Systemd-1.201600/lib/Linux/SystemdRead.pm100644001751001751 561213667351766 21762 0ustar00ioanioan000000000000Linux-Systemd-1.201600/lib/Linux/Systemd/Journalpackage Linux::Systemd::Journal::Read 1.201600; # ABSTRACT: Read from systemd journals # TODO make sure all text is utf8 use v5.10.2; use Moo; use Carp; use XSLoader; XSLoader::load; sub BUILD { return __open(); } sub get_next_entry { my $self = shift; if ($self->next > 0) { return $self->get_entry; } return; } # TODO # sd_journal_add_match(), sd_journal_add_disjunction() and sd_journal_add_conjunction( # wrap these so we can specify a either a search string, like: # match(PRIORITY=5 NOT SYSLOG_IDENTIFIER=KERNEL) # or maybe something like... # match(priority => 5, syslog_identifier => 'KERNEL')->not(something => idontwant) sub _match { my $self = shift; # matches will be an array of [key, value] arrayrefs my @matches; if (scalar @_ == 1 && ref $_[0]) { my $ref = ref $_[0]; if ($ref eq 'ARRAY') { # already an arrayref push @matches, $_[0]; } elsif ($ref eq 'HASH') { # hashref, convert to array my @array = map { $_ => $_[0]->{$_} } keys %{$_[0]}; push @matches, \@array; } } elsif (scalar @_ % 2 == 0) { say "even sized list"; while (@_) { push @matches, [shift, shift]; } } croak 'Invalid params' unless @matches; # $key = uc $key; foreach my $pair (@matches) { __add_match(uc($pair->[0]) . "=" . $pair->[1]); } } sub match { my $self = shift; return $self->_match(@_); } sub match_and { my $self = shift; __match_and(); return $self->_match(@_); } sub match_or { my $self = shift; __match_or(); return $self->_match(@_); } 1; __END__ =pod =encoding UTF-8 =for :stopwords Ioan Rogers =head1 NAME Linux::Systemd::Journal::Read - Read from systemd journals =head1 VERSION version 1.201600 =head1 METHODS =head2 c Returns the number of bytes used by the open journal =head2 C Seeks to the start of the open journal. =head2 C Seeks to the end of the open journal. =head2 C Moves to the next record. =head2 C Returns the value of C<$field> from the current record. See L for a list of well-known fields. =head2 C Returns a hashref of all the fields in the current entry. This method is not a direct wrap of the journal API. =head2 C Convenience wrapper which calls L before L This method is not a direct wrap of the journal API. =head2 C value)> =head2 C value)> =head2 C value)> =head2 C Clears the match filters. =head1 AUTHOR Ioan Rogers =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2020 by Ioan Rogers. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999 =cut Read.xs100644001751001751 727313667351766 22005 0ustar00ioanioan000000000000Linux-Systemd-1.201600/lib/Linux/Systemd/Journal#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include sd_journal *j; void split_data_to_svs(const char *msg, SV **k_sv, SV **v_sv) { char *data_copy = strdup(msg); char *k = strtok(data_copy, "="); char *v = strtok(NULL, "="); (*k_sv) = newSVpv(k, strlen(k)); (*v_sv) = newSVpv(v, strlen(v)); } MODULE = Linux::Systemd::Journal::Read PACKAGE = Linux::Systemd::Journal::Read PROTOTYPES: ENABLE NO_OUTPUT void __open() CODE: int r = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY); if (r < 0) croak("Failed to open journal: %s\n", strerror(r)); // // NO_OUTPUT void // __open_files(path) // CODE: // int r = sd_journal_open_files(&j, path, SD_JOURNAL_LOCAL_ONLY); // if (r < 0) // croak("Failed to open journal: %s\n", strerror(r)); uint64_t get_usage(self) CODE: int r = sd_journal_get_usage(j, &RETVAL); if (r < 0) croak("Failed to open journal: %s\n", strerror(-r)); OUTPUT: RETVAL int next(self, uint64_t skip=0) CODE: if (skip > 0) RETVAL = sd_journal_next_skip(j, skip); else RETVAL = sd_journal_next(j); POSTCALL: if (RETVAL < 0) croak("Failed to move to next record: %s\n", strerror(-RETVAL)); OUTPUT: RETVAL int previous(self, uint64_t skip=0) CODE: if (skip > 0) RETVAL = sd_journal_previous_skip(j, skip); else RETVAL = sd_journal_previous(j); POSTCALL: if (RETVAL < 0) croak("Failed to move to previous record: %s\n", strerror(-RETVAL)); OUTPUT: RETVAL NO_OUTPUT void seek_head(self) CODE: int r = sd_journal_seek_head(j); if (r < 0) croak("Failed to seek to journal head: %s\n", strerror(-r)); NO_OUTPUT void seek_tail(self) CODE: int r = sd_journal_seek_tail(j); if (r < 0) croak("Failed to seek to journal tail: %s\n", strerror(-r)); NO_OUTPUT void wait(self) CODE: int r = sd_journal_wait(j, (uint64_t) -1); if (r < 0) croak("Failed to wait for changes: %s\n", strerror(-r)); SV * get_data(self, const char *field) CODE: SV *key_sv; char *data; size_t l; int r = sd_journal_get_data(j, field, (const void**) &data, &l); if (r < 0) croak("Failed to read message field '%s': %s\n", field, strerror(-r)); split_data_to_svs(data, &key_sv, &RETVAL); OUTPUT: RETVAL HV * get_entry(self) PREINIT: const void *data; size_t l; SV *key_sv, *val_sv; int r; CODE: RETVAL = newHV(); sd_journal_restart_data(j); while ((r = sd_journal_enumerate_data(j, &data, &l)) > 0) { split_data_to_svs(data, &key_sv, &val_sv); hv_store_ent(RETVAL, key_sv, val_sv, 0); } if (r < 0) croak("Failed to get entry data: %s\n", strerror(-r)); OUTPUT: RETVAL # TODO should take binary data as well NO_OUTPUT void __add_match(const char *data) CODE: int r = sd_journal_add_match(j, data, 0); if (r < 0) croak("Failed to add a match: %s\n", strerror(-r)); NO_OUTPUT void __match_and() CODE: int r = sd_journal_add_conjunction(j); if (r < 0) croak("Failed to set conjunction: %s\n", strerror(-r)); NO_OUTPUT void __match_or() CODE: int r = sd_journal_add_disjunction(j); if (r < 0) croak("Failed to set disjunction: %s\n", strerror(-r)); NO_OUTPUT void flush_matches(self) CODE: sd_journal_flush_matches(j); NO_OUTPUT void DESTROY(self) CODE: sd_journal_close(j); Write.pm100644001751001751 1236613667351766 22225 0ustar00ioanioan000000000000Linux-Systemd-1.201600/lib/Linux/Systemd/Journalpackage Linux::Systemd::Journal::Write 1.201600; # ABSTRACT: XS wrapper around sd-journal # TODO Helper script to generate message catalogs? # http://www.freedesktop.org/wiki/Software/systemd/catalog/ # TODO make sure all text is utf8 use v5.10.1; use Moo; use Carp; use XSLoader; XSLoader::load; has app_id => ( is => 'ro', lazy => 1, default => sub { require File::Basename; return File::Basename::basename($0); }, ); has priority => ( is => 'ro', lazy => 1, default => 6, isa => sub { die 'Invalid log level' unless (defined $_[0] && $_[0] =~ /^[0-7]$/); }, ); has caller_details => ( is => 'ro', default => 1, ); has caller_level => ( is => 'ro', default => 0, ); sub print { my ($self, $msg, $pri) = @_; $pri //= $self->priority; __sd_journal_print($pri, $msg); return 1; } sub send { my $self = shift; my $data; if (scalar @_ == 2 && !ref $_[0]) { my $ref = ref $_[1]; if ($ref eq 'HASH') { $data = {%{$_[1]}}; } elsif ($ref eq 'ARRAY') { $data = {@{$_[1]}}; } $data->{message} = $_[0]; } elsif (scalar @_ > 1) { $data = {@_}; } else { my $ref = ref $_[0]; if (!$ref) { $data->{message} = shift; } elsif ($ref eq 'HASH') { $data = shift; } elsif ($ref eq 'ARRAY') { $data = {@{$_[0]}}; } } croak 'Invalid params' unless defined $data; # message is required if (!exists $data->{message} && !exists $data->{MESSAGE}) { croak 'Missing message param'; } # XXX this isn't required by sd-journal if (!exists $data->{priority} && !exists $data->{PRIORITY}) { $data->{priority} = $self->priority; } if (!exists $data->{syslog_identifier}) { $data->{syslog_identifier} = $self->app_id; } if ($self->caller_details) { my @caller = caller($self->caller_level); $data->{CODE_LINE} = $caller[2]; $data->{CODE_FILE} = $caller[1]; @caller = caller($self->caller_level + 1); $data->{CODE_FUNC} = $caller[3]; } # flatten it out my @array = map { uc($_) . '=' . ($data->{$_} // 'undef') } keys %$data; __sd_journal_send(\@array); return 1; } sub perror { __sd_journal_perror($_[1]); return 1; } 1; __END__ =pod =encoding UTF-8 =for :stopwords Ioan Rogers =head1 NAME Linux::Systemd::Journal::Write - XS wrapper around sd-journal =head1 VERSION version 1.201600 =head1 SYNOPSIS use Linux::Systemd::Journal::Write; my $jnl = Linux::Systemd::Journal::Write->new; # basic log messages $jnl->print('flarg'); # with default log level $jnl->print('Hello world', 4); # WARN level # add abitrary data to the log entry my %hash = (DAY_ONE => 'Monday', DAY_TWO => 'Tuesday', DAY_THREE => 'Wednesday'); $jnl->send('Here is a message', \%hash); # add abitrary data to the log entry # will log "Failed to open file: No such file or directory" and ERRNO=2 open my $fh, '<', 'nosuchfile' or $jnl->perror('Failed to open file'); =head1 DESCRIPTION =head2 Log Levels The log levels use by C and by L are the same as those use by C, so instead of using numeric priorities you can use Sys::Syslog ':macros'; giving you access to the C L<"level constants"|Sys::Syslog/Levels> =head1 ATTRIBUTES =head2 C Will be used to set C. Defaults to C; =head2 C Default log priority. See L =head2 C Boolean controlling whether to log the C, C, and C of the L. Optional. Defaults to C; See also L =head2 C If this module is not being used directly, but through some proxy module for instance, C is used to determine the number of frames to look back through. Optional. Defaults to C<0>; =head1 METHODS =head2 C $msg should be either a string. $pri is optional, and defaults to $self->priority =head2 C If there is one arg, it may be a simple string to log. Or, it could be a hashref or an arrayref. In this case, one of the keys sent MUST be 'message'. If there are two args, the first must be the string to use as a message, the second a hashref or arrayref. In this case, a key called message should not be set. Finally, C can also be called with an array of key => values, one of which must be message. Keys will be uppercased. =head2 C Logs the string of the current set C, prefixed with C<$msg>. =head1 SEE ALSO =over 4 =item * L At some point between me writing this module and getting around to releasing it, another module was released to write the journal. =item * L The main C page. =item * L Man page of the C API =back =head1 AUTHOR Ioan Rogers =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2020 by Ioan Rogers. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999 =cut Write.xs100644001751001751 222013667351766 22207 0ustar00ioanioan000000000000Linux-Systemd-1.201600/lib/Linux/Systemd/Journal#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #define SD_JOURNAL_SUPPRESS_LOCATION #include MODULE = Linux::Systemd::Journal::Write PACKAGE = Linux::Systemd::Journal::Write PROTOTYPES: DISABLE NO_OUTPUT int __sd_journal_print(int pri, const char *msg, ...) CODE: RETVAL = sd_journal_print( pri, "%s", msg ); POSTCALL: if (RETVAL < 0) croak("Error %d while sending message", RETVAL); NO_OUTPUT int __sd_journal_perror(const char *msg) CODE: RETVAL = sd_journal_perror(msg ); POSTCALL: if (RETVAL < 0) croak("Error %d while sending message", RETVAL); NO_OUTPUT int __sd_journal_send(AV *data) CODE: int array_size = av_len(data) + 1; struct iovec iov[array_size]; for (int i = 0; i < array_size; i++) { SV *s = av_shift(data); char *str = SvPV(s, SvLEN(s)); iov[i].iov_base = str; iov[i].iov_len = strlen(str); } RETVAL = sd_journal_sendv(iov, array_size); POSTCALL: if (RETVAL < 0) croak("Error sending message: %s", strerror(RETVAL));