Example #1
0
static int
str_netfd_write_common(const struct mystr* p_str, int fd, int noblock)
{
  int ret = 0;
  int retval;
  unsigned int str_len = str_getlen(p_str);
  if (str_len == 0)
  {
    bug("zero str_len in str_netfd_write_common");
  }
  if (noblock)
  {
    vsf_sysutil_activate_noblock(fd);
  }
  retval = str_write_loop(p_str, fd);
  if (vsf_sysutil_retval_is_error(retval) || (unsigned int) retval != str_len)
  {
    ret = -1;
  }
  if (noblock)
  {
    vsf_sysutil_deactivate_noblock(fd);
  }
  return ret;
}
Example #2
0
int
str_netfd_write(const struct mystr* p_str, int fd)
{
  int ret = 0;
  int retval;
  unsigned int str_len = str_getlen(p_str);
  if (str_len == 0)
  {
    bug("zero str_len in str_netfd_write");
  }
  retval = str_write_loop(p_str, fd);
  if (vsf_sysutil_retval_is_error(retval) || (unsigned int) retval != str_len)
  {
    ret = -1;
  }
  return ret;
}
Example #3
0
static void
vsf_log_do_log_to_file(int fd, struct mystr* p_str)
{
  if (!tunable_no_log_lock)
  {
    int retval = vsf_sysutil_lock_file(fd);
    if (vsf_sysutil_retval_is_error(retval))
    {
      return;
    }
  }
  str_replace_unprintable(p_str, '?');
  str_append_char(p_str, '\n');
  /* Ignore write failure; maybe the disk filled etc. */
  (void) str_write_loop(p_str, fd);
  if (!tunable_no_log_lock)
  {
    vsf_sysutil_unlock_file(fd);
  }
}