implicit declaration of function 'reboot'


 
Thread Tools Search this Thread
Top Forums Programming implicit declaration of function 'reboot'
# 1  
Old 01-07-2009
implicit declaration of function 'reboot'

Hi,
I'm tying to use the following function to reboot the system as part of my code
Code:
#include <unistd.h>
#include <linux/reboot.h>
int restart(unsigned int delay)
{
  sleep(delay);
  return reboot(LINUX_REBOOT_CMD_RESTART);
}

When I try to compile the code I get the warning in the thread topic. However the code compiles and runs just fine. Flexelint also picks up the warning with the following message:
Info 718: reboot undeclared, assumed to return int
Info 746: Call to function 'reboot' not made in the presence of a prototype

Does anyone know what's wrong? Thanks!
# 2  
Old 01-07-2009
Nothing is wrong. Your compilers are trying to "help" you by warning you of using function calls that have not properly been defined. Apparently, the linux/reboot.h header file doesn't include a function definition for reboot. You can fix this with:
Code:
#include <unistd.h>
#include <linux/reboot.h>
int reboot(int);
int restart(unsigned int delay)
{
  sleep(delay);
  return reboot(LINUX_REBOOT_CMD_RESTART);
}

# 3  
Old 01-07-2009
Thanks. I looked at the linux/reboot.h header file and indeed there's no reboot definition. However the sys/reboot.h header file holds the definition so I've included that as well and now it works.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Implicit FTPS error on Citrix Sharefile

Hi, I have to upload a file to a remote Citrix Sharefile server using implicit FTPS. But the problem I'm facing is that when the FTPS UNIX script is called through a GUI tool; it keeps on running and after forcibly killing that job, if I try to connect the same server directly from the UNIX box... (1 Reply)
Discussion started by: dips_ag
1 Replies

2. UNIX for Advanced & Expert Users

FTP over implicit TLS

Here are the essentials: un: myuser pw: mypasswd site: sftp.somesite.com port: 990 type: FTPS enc: FTP over implicit TLS program used: Curl 7.1.x on Hpux 11.31 I would like to "put" 1 file on there server. Here is my syntax, what am I doing wrong? curl -3 -v --cacert... (4 Replies)
Discussion started by: olyanderson
4 Replies

3. UNIX for Dummies Questions & Answers

FTP over implicit TSL - for dummies

Here are the essentials: un: myuser pw: mypasswd site: sftp.somesite.com port: 990 type: FTPS enc: FTP over implicit TLS program used: Curl 7.1.x on Hpux 11.31 I would like to "put" 1 file on there server. Here is my syntax, what am I doing wrong? curl -3 -v --cacert... (5 Replies)
Discussion started by: olyanderson
5 Replies

4. Shell Programming and Scripting

Function prototype declaration

Hi All, I have the script as below #!bin/bash let k=9 if then echo "Start" Hello echo "End" else echo "failed" fi function Hello() { echo "hello !!!!" } I got the below error : (4 Replies)
Discussion started by: Balasankar
4 Replies

5. SuSE

RPM implicit dependencies

Hi, I'm having issues with implicit dependencies for my RPM package. This is the error I'm getting: error: Failed dependencies: libclntsh.so.11.1()(64bit) is needed by geomatica-10.4-0.x86_64 Our software has a dynamically loaded library which links to the Oracle's libclntsh.so.11.1... (2 Replies)
Discussion started by: pneveu
2 Replies

6. UNIX for Dummies Questions & Answers

difficult problem with function declaration

Hello, I have a problem with the declaration of a function. This is how I declare the function : c:63: void foo(threadpool *tp,void (*func)(void*), (void*)arg); Inside main, I call it like this: main(){ .......... threadpool y; c:104: ... (4 Replies)
Discussion started by: garag11
4 Replies

7. Shell Programming and Scripting

FTP/implicit SSL

Hi, I want to FTP can some one help me how do I do this manually from unix command line Thanks, (2 Replies)
Discussion started by: sridatos
2 Replies

8. AIX

Implicit login in AIX

only wanted to know .. if I have some tivoli jobs running with different user .. will this mean that everytime the job invokes .. the .profile runs for that user ... or is it that the .profile runs only at explicit LOGINs ... e.g if a cron calls a job under some user, does it run the .profile of... (1 Reply)
Discussion started by: rajesh_149
1 Replies

9. Shell Programming and Scripting

Implicit Ping

Hi All I want some help in writing a script that will: 1. Implicitly ping a server to see if it is up or not. (I have blocked all ICMP traffic on that box) 2. if the server is down send an alert mail to users I have looked and looked but I could not get any way to do this. What I have... (2 Replies)
Discussion started by: skotapal
2 Replies

10. Programming

gcc warnings: implicit declaration of function...

I am having strange warnings from gcc compiler, which I don't think should come while cmpiling. Can anyone help? The warnings are: - warning: implicit declaration of function 'bzero' - warning: implicit declaration of function 'inet_addr' The code is as below: int main(int argc, char... (2 Replies)
Discussion started by: Ahsan
2 Replies
Login or Register to Ask a Question