search for: guestfs_int_getumask

Displaying 9 results from an estimated 9 matches for "guestfs_int_getumask".

2016 Apr 13
1
[PATCH v2 libguestfs] launch: Implement a safer getumask.
...src/guestfs-internal.h index 61f384c..bf107d0 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -915,4 +915,7 @@ void guestfs_int_init_unix_backend (void) __attribute__((constructor)); /* guid.c */ extern int guestfs_int_validate_guid (const char *); +/* umask.c */ +extern int guestfs_int_getumask (guestfs_h *g); + #endif /* GUESTFS_INTERNAL_H_ */ diff --git a/src/launch.c b/src/launch.c index a4326fe..460ed29 100644 --- a/src/launch.c +++ b/src/launch.c @@ -50,8 +50,6 @@ static struct backend { const struct backend_ops *ops; } *backends = NULL; -static mode_t get_umask (guestfs_h *g)...
2016 Apr 14
2
[PATCH v3 libguestfs] launch: Implement a safer getumask.
...src/guestfs-internal.h index 61f384c..bf107d0 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -915,4 +915,7 @@ void guestfs_int_init_unix_backend (void) __attribute__((constructor)); /* guid.c */ extern int guestfs_int_validate_guid (const char *); +/* umask.c */ +extern int guestfs_int_getumask (guestfs_h *g); + #endif /* GUESTFS_INTERNAL_H_ */ diff --git a/src/launch.c b/src/launch.c index a4326fe..460ed29 100644 --- a/src/launch.c +++ b/src/launch.c @@ -50,8 +50,6 @@ static struct backend { const struct backend_ops *ops; } *backends = NULL; -static mode_t get_umask (guestfs_h *g)...
2016 Apr 13
3
[PATCH libguestfs] launch: Implement a safer getumask.
...src/guestfs-internal.h index 61f384c..bf107d0 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -915,4 +915,7 @@ void guestfs_int_init_unix_backend (void) __attribute__((constructor)); /* guid.c */ extern int guestfs_int_validate_guid (const char *); +/* umask.c */ +extern int guestfs_int_getumask (guestfs_h *g); + #endif /* GUESTFS_INTERNAL_H_ */ diff --git a/src/launch.c b/src/launch.c index a4326fe..460ed29 100644 --- a/src/launch.c +++ b/src/launch.c @@ -50,8 +50,6 @@ static struct backend { const struct backend_ops *ops; } *backends = NULL; -static mode_t get_umask (guestfs_h *g)...
2016 May 21
1
[PATCH] umask: Use /proc/<PID>/status to read umask in Linux >= 4.7.
...This function implements an expensive, but thread-safe way to get - * the current process's umask. - * * Returns the current process's umask. On failure, returns C<-1> and * sets the error in the guestfs handle. - * - * Thanks to: Josh Stone, Jiri Jaburek, Eric Blake. */ int guestfs_int_getumask (guestfs_h *g) { + int mask; + + mask = get_umask_from_proc (g); + if (mask == -1) + return -1; + if (mask >= 0) + return mask; + + return get_umask_from_fork (g); +} + +/** + * For Linux E<ge> 4.7 get the umask from F</proc/I<PID>/status>. + * + * On failure this r...
2016 Apr 14
0
[PATCH] Add safe wrapper around waitpid which deals with EINTR correctly.
...NULL; child_rlimit = child_rlimit_next) { diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index bf107d0..7b3927b 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -918,4 +918,8 @@ extern int guestfs_int_validate_guid (const char *); /* umask.c */ extern int guestfs_int_getumask (guestfs_h *g); +/* wait.c */ +extern int guestfs_int_waitpid (guestfs_h *g, pid_t pid, int *status, const char *errmsg); +extern void guestfs_int_waitpid_noerror (pid_t pid); + #endif /* GUESTFS_INTERNAL_H_ */ diff --git a/src/launch-direct.c b/src/launch-direct.c index 322737d..ee0a855 100644...
2016 Apr 14
2
[PATCH] Add safe wrapper around waitpid which deals with EINTR correctly.
As Eric Blake noted in: https://www.redhat.com/archives/libguestfs/2016-April/msg00154.html libguestfs doesn't correctly handle the case where waitpid receives a SIGCHLD signal and the main program has registered a non-restartable signal handler. In this case waitpid would return -EINTR and we would print an error, but actually we should retry this case. This adds two new internal functions,
2016 Apr 14
0
Re: [PATCH v3 libguestfs] launch: Implement a safer getumask.
...(calling umask) and pass the result > back over a pipe. > > This change also fixes another problem: mode_t is unsigned, so cannot > be used to return an error indication (ie. -1). Return a plain int > instead. > > Thanks: Josh Stone, Jiri Jaburek, Eric Blake. > --- > +guestfs_int_getumask (guestfs_h *g) > +{ > + if (pid == 0) { > + /* The child process must ONLY call async-safe functions. */ > + close (fd[0]); > + > + /* umask can't fail. */ > + mask = umask (0); > + > + if (write (fd[1], &mask, sizeof mask) != sizeof mask) > +...
2016 Apr 13
0
Re: [PATCH libguestfs] launch: Implement a safer getumask.
...hread-safe way to get > + * the current process's umask. > + * > + * Returns the current process's umask. On failure, returns C<-1> and > + * sets the error in the guestfs handle. > + * > + * Thanks to: Josh Stone, Jiri Jaburek, Eric Blake. > + */ > +int > +guestfs_int_getumask (guestfs_h *g) > +{ > + pid_t pid; > + int fd[2], r; > + int mask; > + int status; > + > + r = pipe2 (fd, O_CLOEXEC); > + if (r == -1) { > + perrorf (g, "pipe2"); > + return -1; > + } > + > + pid = fork (); > + if (pid == -1) { >...
2016 May 18
3
[PATCH v2 0/2] src: introduce an helper version struct
Hi, this adds an helper version struct, and uses it in the backends (for the libvirt and qemu versions) and inspection code. This also moves common code to that, so it is not repeated in many places. This should help with the small refactoring proposed with https://www.redhat.com/archives/libguestfs/2016-May/msg00070.html Thanks, Pino Toscano (2): src: start unifying version handling