How about removing non-Linux code?

Denys Vlasenko dvlasenk at redhat.com
Tue Feb 7 13:06:24 UTC 2012


Hi Dmitry,

Non-linux code (FreeBSD/SunOS/SVR4) appears to be dead.

I looked through changelog and all changes to this code
since at least 2005 only keep it in line with evolution
of Linux code (such as changing the name of a struct field).

I don't see a single build failure fix. Or a genuine bug fix.
In fact I would be surprised if this code even compiles -
it's likely no one tests that.

Are FreeBSD/SunOS/SVR4 in fact build their strace from
our code? I would be mightily surprised if they do...

Since there is a lot of this code, it makes actual, live code
harder to understand because of additional ifdefs:

#ifdef USE_PROCFS
         int pfd;                /* proc file descriptor */
#endif
#ifdef SVR4
# ifdef HAVE_MP_PROCFS
         int pfd_stat;
         int pfd_as;
         pstatus_t status;
# else
         prstatus_t status;      /* procfs status structure */
# endif
#endif
#ifdef FREEBSD
         struct procfs_status status;
         int pfd_reg;
         int pfd_status;
#endif

^^^^^^^^ half of the screen of cruft.


#ifdef SYS_vfork
         if (known_scno(tcp) == SYS_vfork) {
                 /* Attempt to make vfork into fork, which we can follow. */
                 if (change_syscall(tcp, SYS_fork) < 0)
                         dont_follow = 1;
         }
#endif

^^^^^^^^^ Do we do this? No. Why? Because it sits in two-screenful-large
"#ifndef LINUX" - which isn't immediately obvious when one reads the code.


What do you think about removing all non-Linux code after the next release?

-- 
vda




More information about the Strace-devel mailing list