Hi all,

I am writing a kernel module to redirect common system calls to my custom 
syscalls using "sysent" array. It is working fine for 64bit syscalls.

Now, I am going to write the same for 32bit syscalls.
My problem is I can't redirect/trace 32bit sys calls in my module.

Is there any way to do this?

I tried the following but it didn't worked.   (mkdir sys call example)

[i]#ifdef _SYSCALL32_IMPL
  old_call=(int (*)())sysent32[SYS_mkdir].sy_call;
  old_call_c=(int64_t (*)())sysent32[SYS_mkdir].sy_callc;
endif[/i]




[b]My actual __init() looks like:-[/b]


int
_init() {

  register int ret;
  ret=mod_install(&modlinkage);

  /* Save the old syscall function pointer: */

  old_call=(int (*)())sysent[SYS_mkdir].sy_call;
  old_call_c=(int64_t (*)())sysent[SYS_mkdir].sy_callc;

  #ifdef _SYSCALL32_IMPL
  old_call=(int (*)())sysent32[SYS_mkdir].sy_call;
  old_call_c=(int64_t (*)())sysent32[SYS_mkdir].sy_callc;
  #endif

  /* Show in the new one: */

  sysent[SYS_mkdir].sy_call=(int (*)())new_mkdir;
  sysent[SYS_mkdir].sy_callc=(int64_t (*)())new_mkdir;

  #ifdef _SYSCALL32_IMPL
  sysent32[SYS_mkdir].sy_call=(int (*)())new_mkdir;
  sysent32[SYS_mkdir].sy_callc=(int64_t (*)())new_mkdir;
  #endif

  cmn_err(CE_CONT, "mydrv _init successful. rc=%d\n", ret);
  cmn_err(CE_NOTE, "old_mkdir_call=0x%p, old_mkdir_call_c=0x%p, 
new_mkdir_call=0x%p, new_mkdir_call_c=0x%p\n", old_call, old_call_c, 
sysent[SYS_mkdir].sy_call, sysent[SYS_mkdir].sy_callc);


  return ret;

}


Thanks in advance...
-- 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to