Samsung Internal API reference  2.0
unistd.h
Go to the documentation of this file.
1 
9 #ifndef __UNISTD_H__
10 #define __UNISTD_H__
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #include <core/lseek.h>
17 #include <core/stat.h>
18 #include <sys/types.h>
19 #include <sys/resource.h>
20 
27 #define TEMP_FAILURE_RETRY(expression) ({ \
28  typeof (expression) _result; \
29  do { \
30  _result = (expression); \
31  } while (_result == ((typeof (expression)) -1) && errno == EINTR); \
32  _result; })
33 
40 extern void _exit(int status) __attribute__ ((noreturn));
41 
42 #ifndef __HIDE_INTERNAL_FUNCTIONS__
43 
47 extern void _exit_thread(unsigned long status) __attribute__ ((noreturn));
48 #endif /* __HIDE_INTERNAL_FUNCTIONS__ */
49 
63 extern int profil(unsigned short *buf, size_t bufsiz, size_t offset, unsigned int scale);
64 
69 extern pid_t getpid(void);
70 
75 extern pid_t gettid(void);
76 
81 extern int getcpu(void);
82 
88 extern int getcluster(void);
89 
97 extern int rename(const char *pathname, const char *new_pathname);
98 
105 extern int unlink(const char *pathname);
106 
115 extern int ftruncate(int fd, int size);
116 
123 extern int rmdir(char *dir_name);
124 
135 extern int close(int fd);
136 
148 extern ssize_t read(int fd, void *buf, size_t count);
149 
161 extern ssize_t write(int fd, const void *buf, size_t count);
162 
170 extern int fstat(int fd, struct stat *buf);
171 
179 extern int stat(const char *pathname, struct stat *buf);
180 
187 extern int fsync(int fd);
188 
204 extern int lseek(int fd, int offset, int whence);
205 
218 extern long sysconf(int name);
220 enum {
231 };
232 
233 #ifdef USE_JEMALLOC
234 extern ssize_t __readlink_stub(const char *pathname, char *buf, size_t bufsiz);
235 extern int __fcntl_stub(int fd, int cmd, ...);
236 #endif
237 
238 #ifdef __cplusplus
239 }
240 #endif
241 
242 #endif /* !__UNISTD_H__ */
243 
int getcluster(void)
Return the cluster id on which current thread is performed.
Wrapper for kernel types.h header.
ssize_t read(int fd, void *buf, size_t count)
Attempt to read count bytes from the file associated with the open file descriptor, fd, into the buffer pointed to by buf.
Definition: unistd.h:229
Definition: unistd.h:227
Definition: unistd.h:223
int pid_t
Definition: types.h:21
Definition: unistd.h:222
int getcpu(void)
Return the number of CPU on which current thread is performed.
int fsync(int fd)
Synchronize a file&#39;s in-core state with storage device.
ssize_t write(int fd, const void *buf, size_t count)
Attempt to write count bytes from buffer pointed to by buf to the file associated with the open file ...
int rmdir(char *dir_name)
Remove a directory at file system.
Definition: unistd.h:225
pid_t gettid(void)
Return the thread ID of the calling thread.
int profil(unsigned short *buf, size_t bufsiz, size_t offset, unsigned int scale)
Provide a means to find out in what areas your program spends most of its time. The argument buf poin...
Definition: unistd.h:228
int fstat(int fd, struct stat *buf)
Get status of a file with a descriptor fd.
int stat(const char *pathname, struct stat *buf)
Get status of a file pathname.
long sysconf(int name)
Get configuration information at run time.
Definition: unistd.h:224
int close(int fd)
Deallocate the file descriptor indicated by fd. To deallocate means to make the file descriptor avail...
void _exit(int status)
Terminate the calling process "immediately". Any open file descriptors belonging to the process are c...
int rename(const char *pathname, const char *new_pathname)
Rename file.
pid_t getpid(void)
Return the process ID of the calling process.
Definition: stat.h:48
Definition: unistd.h:230
int lseek(int fd, int offset, int whence)
Reposition read/write file offset.
Definition: unistd.h:221
intptr_t ssize_t
Definition: types.h:17
int unlink(const char *pathname)
Remove a link to a file.
int ftruncate(int fd, int size)
Cause file referenced by fd to be truncated to a size of precisely length bytes.
Definition: unistd.h:226