Advertisement
rockdrilla

wine.c: proxy binary for Debian's wine-unstable

Aug 15th, 2014
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. /*
  2. compile:
  3.   gcc -O0 -g0 wine.c -o wine
  4.   strip -s wine
  5. */
  6.  
  7. #include <stdlib.h>
  8. #include <unistd.h>
  9.  
  10. extern char ** environ;
  11.  
  12. char * launchee = "/usr/bin/wine-unstable";
  13.  
  14. int main(int argc, char ** argv) {
  15.     argv[0] = launchee;
  16.     execve(launchee, argv, environ);
  17.     return 1;
  18. }
  19.  
  20. // test:
  21. // $ strace -ttt -e trace=execve ./wine --version
  22. // 1408079894.401853 execve("./wine", ["./wine", "--version"], [/* 25 vars */]) = 0
  23. // 1408079894.403664 execve("/usr/bin/wine-unstable", ["/usr/bin/wine-unstable", "--version"], [/* 25 vars */]) = 0
  24. // 1408079894.406404 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2238, si_status=0, si_utime=0, si_stime=0} ---
  25. // wine-1.7.24
  26. // 1408079894.407723 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2239, si_status=0, si_utime=0, si_stime=0} ---
  27. // 1408079894.407855 +++ exited with 0 +++
  28. //
  29. // result: overhead is about 1-2 ms.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement