Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lnet / libcfs / winnt / winnt-usr.c
1
2 #ifndef __KERNEL__
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <io.h>
7 #include <time.h>
8 #include <windows.h>
9
10 void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
11                               const int line, unsigned long stack,
12                               char *format, ...) {
13     }
14
15 int cfs_proc_mknod(const char *path, unsigned short  mode,  unsigned int dev)
16 {
17     return 0;
18 }
19
20
21 void print_last_error(char* Prefix)
22 {
23     LPVOID lpMsgBuf;
24
25     FormatMessage( 
26         FORMAT_MESSAGE_ALLOCATE_BUFFER |
27         FORMAT_MESSAGE_FROM_SYSTEM |
28         FORMAT_MESSAGE_IGNORE_INSERTS,
29         NULL,
30         GetLastError(),
31         0,
32         (LPTSTR) &lpMsgBuf,
33         0,
34         NULL
35         );
36
37     printf("%s %s", Prefix, (LPTSTR) lpMsgBuf);
38
39     LocalFree(lpMsgBuf);
40 }
41
42 //
43 // The following declarations are defined in io.h of VC
44 // sys/types.h will conflict with io.h, so we need place
45 // these declartions here.
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50     void
51     __declspec (naked) __cdecl _chkesp(void)
52     {
53 #if _X86_
54         __asm {  jz      exit_chkesp     };
55         __asm {  int     3               };
56     exit_chkesp:
57         __asm {  ret                     };
58 #endif
59     }
60 #ifdef __cplusplus
61 }
62 #endif
63
64 unsigned int sleep (unsigned int seconds)
65 {
66     Sleep(seconds * 1000);
67     return 0;
68 }
69
70 int gethostname(char * name, int namelen)
71 {
72     return 0;
73 }
74
75 int ioctl (
76     int handle,
77     int cmd,
78     void *buffer
79     )
80 {
81     printf("hello, world\n");
82     return 0;
83 }
84
85 #endif /* __KERNEL__ */