Clean up libpsl-native headers

This commit is contained in:
Andrew Schwartzmeyer 2016-09-28 18:17:03 -07:00
parent 001f6ecf72
commit b0cd7ba3dc
30 changed files with 70 additions and 41 deletions

View file

@ -2,10 +2,11 @@
//! @author George FLeming <v-geflem@microsoft.com>
//! @brief create new hard link
#include "createhardlink.h"
#include <errno.h>
#include <unistd.h>
#include <string>
#include "createhardlink.h"
//! @brief Createhardlink create new symbolic link
//!

View file

@ -2,10 +2,11 @@
//! @author George FLeming <v-geflem@microsoft.com>
//! @brief create new symbolic link
#include "createsymlink.h"
#include <errno.h>
#include <unistd.h>
#include <string>
#include "createsymlink.h"
//! @brief Createsymlink create new symbolic link
//!

View file

@ -1,6 +1,7 @@
#pragma once
#include "pal.h"
#include <stdbool.h>
PAL_BEGIN_EXTERNC

View file

@ -2,12 +2,13 @@
//! @author George FLeming <v-geflem@microsoft.com>
//! @brief returns whether a path is a symbolic link
#include "followsymlink.h"
#include "issymlink.h"
#include <errno.h>
#include <unistd.h>
#include <string>
#include <iostream>
#include "followsymlink.h"
#include "issymlink.h"
//! @brief Followsymlink determines target path of a sym link
//!

View file

@ -2,10 +2,11 @@
//! @author George Fleming <v-geflem@microsoft>
//! @brief Implements GetComputerName Win32 API
#include "getcomputername.h"
#include <errno.h>
#include <unistd.h>
#include <string>
#include "getcomputername.h"
//! @brief GetComputerName retrieves the name of the host associated with
//! the current thread.

View file

@ -1,9 +1,8 @@
#include "getcurrentprocessorid.h"
#include <unistd.h>
int32_t GetCurrentProcessId()
pid_t GetCurrentProcessId()
{
pid_t pid = getpid();
return static_cast<int32_t>(pid);
return getpid();
}

View file

@ -1,10 +1,11 @@
#pragma once
#include "pal.h"
#include <sys/types.h>
PAL_BEGIN_EXTERNC
int32_t GetCurrentProcessId();
pid_t GetCurrentProcessId();
PAL_END_EXTERNC

View file

@ -1,9 +1,9 @@
#include "getcurrentthreadid.h"
#include <unistd.h>
#include <pthread.h>
HANDLE GetCurrentThreadId()
pid_t GetCurrentThreadId()
{
pid_t tid = pthread_self();
return reinterpret_cast<HANDLE>(tid);
return pthread_self();
}

View file

@ -2,9 +2,11 @@
#include "pal.h"
#include <sys/types.h>
PAL_BEGIN_EXTERNC
HANDLE GetCurrentThreadId();
pid_t GetCurrentThreadId();
PAL_END_EXTERNC

View file

@ -2,15 +2,16 @@
//! @author Andrew Schwartzmeyer <andschwa@microsoft.com>
//! @brief returns the owner of a file
#include "getstat.h"
#include "getpwuid.h"
#include "getfileowner.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <string.h>
#include <unistd.h>
#include "getstat.h"
#include "getpwuid.h"
#include "getfileowner.h"
//! @brief GetFileOwner returns the owner of a file
//!

View file

@ -2,12 +2,13 @@
//! @author George Fleming <v-geflem@microsoft.com>
//! @brief Implements GetFullyQualifiedName on Linux
#include "getcomputername.h"
#include "getfullyqualifiedname.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include "getcomputername.h"
#include "getfullyqualifiedname.h"
//! @brief GetFullyQualifiedName retrieves the fully qualified dns name of the host
//!

View file

@ -2,13 +2,14 @@
//! @author George FLeming <v-geflem@microsoft.com>
//! @brief Retrieve link count of a file
#include "getlinkcount.h"
#include <errno.h>
#include <locale.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string>
#include "getlinkcount.h"
//! @brief GetLinkCount retrieves the file link count (number of hard links)
//! for the given file

View file

@ -2,13 +2,14 @@
//! @author Andrew Schwartzmeyer <andschwa@microsoft.com>
//! @brief returns the lstat of a file
#include "getlstat.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <string.h>
#include <unistd.h>
#include "getlstat.h"
//! @brief GetLStat returns the lstat of a file. This simply delegates to the
//! lstat() system call and maps errno to the expected values for GetLastError.

View file

@ -1,8 +1,9 @@
#pragma once
#include <sys/stat.h>
#include "pal.h"
#include <sys/stat.h>
PAL_BEGIN_EXTERNC
int32_t GetLStat(const char* path, struct stat* buf);

View file

@ -2,13 +2,14 @@
//! @author Andrew Schwartzmeyer <andschwa@microsoft.com>
//! @brief returns the username for a uid
#include "getpwuid.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <string.h>
#include <unistd.h>
#include "getpwuid.h"
//! @brief GetPwUid returns the username for a uid
//!

View file

@ -1,8 +1,9 @@
#pragma once
#include <sys/types.h>
#include "pal.h"
#include <sys/types.h>
PAL_BEGIN_EXTERNC
char* GetPwUid(uid_t uid);

View file

@ -2,13 +2,14 @@
//! @author Andrew Schwartzmeyer <andschwa@microsoft.com>
//! @brief returns the stat of a file
#include "getstat.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <string.h>
#include <unistd.h>
#include "getstat.h"
//! @brief GetStat returns the stat of a file. This simply delegates to the
//! stat() system call and maps errno to the expected values for GetLastError.

View file

@ -1,8 +1,9 @@
#pragma once
#include <sys/stat.h>
#include "pal.h"
#include <sys/stat.h>
PAL_BEGIN_EXTERNC
int32_t GetStat(const char* path, struct stat* buf);

View file

@ -1,12 +1,13 @@
#include <string>
#include <sstream>
#include <errno.h>
#include <sys/sysctl.h>
#include "pal.h"
#include "getfileowner.h"
#include "getpwuid.h"
#include "getuserfrompid.h"
#include <string>
#include <sstream>
#include <errno.h>
#include <sys/sysctl.h>
char* GetUserFromPid(pid_t pid)
{

View file

@ -2,6 +2,8 @@
#include "pal.h"
#include <sys/types.h>
PAL_BEGIN_EXTERNC
char* GetUserFromPid(pid_t pid);

View file

@ -2,10 +2,11 @@
//! @author Andrew Schwartzmeyer <andschwa@microsoft.com>
//! @brief Implements GetUserName for Linux
#include <unistd.h>
#include "getpwuid.h"
#include "getusername.h"
#include <unistd.h>
//! @brief GetUserName retrieves the name of the user associated with
//! the current thread.
//!

View file

@ -2,16 +2,17 @@
//! @author Andrew Schwartzmeyer <andschwa@microsoft.com>
//! @brief returns if the path is a directory
#include "getstat.h"
#include "getpwuid.h"
#include "getfileowner.h"
#include "isdirectory.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <string.h>
#include <unistd.h>
#include "getstat.h"
#include "getpwuid.h"
#include "getfileowner.h"
#include "isdirectory.h"
//! @brief returns if the path is a directory; uses stat and so follows symlinks
//!

View file

@ -1,6 +1,7 @@
#pragma once
#include "pal.h"
#include <stdbool.h>
PAL_BEGIN_EXTERNC

View file

@ -2,10 +2,11 @@
//! @author George Fleming <v-geflem@microsoft.com>
//! @brief returns whether a file is executable
#include "isexecutable.h"
#include <errno.h>
#include <unistd.h>
#include <string>
#include "isexecutable.h"
//! @brief IsExecutable determines if path is executable
//!

View file

@ -1,6 +1,7 @@
#pragma once
#include "pal.h"
#include <stdbool.h>
PAL_BEGIN_EXTERNC

View file

@ -2,6 +2,9 @@
//! @author Andrew Schwartzmeyer <andschwa@microsoft.com>
//! @brief returns if the path exists
#include "getlstat.h"
#include "isfile.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -9,8 +12,6 @@
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include "getlstat.h"
#include "isfile.h"
//! @brief returns if the path is a file or directory
//!

View file

@ -1,6 +1,7 @@
#pragma once
#include "pal.h"
#include <stdbool.h>
PAL_BEGIN_EXTERNC

View file

@ -2,13 +2,14 @@
//! @author George FLeming <v-geflem@microsoft.com>
//! @brief returns whether a path is a symbolic link
#include "getlstat.h"
#include "issymlink.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string>
#include "getlstat.h"
#include "issymlink.h"
//! @brief IsSymlink determines if path is a symbolic link
//!

View file

@ -1,6 +1,7 @@
#pragma once
#include "pal.h"
#include <stdbool.h>
PAL_BEGIN_EXTERNC

View file

@ -2,13 +2,14 @@
//! @author George FLeming <v-geflem@microsoft.com>
//! @brief set local/system date and time
#include "setdate.h"
#include <errno.h>
#include <langinfo.h>
#include <locale.h>
#include <string>
#include <time.h>
#include <sys/time.h>
#include "setdate.h"
//! @brief SetDate sets the date and time on local computer. You must
//! be super-user to set the time.