problem using the "reboot" subroutine.

hagaiy
hagaiy used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
rename your source file to .C or .cpp

Author

Commented:
i have solved my problem by including the sys/types.h file.
tx.
Commented:
PAQ'd and points refunded

modulo

Community Support Moderator
Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial