iPXE
poweroff_cmd.c File Reference

Power off command. More...

#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/reboot.h>

Go to the source code of this file.

Data Structures

struct  poweroff_options
 "poweroff" options More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
static int poweroff_exec (int argc, char **argv)
 The "poweroff" command.
 COMMAND (poweroff, poweroff_exec)
 "poweroff" command

Variables

static struct option_descriptor poweroff_opts [] = {}
 "poweroff" option list
static struct command_descriptor poweroff_cmd
 "poweroff" command descriptor

Detailed Description

Power off command.

Definition in file poweroff_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ poweroff_exec()

int poweroff_exec ( int argc,
char ** argv )
static

The "poweroff" command.

Parameters
argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 57 of file poweroff_cmd.c.

57 {
59 int rc;
60
61 /* Parse options */
62 if ( ( rc = parse_options ( argc, argv, &poweroff_cmd, &opts ) ) != 0 )
63 return rc;
64
65 /* Power off system */
66 rc = poweroff();
67 if ( rc != 0 )
68 printf ( "Could not power off: %s\n", strerror ( rc ) );
69
70 return rc;
71}
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
static union @024010030001061367220137227263210031030210157031 opts
"cert<xxx>" option list
int poweroff(void)
Power off system.
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition parseopt.c:485
static struct command_descriptor poweroff_cmd
"poweroff" command descriptor
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
"poweroff" options
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition vsprintf.c:465

References opts, parse_options(), poweroff(), poweroff_cmd, printf(), rc, and strerror().

Referenced by COMMAND().

◆ COMMAND()

COMMAND ( poweroff ,
poweroff_exec  )

"poweroff" command

References poweroff(), and poweroff_exec().

Variable Documentation

◆ poweroff_opts

struct option_descriptor poweroff_opts[] = {}
static

"poweroff" option list

Definition at line 44 of file poweroff_cmd.c.

44{};

◆ poweroff_cmd

struct command_descriptor poweroff_cmd
static
Initial value:
=
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition parseopt.h:109
static struct option_descriptor poweroff_opts[]
"poweroff" option list

"poweroff" command descriptor

Definition at line 47 of file poweroff_cmd.c.

Referenced by poweroff_exec(), and PROVIDE_REQUIRING_SYMBOL().