Add creat(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2013-01-13 02:27:51 +01:00
parent 391d844aca
commit c25e4a1842
3 changed files with 32 additions and 3 deletions

View File

@ -125,6 +125,7 @@ close.o \
$(CPUDIR)/fork.o \
$(CPUDIR)/signal.o \
$(CPUDIR)/syscall.o \
creat.o \
dispmsg_issue.o \
dlfcn.o \
dup2.o \

30
libc/creat.cpp Normal file
View File

@ -0,0 +1,30 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2013.
This file is part of the Sortix C Library.
The Sortix C Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The Sortix C Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
creat.cpp
Create a file.
*******************************************************************************/
#include <fcntl.h>
extern "C" int creat(const char* path, mode_t mode)
{
return open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
}

View File

@ -53,12 +53,10 @@ struct flock
pid_t l_pid; /* Process ID of the process holding the lock; returned with F_GETLK. */
};
int creat(const char* path, mode_t mode);
int fcntl(int fd, int cmd, ...);
int open(const char* path, int oflag, ...);
int openat(int fd, const char* path, int oflag, ...);
#if defined(__SORTIX_SHOW_UNIMPLEMENTED)
int creat(const char* path, mode_t mode);
#endif
__END_DECLS