### 1. Numbers for filesys.e for SunOS or any OS?

How do I calculate the correct numbers for STAT_ST_BLKSIZE and SIZEOF_STAT. Also, unless I comment out lines 2325 and 2326, it will not compile.

```  2290	elsifdef UNIX then
2291			ifdef OSX then
2292				ifdef BITS32 then
2293					constant
2294						STAT_ST_BLKSIZE = 76,
2295						SIZEOF_STAT     = 108,
2296						\$
2297				elsedef
2298					constant
2299						STAT_ST_BLKSIZE = 112,
2300						SIZEOF_STAT     = 144,
2301						\$
2302				end ifdef
2303			elsifdef FREEBSD then
2304				ifdef BITS32 then
2305					constant
2306						STAT_ST_BLKSIZE = 64,
2307						SIZEOF_STAT     = 96,
2308						\$
2309				elsedef
2310					constant
2311						STAT_ST_BLKSIZE = 88,
2312						SIZEOF_STAT     = 120,
2313						\$
2314				end ifdef
2315			elsifdef OPENBSD then
2316				constant
2317					STAT_ST_BLKSIZE = 72,
2318					SIZEOF_STAT     = 112,
2319					\$
2320			elsifdef NETBSD then
2321				constant
2322					STAT_ST_BLKSIZE = 80,
2323					SIZEOF_STAT     = 100,
2324					\$
2325				stat_t_offset = 80
2326				stat_buf_size = 100
2327			end ifdef
2328	end ifdef
2329
```

### 2. Re: Numbers for filesys.e for SunOS or any OS?

agrellum said...

How do I calculate the correct numbers for STAT_ST_BLKSIZE and SIZEOF_STAT.

You'll need to know C to do this.

SIZEOF_STAT is easy to calculate. Use the following C program:

```#include <sys/stat.h>
#include <stdio.h>
void main()
{
printf("%d\n", sizeof(struct stat));
}
```

STAT_ST_BLKSIZE is a bit harder. Try this:

```#include <sys/stat.h>
#include <stdio.h>
void main()
{
struct stat temp;
char * stat_ptr = (char*)(&temp);
char * blk_ptr = (char*)(&(temp.st_blksize));
printf("%d\n", blk_ptr - stat_ptr);
}
```

agrellum said...

Also, unless I comment out lines 2325 and 2326, it will not compile.

```  2325				stat_t_offset = 80
2326				stat_buf_size = 100
```

Looks like Matt forgot to clean up some leftover 4.0 code when updating the 4.1 stuff - http://scm.openeuphoria.org/hg/euphoria/annotate/2938e761e722/include/std/filesys.e#2224

### 3. Re: Numbers for filesys.e for SunOS or any OS?

Thank you, that worked.