GSOC: Introduction

Abhishek Tiwari erabhishektiwarics at gmail.com
Mon Mar 13 19:10:46 UTC 2017


> Per-file summary is not in GNU change log format, please refer to
> https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html .
> Specifically, it lacks asterisks at the beginning of each new file
> description and has excess spaces between file part and description,
> otherwise looks fine.
>
> The patch wires up {,l}stat{,64}, fstatat/fstatat64 syscalls (used for obtaining
> file status), ustat syscall (which is a deprecated way to get some FS
> statistics) and some statfs syscalls (which are more contemporary way
> obtaining FS statistics information). On the other side, at least
> fstat/fstat64, fstatfs/fstatfs64, old{,f,l}stat, osf_{,f}statfs, and various
> (mostly unsupported) syscalls with osf_, svr4_, sysv_, bsd43_, and posix_
> prefixes, present on alpha and mips, are omitted. I'm not sure whether
> it was intended.
>
> There are minor tabulation irregularities introduced (at least) for
> newfstatat and fstatat64 syscall entries, it is better to avoid this.
>

I have fixed the commit entries.
Now the patch includes all the stat-like syscalls that can be
displayed by following command->

grep -nr stat linux/*/syscallent*

>> diff --git a/qualify.c b/qualify.c
>> index b5023f2..4b9f20d 100644
>> --- a/qualify.c
>> +++ b/qualify.c
>> @@ -220,6 +220,8 @@ lookup_class(const char *s)
>>               { "%ipc",       TRACE_IPC       },
>>               { "%network",   TRACE_NETWORK   },
>>               { "%sched",     TRACE_SCHED     },
>> +             { "%stat",      TRACE_STAT      },
>> +
> Not sure whether empty line is intended here.
>

No it was not intended. fixed.

>> --- a/syscall.c
>> +++ b/syscall.c
>> @@ -77,6 +77,7 @@
>>  #define TS TRACE_SIGNAL
>>  #define TM TRACE_MEMORY
>>  #define TSC TRACE_SCHED
>> +#define TST  TRACE_STAT
> Tabulation is used for separating macro declaration and definition, but
> neighbouring lines utilise space for this purpose.

Please elaborate, i don't get what correction is intended here?

>>  #define NF SYSCALL_NEVER_FAILS
>>  #define MA MAX_ARGS
>>  #define SI STACKTRACE_INVALIDATE_CACHE
>> @@ -113,6 +114,7 @@ static const struct_sysent sysent2[] = {
>>  #undef TS
>>  #undef TM
>>  #undef TSC
>> +#undef TST
>>  #undef NF
>>  #undef MA
>>  #undef SI
>> diff --git a/sysent.h b/sysent.h
>> index f4eaa93..e606028 100644
>> --- a/sysent.h
>> +++ b/sysent.h
>> @@ -22,5 +22,5 @@ typedef struct sysent {
>>  #define TRACE_INDIRECT_SUBCALL       02000   /* Syscall is an indirect socket/ipc subcall. */
>>  #define COMPAT_SYSCALL_TYPES 04000   /* A compat syscall that uses compat types. */
>>  #define TRACE_SCHED          010000  /* Trace scheduler-related syscalls. */
>> -
> Whether this removal of empty line intentional?
>

No, fixed.

>> +#define TRACE_STAT           040000  /* Trace stat-like syscalls.    */
>>  #endif /* !STRACE_SYSENT_H */

>> +++ b/tests/stat_like.test
>> @@ -0,0 +1,58 @@
>> +#!/bin/sh
>> +
>> +# Check how stat-like syscalls are traced.
>> +#
>> +# Copyright (c) 2017 The strace developers.
>> +# All rights reserved.
>> +#
>> +# Redistribution and use in source and binary forms, with or without
>> +# modification, are permitted provided that the following conditions
>> +# are met:
>> +# 1. Redistributions of source code must retain the above copyright
>> +#    notice, this list of conditions and the following disclaimer.
>> +# 2. Redistributions in binary form must reproduce the above copyright
>> +#    notice, this list of conditions and the following disclaimer in the
>> +#    documentation and/or other materials provided with the distribution.
>> +# 3. The name of the author may not be used to endorse or promote products
>> +#    derived from this software without specific prior written permission.
>> +#
>> +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
>> +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>> +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
>> +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
>> +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
>> +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
>> +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
>> +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
>> +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> +
>> +STAT_TESTS='21 fstat
>> +33 ustat
>> +32 statx
>> +17 statfs
>> +21 oldfstat'
>> +
>> +NON_STAT_TESTS='11 fchdir
>> +27 futex
>> +10 fsync'
>> +
>> +. "${srcdir=.}/init.sh"
>> +
>> +echo "$STAT_TESTS" | while read w i
>> +do
>> +     run_prog ./$i > /dev/null
>> +     run_strace -a$w -e%stat ./$i > "$EXP"
>> +     match_diff "$LOG" "$EXP"
>> +done
>> +
>> +echo '+++ exited with 0 +++' > "$EXP"
>> +
>> +echo "$NON_STAT_TESTS" | while read w i
>> +do
>> +     run_prog ./$i > /dev/null
>> +     run_strace -a$w -e%stat ./$i > /dev/null
>> +     match_diff "$LOG" "$EXP"
>> +done
>> +
>> +rm "$EXP"
> This test produces the following diagnostics:
>
>     1,2c1,2
>     < fstat(0, 0x7f4dc9b2ffe0) = -1 EFAULT (Bad address)
>     < fstat(0, {st_dev=makedev(9, 1), st_ino=8761399, st_mode=S_IFREG|0640, st_nlink=1, st_uid=1000, st_gid=1000, st_blksize=4096, st_blocks=0, st_size=43147718418, st_atime=1969-12-31T21:59:17+0100.000000135, st_mtime=1969-12-31T21:59:19+0100.000000246, st_ctime=2017-03-13T07:03:55+0100.962268762}) = 0
>     ---
>     > stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2246, ...}) = 0
>     > stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2246, ...}) = 0
>     stat_like.test: failed test: ../strace -a21 -e%stat ./fstat output mismatch
>
> It exits with status 0, however.
>

Please help me with this part, how can I run this test on my machine.

Patch with above mentioned edits is attached below-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3-0001-Implement-e-trace-stat-option-for-tracing-stat-li.patch
Type: text/x-patch
Size: 115725 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170314/3c47c9de/attachment.bin>


More information about the Strace-devel mailing list