Commit Graph

205 Commits

Author SHA1 Message Date
John Scipione
19a18af35e Convert fs_host files from c back to cpp and style changes.
* fs_darwin.c => fs_darwin.cpp
* fs_freebsd.c => fs_freebsd.cpp
* use bool instead of int again in fs_darwin.cpp (C => C++)
* declare loop varibles inline again in fs_freebsd.cpp (C => C++)
* 2 newlines between top header gaurd and first #include
* 2 newlines after last #include
* freebsd/endian.h and freebsd/regex.h convert \r\n to just \n
* remove some leading tabs in fs_freebsd.cpp
* add newlines after single line if statement in fs_freebsd.cpp
* 80-char limit fixes in fs_freebsd.cpp
2012-08-13 18:51:59 -04:00
John Scipione
efeef5fad7 FreeBSD build fixes cpp => c 2012-08-12 20:33:46 -04:00
John Scipione
e4e68917c3 Cleanup darwin build system some more.
* Convert fs_darwin.cpp and fs_freebsd.cpp to C.
* Convert extern C calls to __BEGIN_DECLS and __END_DECLS macros
* Link rm_attrs with dynamic libroot
2012-08-12 20:33:46 -04:00
John Scipione
a43b1ed6d8 Split fs_darwin.h defines into various platform dependent headers.
This completes the final 1/3 of #8857. Changes again by nielx with
style fixes by me.

The one part that I couldn't figure out, and maybe Ingo can chime
in here. If headers/build/host/darwin/sys/stat.h is surrounded in

extern "C" {

}

guards then I get a link error complaining that the functions defined
here are duplicate symbols, once in fs.o and once in function_remapper.o.
For example:

ld: duplicate symbol _futimens in generated/objects/darwin/x86_64/release/build/libroot/libroot_build_function_remapper.a(function_remapper.o) and generated/objects/darwin/x86_64/release/build/libroot/libroot_build.a(fs.o) for architecture x86_64

I'm not sure why that is.
2012-08-11 18:26:36 -04:00
John Scipione
ef7e9d6b9b Add fopendir() to fs_darwin.cpp and fix symlinkat().
This completes 2/3 of #8857 and is courtesy of nielx.
2012-08-11 17:56:22 -04:00
John Scipione
fd1d8a6031 Make private helper function static in fs_darwin.cpp in order to not pollute
the public namespace.
2012-03-15 16:39:39 -04:00
John Scipione
b6a1a815a1 Use a stack variable of MAXPATHLEN size to hold the full path to avoid having to manually malloc and free the variable. 2012-03-09 16:38:44 -05:00
John Scipione
d7f3dac1eb Style fixes suggested by Axeld.
Added Ingo to the copyright
Updated copyright year to 2012 for my contribution.
2012-03-09 14:39:24 -05:00
John Scipione
9b4aba87f4 Merge in from master 2012-03-09 14:20:04 -05:00
John Scipione
3836fb6d2d Fix flag checking in fs_darwin.cpp
Somehow this commit got left out in my earlier push.
2012-03-09 00:01:01 -05:00
John Scipione
81b45e484a Fix build on Mac OS X 10.6 gcc2 and gcc4 and 10.7 gcc4 by adding some Mac OS X specific files that implement missing *at() functions.
Mac OS X 10.7 generates a gcc2 cross-compiler that fails when assigning NULL to a static method pointer so is still broken.
Added a weak attribute in driver_settings.cpp.
Move futimesat() from fs.cpp to fs_darwin.cpp since it is implimented on FreeBSD.
Implemented eaccess(), for the AT_EACCESS flag of faccessat()
Fix configure script to correctly detect case-sensitive file system
2012-03-08 23:28:49 -05:00
John Scipione
2f9bd2c090 Move the invalid fd check to after checking if fd == AT_FDCWD in the fchownat() function 2012-03-08 17:03:15 -05:00
John Scipione
adf4838afe Implement the rest of chmod AT_SYMLINK_NOFOLLOW flag, fix the flag error detection code, a few comment changes. 2012-03-08 16:39:53 -05:00
John Scipione
9b54745611 Implement the AT_SYMLINK_NOFOLLOW flag to fchmodat() by calling open at fchmod emulating lchmod() 2012-03-08 15:56:01 -05:00
John Scipione
bffc978823 Fix build error and implement AT_SYMLINK_NO_FOLLOW in fstatat() by calling lstat() 2012-03-08 15:29:18 -05:00
John Scipione
6ad9d01a41 Check for valid flags in faccessat() and fchmodat() and implement AT_SYMLINK_NOFOLLOW in fatchownat() using lchown(). 2012-03-08 15:20:27 -05:00
John Scipione
f2d343d416 Use S_ISDIR instead of S_IFDIR to check if the fd points to a directory and take AT_SYMLINK_NO_FOLLOW out of faccessat because IEEE Std 1003.1-2008 doesn't call for it even though Linux implements it. 2012-03-08 15:01:49 -05:00
John Scipione
981887153d Error if file descriptor is negative after checking for AT_FDCWD 2012-03-08 14:33:51 -05:00
John Scipione
5529a1c1e7 Refactor so that all methods call a common get_path method to grab the full path from the fd and relative path string 2012-03-07 19:06:06 -05:00
John Scipione
2e24957db9 insert a / between the directory path and relative path. in faccessat() use dirpath at the end, not path. 2012-03-06 17:33:36 -05:00
John Scipione
156eeb439b Reverse logic when checking if dirst points to a directory. 2012-03-06 17:08:36 -05:00
John Scipione
a38ff2d402 Check if flags bitmap != 0, not that it does == 0 2012-03-06 16:37:53 -05:00
John Scipione
b51d823d92 Error if unsupported flag is passed to fstatat() 2012-03-05 20:23:43 -05:00
John Scipione
8c7f0a8967 Cleanup the flags and make them the same as FreeBSD 2012-03-05 20:17:26 -05:00
John Scipione
0ee852ad55 Explicitly check path against NULL instead of relying on boolality. Yes, I just made that word up. 2012-03-05 20:04:21 -05:00
John Scipione
95dd0de5ea Rename to and from to old and new in order to be consistant with Linux. 2012-03-05 20:00:53 -05:00
John Scipione
c8dd9f3e8c Fix memory leak for the full path including fd directory. 2012-03-05 19:47:25 -05:00
John Scipione
a598261fea Implement linkat() 2012-03-05 19:24:58 -05:00
John Scipione
263ac66935 Implement renameat() 2012-03-05 18:56:59 -05:00
John Scipione
46804eff55 Remove extraneous line where I called just unlinkat() 2012-03-05 18:22:02 -05:00
John Scipione
6f0d1fc94a Implement unlinkat() 2012-03-05 18:21:13 -05:00
John Scipione
8e094e5a5b Implement symlinkat() 2012-03-05 18:09:34 -05:00
John Scipione
02e902bf28 Implement readlinkat() 2012-03-05 18:02:54 -05:00
John Scipione
9970cc92bf Implemented eaccess(), the AT_EACCESS flag of faccessat(), fchmodat(), fchownat(), fstatat(), mkdirat(), mkfifoat(), mknodat(), and futimesat(). 2012-03-05 17:15:41 -05:00
John Scipione
62540ce5eb Check to see that fd points to a directory before resolving the full path. 2012-03-03 17:24:05 -05:00
John Scipione
f0d84745df Implement a basic faccessat method. There are still a few missing pieces to it. 2012-03-02 21:04:05 -05:00
John Scipione
c72a1d4e6a Don't return 0 for the unimplemented *at() functions, set errno to ENOSYS (not implemented) and return -1 instead. 2012-03-02 21:04:04 -05:00
John Scipione
00f72094a1 Move futimesat() from fs.cpp to fs_darwin.cpp since it is implimented on FreeBSD. It is stubbed out for now. 2012-03-02 21:04:02 -05:00
John Scipione
9d6e5fdb65 Fix build by adding some Mac OS X specific files that implement fs function missing on that OS. The functions are stubbed out currently and have not been implemented. However, it does build now. I also added a weak attribute in driver_settings.cpp that I have no idea what does but was necessary to fix the build. 2012-03-02 21:04:00 -05:00
Fredrik Holmqvist
55cf69968f Rename strlen.c strnlen.c to strlen.cpp strnlen.cpp.
No changes in the files themselves in this commit.
2011-12-29 15:43:23 +01:00
Rene Gollent
cfb5f18de4 Correct signature mismatch that prevented this symbol from winding up
in the library properly. Fixes DEBUG build.
2011-12-11 19:33:27 -05:00
Rene Gollent
1394478206 This file had CR/LF line endings for some reason. 2011-12-11 19:31:17 -05:00
Fredrik Holmqvist
34b63b5b9d Remove libbe_build linking m from earlier commit and add -lm to HOST_LINK_FLAGS on non BeOS compatible platforms.
(HOST_LIBROOT would need more work than just adding m so I went the easy route.)
2011-12-11 00:45:44 +01:00
Fredrik Holmqvist
3cb6104e08 libbe_build has references to math functions so on platforms that has them defined in lib m include it. This allows Haiku to be built with gold as host linker. 2011-12-10 17:11:55 +01:00
Ingo Weinhold
d68eb11df9 fs_attr_generic.cpp: Fix warning 2011-11-28 05:02:27 +01:00
Ingo Weinhold
62f5df5852 Provide futimens(), utimensat() missing on FreeBSD 2011-11-28 05:02:09 +01:00
Ingo Weinhold
b328f5b034 libroot_build: Explicitly support FreeBSD struct stat anomalies
Use stat::st_{a,m}timespec on FreeBSD instead of the POSIXish
stat::st_{a,m}tim. Fixes part of the FreeBSD build issues recently
introduced.
2011-11-28 04:30:49 +01:00
Oliver Tappe
692e9b11e4 Build fix part 2: active libroot_build.a again:
* uncomment the building of libroot_build.a again
* add function remapper to HOST_STATIC_LIBROOT
* drop TODO about the function remapper not working with the static
  libroot

Ingo: please review - I think this should work, but I'm not so sure
where HOST_STATIC_LIBROOT should be in the list of libraries of its
only user (<build>bfs_fuse): where it is now or right at the end?

As it is now, the resulting binary still contains references to
host-libc-implementations of close() & others, which are triggered by
the other libs (like libfuse.so). If I put HOST_STATIC_LIBROOT right at
the end, those references are gone, though. But which is correct?
2011-11-25 22:04:51 +01:00
Oliver Tappe
8cdc273ad3 Build fix part 1: update generic fs-attr code 2011-11-25 21:56:27 +01:00
Ingo Weinhold
085f6723a4 Fix build due to <directories.h> move
Apparently I should have done a complete rebuild after moving
directories.h from headers/private/libroot to .../system, since a lot of
stuff didn't build anymore.
2011-11-25 06:19:50 +01:00