Question

I write the code in the below manner but output prints in console only two times. Please friends help me

#include <mach/mach_types.h>
#include<libkern/libkern.h>

kern_return_t MyIntension_start(kmod_info_t * ki, void *d);

kern_return_t MyIntension_stop(kmod_info_t *ki, void *d);

kern_return_t MyIntension_start(kmod_info_t * ki, void *d)
{
    for(int i = 0 ;i < 10 ;i++)
    {
        printf("welcome to apple world\n");
    }
    return KERN_SUCCESS;
}


kern_return_t MyIntension_stop(kmod_info_t *ki, void *d)
{
    for(int i = 0 ;i < 10 ;i++)
    {
        printf("good bye to cruel apple world\n");
    }   
    return KERN_SUCCESS;
}
Was it helpful?

Solution

execute the same code two times then you get four lines.

kern_return_t MyIntension_start(kmod_info_t * ki, void *d);

kern_return_t MyIntension_stop(kmod_info_t *ki, void *d);

kern_return_t MyIntension_start(kmod_info_t * ki, void *d)

{

for(int i = 0 ;i < 10 ;i++)
{

printf("welcome to apple world\n");


       }


return KERN_SUCCESS;


}
kern_return_t MyIntension_stop(kmod_info_t *ki, void *d)

{

for(int i = 0 ;i < 10 ;i++)

{

printf("good bye to cruel apple world\n");

}

return KERN_SUCCESS;

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top