Show file.h syntax highlighted
/*
*
* Copyright (c) 2003 The Regents of the University of California. All
* rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of the University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/* $Id: file.h,v 1.8 2005/07/05 01:33:51 girod Exp $ */
/**
* \file file.h file related utilities
*
*/
#ifndef __MISC_FILE_H__
#define __MISC_FILE_H__
#include <sys/ioctl.h>
/* determine whether this descriptor is pollable.
* returns 1 if it supports poll, 0 if not, -1 if error */
int pollable(int fd);
/* polls the device and returns current event set as FUSD flags */
int pollnow(int fd);
int write_to_fd(int fd, const void *buf, int len);
int write_to_file(const char *file, const char *s);
int printf_to_file(const char *file, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
int read_from_file(const char *file, char *s, size_t max);
int write_struct_to_file(const char *file, void *p, size_t size);
int read_struct_from_file(const char *file, void *p, size_t size);
int set_nonblock(int fd, int enable_nonblock);
int do_ioctl(int fd, int cmd, int arg, const char *note);
int mkdir_with_parents(const char *path_orig);
#endif /* __MISC_FILE_H__ */
See more files for this project here