Functions

ink_file.cc File Reference

File manipulation routines for libts. More...

#include "libts.h"
#include <sys/stat.h>
Include dependency graph for ink_file.cc:

Go to the source code of this file.

Functions

int ink_fputln (FILE *stream, const char *s)
int ink_file_fd_readline (int fd, int bufsz, char *buf)
int ink_file_fd_writestring (int fd, const char *buf)
int ink_filepath_merge (char *path, int pathsz, const char *rootpath, const char *addpath, int flags)
int ink_filepath_make (char *path, int pathsz, const char *rootpath, const char *addpath)
 Add addpath to the rootpath prepending slash if rootpath is not NULL and doesn't end with the slash already and put the result into path buffer.
int ink_file_fd_zerofill (int fd, off_t size)
 Resize and zero-fill the given file.
bool ink_file_is_directory (const char *path)
 Return true if the path is a directory.

Detailed Description

File manipulation routines for libts.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file ink_file.cc.


Function Documentation

int ink_file_fd_readline ( int  fd,
int  bufsz,
char *  buf 
)
int ink_file_fd_writestring ( int  fd,
const char *  buf 
)
int ink_file_fd_zerofill ( int  fd,
off_t  size 
)

Resize and zero-fill the given file.

Returns 0 on success, errno on failure.

Definition at line 340 of file ink_file.cc.

Referenced by MultiCacheBase::mmap_data().

bool ink_file_is_directory ( const char *  path  ) 

Return true if the path is a directory.

Definition at line 363 of file ink_file.cc.

Referenced by parse_include_directive().

int ink_filepath_make ( char *  path,
int  pathsz,
const char *  rootpath,
const char *  addpath 
)

Add addpath to the rootpath prepending slash if rootpath is not NULL and doesn't end with the slash already and put the result into path buffer.

If the buffer is too small to hold the resulting string, required size is returned. On success zero is returned

Definition at line 302 of file ink_file.cc.

References ink_strlcpy().

Referenced by DiagsConfig::DiagsConfig(), HttpBodySet::init(), Span::path(), plugin_load(), and SDK_API_TSfopen().

int ink_filepath_merge ( char *  path,
int  pathsz,
const char *  rootpath,
const char *  addpath,
int  flags 
)
int ink_fputln ( FILE *  stream,
const char *  s 
)

Definition at line 31 of file ink_file.cc.