~ubuntu-branches/ubuntu/lucid/loop-aes-utils/lucid-security

« back to all changes in this revision

Viewing changes to lib/my_reboot.c

  • Committer: Bazaar Package Importer
  • Author(s): Max Vozeler
  • Date: 2008-08-22 11:57:17 UTC
  • mfrom: (8.1.3 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080822115717-v8wfa8pxwlfvyje0
Tags: 2.13.1-4
* patches/losetup_add_option_f.dpatch: 
  - Added to support "find next free loop" in losetup.
    (closes: #495682)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Including <unistd.h> makes sure that on a glibc system
2
 
   <features.h> is included, which again defines __GLIBC__ */
3
 
#include <unistd.h>
4
 
#include "linux_reboot.h"
5
 
 
6
 
#define USE_LIBC
7
 
 
8
 
#ifdef USE_LIBC
9
 
 
10
 
/* libc version */
11
 
#if defined __GLIBC__ && __GLIBC__ >= 2
12
 
#  include <sys/reboot.h>
13
 
#  define REBOOT(cmd) reboot(cmd)
14
 
#else
15
 
extern int reboot(int, int, int);
16
 
#  define REBOOT(cmd) reboot(LINUX_REBOOT_MAGIC1,LINUX_REBOOT_MAGIC2,(cmd))
17
 
#endif
18
 
int
19
 
my_reboot(int cmd) {
20
 
        return REBOOT(cmd);
21
 
}
22
 
 
23
 
#else /* no USE_LIBC */
24
 
 
25
 
/* direct syscall version */
26
 
#include <linux/unistd.h>
27
 
 
28
 
#ifdef _syscall3
29
 
_syscall3(int,  reboot,  int,  magic, int, magic_too, int, cmd);
30
 
#else
31
 
/* Let us hope we have a 3-argument reboot here */
32
 
extern int reboot(int, int, int);
33
 
#endif
34
 
 
35
 
int
36
 
my_reboot(int cmd) {
37
 
        return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd);
38
 
}
39
 
 
40
 
#endif