libglacier/include/glacier_runtime.h

70 lines
1.9 KiB
C

/*
* 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.
* PARAMETERS:
* None. (void)
* RETURN VALUES:
* 0 on one or more runtime files missing, 1 on all runtime files exist
* CAVEATS:
* None.
* EXAMPLE:
* if (runtime_exists() == 0) {
* errlog("One or more runtime files missing");
* return 1;
* }
* else {
* successlog("All runtime files present");
* return 0;
* }
*/
int runtime_exists(void);
/*
* is_process_root
*
* DESCRIPTION: is_process_root checks if the process is running with root privileges.
* PARAMETERS:
* None. (void)
* RETURN VALUES:
* 0 on process is not running as root, 1 on process is running as root
* 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");
* }
*/
int is_process_root(void);
#endif