libfuncs is collection of code (list, queue, circular buffer, io, logging, etc.). https://georgi.unixsol.org/programs/libfuncs/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

io.h 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * UX IO functions header file
  3. * Copyright (C) 2006-2009 Unix Solutions Ltd.
  4. *
  5. * Released under MIT license.
  6. * See LICENSE-MIT.txt for license terms.
  7. */
  8. #ifndef IO_H
  9. # define IO_H
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. #include <sys/socket.h>
  14. #include <sys/types.h>
  15. char * chomp(char *x);
  16. ssize_t safe_read(int fd, void *buf, size_t len);
  17. ssize_t safe_write(int fd, const void *buf, size_t len);
  18. void shutdown_fd(int *in_fd);
  19. ssize_t fdgetline(int fd, char *buf, size_t buf_size);
  20. ssize_t fdread_ex(int fd, char *buf, size_t buf_size, int timeout, int retries, int waitfull);
  21. ssize_t fdread(int fd, char *buf, size_t buf_size);
  22. ssize_t fdread_nowaitfull(int fd, char *buf, size_t buf_size);
  23. ssize_t fdwrite(int fd, char *buf, size_t buf_size);
  24. int fdputs(int fd, char *msg);
  25. int fdputsf(int fd, char *fmt, ...) __attribute__ ((format(printf, 2, 3)));
  26. void set_log_io_errors(int report_io_errors);
  27. void set_sock_nonblock(int sockfd);
  28. void set_sock_block(int sockfd);
  29. int do_connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen, int timeout);
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #endif