Krishna iResearch Intelligent Cloud Platform - VIRtual Generic Os - VIRGO - Linux kernel extensions for cloud
 All Classes
test_virgo_malloc.c
1 /***************************************************************************************
2 VIRGO - VIRtual Generic Os - linux kernel extensions for cloud
3 
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 --------------------------------------------------------------------------------------------------
18 Copyright(C):
19 Srinivasan Kannan (alias) Ka.Shrinivaasan (alias) Shrinivas Kannan
20 Independent Open Source Developer, Researcher and Consultant
21 Ph: 9789346927, 9003082186, 9791165980
22 Open Source Products Profile(Krishna iResearch): http://sourceforge.net/users/ka_shrinivaasan
23 Personal website(research): https://sites.google.com/site/kuja27/
24 emails: ka.shrinivaasan@gmail.com, shrinivas.kannan@gmail.com, kashrinivaasan@live.com
25 --------------------------------------------------------------------------------------------------
26 
27 *****************************************************************************************/
28 
29 #include <stdio.h>
30 #include <sys/syscall.h>
31 #include <unistd.h>
32 #include <string.h>
33 
34 struct virgo_address
35 {
36  int node_id;
37  struct hostport* hstprt;
38  void* addr;
39 };
40 
41 struct hostport
42 {
43  char* hostip;
44  int port;
45 };
46 
47 
48 int main(int argc, char* argv[])
49 {
50 
51  /*
52  virgo_malloc(), virgo_set(), virgo_get() and virgo_free() syscalls called by syscall numbers
53  - Ka.Shrinivaasan
54  */
55 
56  struct virgo_address* vaddr;
57  unsigned long virgo_unique_id;
58  /* virgo_malloc*/
59  syscall(351,1000,&virgo_unique_id,NULL,0,NULL);
60  vaddr=(struct virgo_address*)virgo_unique_id;
61 
62  /*
63  printf("test_virgo_malloc: virgo_unique_id = %u \n", virgo_unique_id);
64  printf("test_virgo_malloc: VIRGO Address obtained by struct virgo_address*, vaddr = %p \n", vaddr);
65  fflush(stdout);
66  */
67 
68  /* virgo_set */
69  char set_data[256];
70  strcpy(set_data,"test_virgo_malloc_data");
71  long set_ret=syscall(352,virgo_unique_id,set_data,NULL,0,NULL);
72 
73  /*
74  printf("set_ret = %ld\n",set_ret);
75  fflush(stdout);
76 
77  /*virgo_get*/
78  char get_data[256];
79  long get_ret=syscall(353,virgo_unique_id,get_data,NULL,0,NULL);
80 
81  /*
82  if(get_data)
83  printf("get_ret = %s\n",get_data);
84  fflush(stdout);
85 
86  /virgo_free/
87  long free_ret=syscall(354,virgo_unique_id,NULL,0,NULL);
88  printf("free_ret = %ld\n",free_ret);
89  fflush(stdout);
90  */
91  return 0;
92 }