mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] syncfs: return a status integer
@ 2015-07-09 11:58 Natanael Copa
  2015-07-09 12:55 ` Szabolcs Nagy
  2015-07-09 16:34 ` [PATCH] " Rich Felker
  0 siblings, 2 replies; 4+ messages in thread
From: Natanael Copa @ 2015-07-09 11:58 UTC (permalink / raw)
  To: musl; +Cc: Natanael Copa

syncfs(2) may fail with EBADF if fd is not a vaild file descriptor. We
need return error to follow glibc ABI.
---
 include/unistd.h   | 2 +-
 src/linux/syncfs.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/unistd.h b/include/unistd.h
index 0fe75d5..760a165 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -185,7 +185,7 @@ int setresgid(gid_t, gid_t, gid_t);
 int getresuid(uid_t *, uid_t *, uid_t *);
 int getresgid(gid_t *, gid_t *, gid_t *);
 char *get_current_dir_name(void);
-void syncfs(int);
+int syncfs(int);
 int euidaccess(const char *, int);
 int eaccess(const char *, int);
 #endif
diff --git a/src/linux/syncfs.c b/src/linux/syncfs.c
index fe2b8a7..047bcff 100644
--- a/src/linux/syncfs.c
+++ b/src/linux/syncfs.c
@@ -2,7 +2,7 @@
 #include <unistd.h>
 #include "syscall.h"
 
-void syncfs(int fd)
+int syncfs(int fd)
 {
-	__syscall(SYS_syncfs, fd);
+	return __syscall(SYS_syncfs, fd);
 }
-- 
2.4.5



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] syncfs: return a status integer
  2015-07-09 11:58 [PATCH] syncfs: return a status integer Natanael Copa
@ 2015-07-09 12:55 ` Szabolcs Nagy
  2015-07-09 14:18   ` [PATCH v2] " Natanael Copa
  2015-07-09 16:34 ` [PATCH] " Rich Felker
  1 sibling, 1 reply; 4+ messages in thread
From: Szabolcs Nagy @ 2015-07-09 12:55 UTC (permalink / raw)
  To: musl; +Cc: Natanael Copa

* Natanael Copa <ncopa@alpinelinux.org> [2015-07-09 13:58:56 +0200]:
> -void syncfs(int fd)
> +int syncfs(int fd)
>  {
> -	__syscall(SYS_syncfs, fd);
> +	return __syscall(SYS_syncfs, fd);
>  }

use syscall instead of __syscall, the later is
the raw syscall the former sets up errno correctly.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] syncfs: return a status integer
  2015-07-09 12:55 ` Szabolcs Nagy
@ 2015-07-09 14:18   ` Natanael Copa
  0 siblings, 0 replies; 4+ messages in thread
From: Natanael Copa @ 2015-07-09 14:18 UTC (permalink / raw)
  To: musl; +Cc: Natanael Copa

syncfs(2) may fail with EBADF if fd is not a vaild file descriptor. We
need return error to follow glibc ABI.
---
Changes v1 -> v2:
 - use syscall instead of __syscall

 include/unistd.h   | 2 +-
 src/linux/syncfs.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/unistd.h b/include/unistd.h
index 0fe75d5..760a165 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -185,7 +185,7 @@ int setresgid(gid_t, gid_t, gid_t);
 int getresuid(uid_t *, uid_t *, uid_t *);
 int getresgid(gid_t *, gid_t *, gid_t *);
 char *get_current_dir_name(void);
-void syncfs(int);
+int syncfs(int);
 int euidaccess(const char *, int);
 int eaccess(const char *, int);
 #endif
diff --git a/src/linux/syncfs.c b/src/linux/syncfs.c
index fe2b8a7..bc7d301 100644
--- a/src/linux/syncfs.c
+++ b/src/linux/syncfs.c
@@ -2,7 +2,7 @@
 #include <unistd.h>
 #include "syscall.h"
 
-void syncfs(int fd)
+int syncfs(int fd)
 {
-	__syscall(SYS_syncfs, fd);
+	return syscall(SYS_syncfs, fd);
 }
-- 
2.4.5



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] syncfs: return a status integer
  2015-07-09 11:58 [PATCH] syncfs: return a status integer Natanael Copa
  2015-07-09 12:55 ` Szabolcs Nagy
@ 2015-07-09 16:34 ` Rich Felker
  1 sibling, 0 replies; 4+ messages in thread
From: Rich Felker @ 2015-07-09 16:34 UTC (permalink / raw)
  To: musl

On Thu, Jul 09, 2015 at 01:58:56PM +0200, Natanael Copa wrote:
> syncfs(2) may fail with EBADF if fd is not a vaild file descriptor. We
> need return error to follow glibc ABI.

Minor nit in commit message: this is just the documented _API_ for the
(nonstandard) function, not ABI-specific (although of course API
mismatch usually also introduces ABI mismatch, including in this
case).

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-09 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09 11:58 [PATCH] syncfs: return a status integer Natanael Copa
2015-07-09 12:55 ` Szabolcs Nagy
2015-07-09 14:18   ` [PATCH v2] " Natanael Copa
2015-07-09 16:34 ` [PATCH] " Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).