2024-02-08 09:01:44 -05:00
|
|
|
/*
|
|
|
|
* glacier_runtime.h - Runtime function declarations for libglacier
|
|
|
|
*
|
|
|
|
* This file is part of Glacier.
|
|
|
|
*
|
|
|
|
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU General Public License as published by the Free Software Foundation, either
|
|
|
|
* 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with Glacier. If
|
|
|
|
* 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:
|
2024-12-05 17:41:44 -05:00
|
|
|
* None. (void)
|
2024-07-21 22:35:38 -04:00
|
|
|
* RETURN VALUES:
|
2024-12-05 17:41:44 -05:00
|
|
|
* 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:
|
2024-12-05 17:41:44 -05:00
|
|
|
* 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
|
|
|
*/
|
|
|
|
|
2024-12-05 17:41:44 -05: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:
|
2024-12-05 17:41:44 -05:00
|
|
|
* None. (void)
|
2024-10-08 13:36:28 -04:00
|
|
|
* RETURN VALUES:
|
2024-12-05 17:41:44 -05:00
|
|
|
* 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:
|
2024-12-05 17:41:44 -05:00
|
|
|
* // 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
|
|
|
*/
|
|
|
|
|
2024-12-05 17:41:44 -05:00
|
|
|
int is_process_root(void);
|
2024-10-08 13:36:28 -04:00
|
|
|
|
2024-07-21 22:35:38 -04:00
|
|
|
#endif
|