]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Illumos: changes for --modify-fds
authorPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 16 Apr 2025 18:31:38 +0000 (20:31 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 16 Apr 2025 18:31:38 +0000 (20:31 +0200)
This is the minumum just to get the new testcase to build and pass.
Need to go through the other fd related syscalls later.

.gitignore
coregrind/m_syswrap/syswrap-solaris.c
none/tests/Makefile.am
none/tests/cmdline1.stdout.exp-non-linux
none/tests/cmdline2.stdout.exp-non-linux
none/tests/track_new.c
none/tests/track_new.stderr.exp-illumos [new file with mode: 0644]
none/tests/track_new.vgtest

index 43b5d9b6bad16d6f1d635084ab10d0e140392bf6..fa0fa0d34982acfc1f2ba2110240ac1da92f735a 100644 (file)
 /none/tests/timestamp
 /none/tests/tls
 /none/tests/track-fds-exec-children
+/none/tests/track_new
 /none/tests/unit_debuglog
 /none/tests/use_after_close
 /none/tests/valgrind_cpp_test
index dc0068d90c9bbcdcdbaac41e1d06bb46c0684803..6b61a0e0dc71cfac9000f2d478fe3d2bbc7bdf04 100644 (file)
@@ -1775,6 +1775,8 @@ PRE(sys_open)
 
 POST(sys_open)
 {
+   POST_newFd_RES;
+
    if (!ML_(fd_allowed)(RES, "open", tid, True)) {
       VG_(close)(RES);
       SET_STATUS_Failure(VKI_EMFILE);
index c2b36e33c2e12de2156bbd41d5a2776848f1c26f..2275407738cbfeae98ec368088c613d6123bc65b 100644 (file)
@@ -269,7 +269,7 @@ EXTRA_DIST = \
        fdbaduse.stderr.exp fdbaduse.vgtest \
        use_after_close.stderr.exp use_after_close.vgtest \
        track_new.stderr.exp track_new.stdout.exp \
-       track_new.stderr.exp.debian32 track_new.vgtest
+       track_new.stderr.exp.debian32 track_new.vgtest track_new.stderr.exp-illumos
 
 
 check_PROGRAMS = \
index f0534f824c54b24a4b4f1de62c1b5f62ea17af29..d36db3976e7cafa44200f3154d65023ce6bfa4af 100644 (file)
@@ -30,6 +30,7 @@ usage: valgrind [options] prog-and-args
            startup exit abexit valgrindabexit all none
     --track-fds=no|yes|all    track open file descriptors? [no]
                               all includes reporting inherited file descriptors
+    --modify-fds=no|high      modify newly open file descriptors? [no]
     --time-stamp=no|yes       add timestamps to log messages? [no]
     --log-fd=<number>         log messages to file descriptor [2=stderr]
     --log-file=<file>         log messages to <file>
index e518644ab548c6a8e73ad68fc5aa8c8c6fb93d4a..5a44b3bfacda8a097c9e3a418b87ce5ad02e91e3 100644 (file)
@@ -30,6 +30,7 @@ usage: valgrind [options] prog-and-args
            startup exit abexit valgrindabexit all none
     --track-fds=no|yes|all    track open file descriptors? [no]
                               all includes reporting inherited file descriptors
+    --modify-fds=no|high      modify newly open file descriptors? [no]
     --time-stamp=no|yes       add timestamps to log messages? [no]
     --log-fd=<number>         log messages to file descriptor [2=stderr]
     --log-file=<file>         log messages to <file>
index 544ccacb3c282801160a905887fa828dee079bea..e4bb546fb41c8c96bb75453de3a6e746d1f80698 100644 (file)
@@ -1,9 +1,12 @@
+#define _XOPEN_SOURCE 700
+
 #include <fcntl.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <sys/stat.h>
 
 int
-main ()
+main (void)
 {
   int oldfd = open ("foobar.txt", O_RDWR|O_CREAT, S_IRUSR | S_IWUSR);
   /*... do something with oldfd ...*/
diff --git a/none/tests/track_new.stderr.exp-illumos b/none/tests/track_new.stderr.exp-illumos
new file mode 100644 (file)
index 0000000..670530b
--- /dev/null
@@ -0,0 +1,10 @@
+File descriptor was closed already
+   at 0x........: fdopen (in /...libc...)
+   by 0x........: vdprintf (in /...libc...)
+   by 0x........: dprintf (in /...libc...)
+   by 0x........: main
+ Previously closed
+   at 0x........: close (in /...libc...)
+   by 0x........: main
+ Originally opened
+   at 0x........: main (track_new.c:11)
index f6f72d880daf2957d42fc66d321b8918420bb1db..cad64c5eabea59cfb8dfff2519e6a251e8a1a194 100644 (file)
@@ -2,3 +2,5 @@ prog: track_new
 prereq: test -x track_new
 vgopts: -q --track-fds=yes --modify-fds=high
 stderr_filter: filter_fdleak
+cleanup: rm -f foobad.txt foobar.txt
+