Skip to content
  • Filip Bozuta's avatar
    4fc3cdde
    linux-user: Add strace support for printing argument of syscalls used for extended attributes · 4fc3cdde
    Filip Bozuta authored
    This patch implements strace argument printing functionality for following syscalls:
    
        *getxattr, lgetxattr, fgetxattr - retrieve an extended attribute value
    
            ssize_t getxattr(const char *path, const char *name, void *value, size_t size)
            ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size)
            ssize_t fgetxattr(int fd, const char *name, void *value, size_t size)
            man page: https://www.man7.org/linux/man-pages/man2/getxattr.2.html
    
        *listxattr, llistxattr, flistxattr - list extended attribute names
    
            ssize_t listxattr(const char *path, char *list, size_t size)
            ssize_t llistxattr(const char *path, char *list, size_t size)
            ssize_t flistxattr(int fd, char *list, size_t size)
            man page: https://www.man7.org/linux/man-pages/man2/listxattr.2.html
    
        *removexattr, lremovexattr, fremovexattr - remove an extended attribute
    
             int removexattr(const char *path, const char *name)
             int lremovexattr(const char *path, const char *name)
             int fremovexattr(int fd, const char *name)
             man page: https://www.man7.org/linux/man-pages/man2/removexattr.2.html
    
    
    
    Implementation notes:
    
        All of the syscalls have strings as argument types and thus a separate
        printing function was stated in file "strace.list" for every one of them.
        All of these printing functions were defined in "strace.c" using existing
        printing functions for appropriate argument types:
           "print_string()" - for (const char*) type
           "print_pointer()" - for (char*) and (void *) type
           "print_raw_param()" for (int) and (size_t) type
        Syscalls "getxattr()" and "lgetxattr()" have the same number and type of
        arguments and thus their print functions ("print_getxattr", "print_lgetxattr")
        share a same definition. The same statement applies to syscalls "listxattr()"
        and "llistxattr()".
        Function "print_syscall_ret_listxattr()" was added to print the returned list
        of extended attributes for syscalls "print_listxattr(), print_llistxattr() and
        print_flistxattr()".
    
    Signed-off-by: default avatarFilip Bozuta <Filip.Bozuta@syrmia.com>
    Reviewed-by: default avatarLaurent Vivier <laurent@vivier.eu>
    Message-Id: <20200619123331.17387-4-filip.bozuta@syrmia.com>
    Signed-off-by: default avatarLaurent Vivier <laurent@vivier.eu>
    4fc3cdde
    linux-user: Add strace support for printing argument of syscalls used for extended attributes
    Filip Bozuta authored
    This patch implements strace argument printing functionality for following syscalls:
    
        *getxattr, lgetxattr, fgetxattr - retrieve an extended attribute value
    
            ssize_t getxattr(const char *path, const char *name, void *value, size_t size)
            ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size)
            ssize_t fgetxattr(int fd, const char *name, void *value, size_t size)
            man page: https://www.man7.org/linux/man-pages/man2/getxattr.2.html
    
        *listxattr, llistxattr, flistxattr - list extended attribute names
    
            ssize_t listxattr(const char *path, char *list, size_t size)
            ssize_t llistxattr(const char *path, char *list, size_t size)
            ssize_t flistxattr(int fd, char *list, size_t size)
            man page: https://www.man7.org/linux/man-pages/man2/listxattr.2.html
    
        *removexattr, lremovexattr, fremovexattr - remove an extended attribute
    
             int removexattr(const char *path, const char *name)
             int lremovexattr(const char *path, const char *name)
             int fremovexattr(int fd, const char *name)
             man page: https://www.man7.org/linux/man-pages/man2/removexattr.2.html
    
    
    
    Implementation notes:
    
        All of the syscalls have strings as argument types and thus a separate
        printing function was stated in file "strace.list" for every one of them.
        All of these printing functions were defined in "strace.c" using existing
        printing functions for appropriate argument types:
           "print_string()" - for (const char*) type
           "print_pointer()" - for (char*) and (void *) type
           "print_raw_param()" for (int) and (size_t) type
        Syscalls "getxattr()" and "lgetxattr()" have the same number and type of
        arguments and thus their print functions ("print_getxattr", "print_lgetxattr")
        share a same definition. The same statement applies to syscalls "listxattr()"
        and "llistxattr()".
        Function "print_syscall_ret_listxattr()" was added to print the returned list
        of extended attributes for syscalls "print_listxattr(), print_llistxattr() and
        print_flistxattr()".
    
    Signed-off-by: default avatarFilip Bozuta <Filip.Bozuta@syrmia.com>
    Reviewed-by: default avatarLaurent Vivier <laurent@vivier.eu>
    Message-Id: <20200619123331.17387-4-filip.bozuta@syrmia.com>
    Signed-off-by: default avatarLaurent Vivier <laurent@vivier.eu>
Loading