axboe / fio

Flexible I/O Tester
GNU General Public License v2.0
5.25k stars 1.26k forks source link

Unable to build on OmniOS due to missing PATH_MAX definition #1344

Closed szaydel closed 2 years ago

szaydel commented 2 years ago

Please acknowledge the following before creating a ticket

Description of the bug: Observing the following when no changes are made building from master.

$ gmake
    CC cconv.o
In file included from stat.h:6:0,
                 from thread_options.h:7,
                 from cconv.c:4:
diskutil.h:52:12: error: 'PATH_MAX' undeclared here (not in a function); did you mean 'INT8_MAX'?
  char path[PATH_MAX];
            ^~~~~~~~
            INT8_MAX
gmake: *** [Makefile:505: cconv.o] Error 1

With the following change I am able to build without a problem.

$ git diff
diff --git a/diskutil.h b/diskutil.h
index 83bcbf89..0b48e3b0 100644
--- a/diskutil.h
+++ b/diskutil.h
@@ -4,6 +4,9 @@

 #include "helper_thread.h"
 #include "fio_sem.h"
+#ifdef __sun
+#include <limits.h>
+#endif

 struct disk_util_stats {
        uint64_t ios[2];

This is is likely not the most correct approach, but it works. I would not mind fixing this so that it correctly built on Omni.

Environment:

$ uname -a
SunOS omni-lab 5.11 omnios-r151040-d75907718a i86pc i386 i86pc

fio version: Latest ref on the master branch

Reproduction steps

$ ./configure && gmake
axboe commented 2 years ago

I think we should just include it unconditionally, that should be safe. Hopefully... I'll give it a go.

szaydel commented 2 years ago

Yeah, it should be harmless, but I figured I would minimize the affect at least in my own testing. It seems like we are trying not to have any system level includes in this file, which was another reason for trying to limit blast radius.

axboe commented 2 years ago

I did push a fix, so feel free to close this one provided it works for you now.

szaydel commented 2 years ago

Yup, LGTM. Thanks a lot for getting this incorporated quickly, I appreciate it!