Hi!
> > > +static void setup(void)
> > > +{
> > > + tst_sig(NOFORK, DEF_HANDLER, cleanup);
> > > +
> > > + TEST_PAUSE;
> > > +
> > > + tst_tmpdir();
> > > +
> > > + sprintf(fname, "tfile_%d", getpid());
> >
> > You don't have to do this, the tst_tmpdir() creates an unique temp
> > directory and changes the program working directory to it.
> I know, but it's not really any harder to generate filename like this and
> I also use fname as a source buffer for write() and verify I can read it back
> later correctly from fanotify() file descriptors so the uniqueness of the
> file contents is nice.
Ok.
> > > + /* If we expected failure there's nothing to clean up */
> > > + if (expect == -1)
> > > + return;
> > > +
> > > + if (test_event)
> > > + test_event(file);
> > > +
> > > + if (myfanotify_mark(fd_notify, FAN_MARK_REMOVE | flag,
> > > + FAN_OPEN, AT_FDCWD, file) < 0) {
> > > + tst_brkm(TBROK | TERRNO, cleanup,
> > > + "fanotify_mark (%d, FAN_MARK_REMOVE | %s, "
> > > + "FAN_OPEN, AT_FDCWD, \"%s\") failed",
> > > + fd_notify, flagstr, file);
> > > + }
> > > + }
> > > +}
> > > +
> > > +#define check_mark(file, flag, expect, func) __check_mark(file, flag,
> > > #flag, expect, func)
> > > +
> > > +static void __do_open(char *file, int flag, char *flagstr)
> > > +{
> > > + int fd;
> > > +
> > > + if ((fd = open(file, O_RDONLY | flag)) < 0) {
> > > + tst_brkm(TBROK | TERRNO, cleanup,
> > > + "open(%s, O_RDONLY | %s) failed", file, flagstr);
> > > + }
> > > + if (close(fd) < 0) {
> > > + tst_brkm(TBROK | TERRNO, cleanup,
> > > + "close(%s) failed", file);
> > > + }
> > > +}
> >
> > We don't use identificators with double underscores in userspace, these
> > are reserved for glibc and may cause failures in future. Especially
> > names like __do_open may clash.
> Ah right, didn't write anything serious in userspace for a while :) I've
> changed that to a single underscore.
That wouldn't do either, I've looked up the GNU manual that says that
all functions or variables that begin with underscore are reserved.
http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
I will look at the v2 patch tomorrow.
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list