Re: Question about BLCR syscall

From: Paul H. Hargrove (PHHargrove_at_lbl_dot_gov)
Date: Sun May 10 2009 - 10:33:25 PDT

  • Next message: Sergio Daz: "Re: problem migrating jobs"
    To expand on what Eric said:
    In the BLCR library we have a need to call certain existing system calls 
    (including open, close, ioctl and others) at times when the state of libc may 
    not be usable.  For instance, we may not have a valid "errno" variable because 
    the threading library may be less than fully initialized.  For this reason we 
    have functions like __cri_open() which makes the open system call while 
    bypassing libc and taking a pointer to the location to use as errno.
    The cri_syscall() used to invoke BLCR's added kernel functionality is, as Eric 
    mentions, not invoking an added system call.  The approach we have taken is to 
    create the pseudo-file "/proc/checkpoint/ctrl" against which libcr invokes 
    _cri_ioctl() to perform calls to BLCR's kernel module.  For you own use, you 
    might want to try something similar.
    So, we have not added any new system calls to Linux in BLCR and I personally 
    have not done so in any other project.  If you are looking for an example of a 
    kernel module that adds a new system call to Linux, I am not aware of any to 
    I am sorry that we cannot be of more assistance, but perhaps another user on 
    the checkpoint list could provide some guidance?  Anybody?
    Eric Roman wrote:
    > We didn't introduce a new system call to interact with the kernel, instead
    > we use an ioctl() method on the control descriptor.
    > We use the cri_syscall() methods to invoke the ioctl().  Among other things,
    > this allows us to save registers on the stack for restart.
    > Eric
    > On Fri, May 08, 2009 at 02:17:24PM +0800, 李宏亮 wrote:
    >>> These functions declared in libcr/cr_syscall.h are implemented in
    >>> libcr/cr_syscall.c, near the end of the file. The implementations are
    >>> done via macros that generate platform-specific inline assembly. For
    >>> instance:
    >>> cri_syscall3(int, __cri_open, __NR_open, const char*, int, int)
    >>> The inline assembly macros, such as cri_syscall3, are in
    >>> libcr/arch/*/cr_arch.h.
    >>> -Paul
    >> Hello, Professor:
    >> Thank you very much for the explanation, But I have to bother you with another
    >> question about cri_syscall().which I really can not work it out for the whole
    >> morning...
    >> In the Linux kernel source code, there are many basic system calls, each system
    >> call correspond to a System call number, which stored in pointer array
    >> sys_call_table[] in the directory include/linux/sys.h. And when I want to
    >> invoke a system call, first use "int $0x80",then put System call
    >> number:__NR_name in the register %eax...
    >> However, when I want to write my own system calls, I need to definite new
    >> system call number, In BLCR, for example: __NR_open,__NR_close...
    >> But how can I notify the kernel that the system call I have defined together
    >> with the syscall number? I mean, the basic system call number are defined in
    >> "linux/include/unistd.h" in kernel source code, do I need to add my own number
    >> to this file?? how does it implemented in BLCR?? I can not see the code in BLCR
    >> which do this...
    >> It must be expatiatory...I just try to make the question clear, It's the first
    >> time I contact with Linux kernel, maybe It's simple, I really appreciate your
    >> reply...Thanks
    >> ===============================================
    >>                 TOM                     1.5G      ʲô  [page]
    >> ===============================================
    Paul H. Hargrove                          PHHargrove_at_lbl_dot_gov
    Future Technologies Group
    HPC Research Department                   Tel: +1-510-495-2352
    Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900

  • Next message: Sergio Daz: "Re: problem migrating jobs"