00001 #ifndef VSF_SYSDEPUTIL_H 00002 #define VSF_SYSDEPUTIL_H 00003 00004 #ifndef VSF_FILESIZE_H 00005 #include "filesize.h" 00006 #endif 00007 00008 /* VSF_SYSDEPUTIL_H: 00009 * Support for highly system dependent features, and querying for support 00010 * or lack thereof 00011 * TODO: document functions! 00012 */ 00013 00014 struct mystr; 00015 00016 /* Authentication of local users */ 00017 /* Return 0 for fail, 1 for success */ 00018 int vsf_sysdep_check_auth(const struct mystr* p_user, 00019 const struct mystr* p_pass, 00020 const struct mystr* p_remote_host); 00021 00022 /* Support for fine grained privilege (capabilities) */ 00023 int vsf_sysdep_has_capabilities(void); 00024 int vsf_sysdep_has_capabilities_as_non_root(void); 00025 void vsf_sysdep_keep_capabilities(void); 00026 enum ESysdepCapabilities 00027 { 00028 kCapabilityCAP_CHOWN = 1, 00029 kCapabilityCAP_NET_BIND_SERVICE = 2 00030 /* NOTE - next one will be 4, this is a bitfield */ 00031 }; 00032 void vsf_sysdep_adopt_capabilities(unsigned int caps); 00033 00034 /* Support for sendfile(), Linux-like interface. Collapses to a read/write 00035 * loop under the covers if the target system lacks support. 00036 */ 00037 int vsf_sysutil_sendfile(const int out_fd, const int in_fd, 00038 filesize_t* p_offset, filesize_t num_send, 00039 unsigned int max_chunk); 00040 00041 /* Support for changing the process name as reported by the operating system. 00042 * A useful status monitor. NOTE - we don't guarantee that this call will 00043 * have any effect. 00044 */ 00045 void vsf_sysutil_setproctitle_init(int argc, const char* argv[]); 00046 void vsf_sysutil_setproctitle(const char* p_text); 00047 void vsf_sysutil_setproctitle_str(const struct mystr* p_str); 00048 void vsf_sysutil_set_proctitle_prefix(const struct mystr* p_str); 00049 00050 /* For now, maps read/write private pages. API to be extended.. */ 00051 void vsf_sysutil_map_anon_pages_init(void); 00052 void* vsf_sysutil_map_anon_pages(unsigned int length); 00053 00054 /* File descriptor passing/receiving */ 00055 void vsf_sysutil_send_fd(int sock_fd, int send_fd); 00056 int vsf_sysutil_recv_fd(int sock_fd); 00057 00058 #endif /* VSF_SYSDEPUTIL_H */ 00059