libglacier/include/runtime.h

70 lines
1.9 KiB
C
Raw Permalink Normal View History

2024-02-08 09:01:44 -05:00
/*
* runtime.h - Runtime function declarations for libglacier
2024-02-08 09:01:44 -05:00
*
* This file is part of Glacier.
*
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation, either
2024-02-08 09:01:44 -05:00
* version 3 of the License, or (at your option) any later version.
*
* Glacier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
2024-02-08 09:01:44 -05:00
*
* You should have received a copy of the GNU Lesser General Public License along with Glacier. If
2024-02-08 09:01:44 -05:00
* not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GLACIERRUNTIME_H_
#define GLACIERRUNTIME_H_
/*
* runtime_exists
*
* DESCRIPTION: runtime_exists checks if all necessary runtime files exist.
2024-07-21 22:35:38 -04:00
* PARAMETERS:
* None. (void)
2024-07-21 22:35:38 -04:00
* RETURN VALUES:
* 0 on one or more runtime files missing, 1 on all runtime files exist
2024-07-21 22:35:38 -04:00
* CAVEATS:
* None.
* EXAMPLE:
* if (runtime_exists() == 0) {
* errlog("One or more runtime files missing");
* return 1;
* }
* else {
* successlog("All runtime files present");
* return 0;
* }
2024-07-21 22:35:38 -04:00
*/
int runtime_exists(void);
2024-07-21 22:35:38 -04:00
2024-10-08 13:36:28 -04:00
/*
* is_process_root
*
* DESCRIPTION: is_process_root checks if the process is running with root privileges.
* PARAMETERS:
* None. (void)
2024-10-08 13:36:28 -04:00
* RETURN VALUES:
* 0 on process is not running as root, 1 on process is running as root
2024-10-08 13:36:28 -04:00
* CAVEATS:
* None.
* EXAMPLE:
* // Assuming block is running within main(), no values will be returned.
* // If you wish to exit the program if it is not running as root, it would
* // be appropriate to add return values to this block
*
* if (is_process_root() == 0) {
* errlog("Process is not running as root");
* }
* else {
* successlog("Process is running as root");
* }
2024-10-08 13:36:28 -04:00
*/
int is_process_root(void);
2024-10-08 13:36:28 -04:00
2024-07-21 22:35:38 -04:00
#endif