Re: [PATCH v2 1/3] utest/tracefs-utest: include linux/limits.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 22 Feb 2024 11:12:44 +0100
Miko Larsson via B4 Relay <devnull+mikoxyzzz.gmail.com@xxxxxxxxxx> wrote:

> From: Miko Larsson <mikoxyzzz@xxxxxxxxx>
> 
> This fixes the build with musl + clang >=15; musl doesn't define
> PATH_MAX anywhere else, and clang >=15 doesn't allow implicit
> declarations with >=c99. Without this, the build fails due to PATH_MAX
> not being defined.
> 
> We could include limits.h from the libc, but AFAIK the libc doesn't
> necessarily have to define PATH_MAX, so it's safer to just include
> linux/limits.h

Actually, the way I handle PATH_MAX is to add:

#ifndef PATH_MAX
#define PATH_MAX 1024
#endif

As it's not really used, but just a default value to be able to add any
paths used in the tracefs directory, where 1024 is more than enough.

-- Steve




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux