Link to home
Start Free TrialLog in
Avatar of hagaiy
hagaiy

asked on

problem using the "reboot" subroutine.

hello.

i have an aix5.1 os running on a pseries 610 mechine.
i am trying to write a program that will use the reboot subrotine, this is the program :

#include <sys/reboot.h>
#include <stdlib.h>

void main()
{
   reboot(RB_SOFTIPL,NULL);
}

i am getting this error when trying to compile it :

/usr/include/sys/reboot.h:29: parse error before "caddr_t"
/usr/include/sys/reboot.h:32: parse error before '}' token

this is the reboot.h file :

#ifndef _H_REBOOT
#define _H_REBOOT

#define RB_SOFTIPL      0
#define RB_HALT         1
#define RB_POWIPL       2
#define RB_HARDIPL      3
#define RB_HALT_POWERED 4
#define RB_UPDATE_FLASH 5

typedef struct {
        caddr_t uf_strt_ptr;            /* Pointer to start of image */
        ulong   uf_img_len;             /* Length of image           */
        void    *uf_xmem;               /* Pointer to cross mem desc */
} update_flash_t;

#ifdef _LINUX_SOURCE_COMPAT
extern int __linux_reboot(int);
#define reboot(a) __linux_reboot((a))

#define LINUX_REBOOT_CMD_RESTART RB_SOFTIPL
#define LINUX_REBOOT_CMD_HALT RB_HALT_POWERED
#define LINUX_REBOOT_CMD_POWER_OFF RB_HALT
#define LINUX_REBOOT_CMD_RESTART2 RB_POWIPL
#define LINUX_REBOOT_CMD_CAD_ON 90      /* AIX does not offer CAD
reboot */
#define LINUX_REBOOT_CMD_CAD_OFF 91
#endif

anyone knows what is the problem ?

tx.
hagaiy.
Avatar of Santunes
Santunes

rename your source file to .C or .cpp
Avatar of hagaiy

ASKER

i have solved my problem by including the sys/types.h file.
tx.
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial