[patch] Separate out creat() implementation from open.c
Khem Raj
raj.khem at gmail.com
Wed Mar 4 20:46:26 UTC 2009
Hi
Currently we implement creat () in same file as open () implementation
in open.c. On NPTL we override open.c with its own implementation of
open which also considers cancellation. As a result when we override
open.c we also throw away creat () implementation.
This patch separates creat() to its own file. This way we get the creat
implementation and it uses the nptl version of open to implement it when
using nptl.
OK for trunk and uClibc-nptl branch ?
Thanks
-Khem
Signed-off-by: Khem Raj <kraj at uclibc.org>
-------------- next part --------------
Index: libc/sysdeps/linux/common/creat.c
===================================================================
--- libc/sysdeps/linux/common/creat.c (revision 0)
+++ libc/sysdeps/linux/common/creat.c (revision 0)
@@ -0,0 +1,15 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * creat() for uClibc
+ *
+ * Copyright (C) 2009 <kraj at uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <fcntl.h>
+
+int creat(const char *file, mode_t mode)
+{
+ return open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
+}
Index: libc/sysdeps/linux/common/open.c
===================================================================
--- libc/sysdeps/linux/common/open.c (revision 25530)
+++ libc/sysdeps/linux/common/open.c (working copy)
@@ -37,8 +37,3 @@
libc_hidden_weak(open)
strong_alias(open,__libc_open)
#endif
-
-int creat(const char *file, mode_t mode)
-{
- return open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
-}
More information about the uClibc
mailing list