mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
pulse-server: use pid_t where appropriate
Instead of `int`, use the `pid_t` type to represent process identifiers.
This commit is contained in:
parent
2d27497045
commit
627ef37a77
3 changed files with 8 additions and 6 deletions
|
|
@ -353,8 +353,9 @@ on_connect(void *data, int fd, uint32_t mask)
|
||||||
struct impl * const impl = server->impl;
|
struct impl * const impl = server->impl;
|
||||||
struct sockaddr_storage name;
|
struct sockaddr_storage name;
|
||||||
socklen_t length;
|
socklen_t length;
|
||||||
int client_fd, val, pid;
|
int client_fd, val;
|
||||||
struct client *client = NULL;
|
struct client *client = NULL;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
length = sizeof(name);
|
length = sizeof(name);
|
||||||
client_fd = accept4(fd, (struct sockaddr *) &name, &length, SOCK_CLOEXEC);
|
client_fd = accept4(fd, (struct sockaddr *) &name, &length, SOCK_CLOEXEC);
|
||||||
|
|
|
||||||
|
|
@ -101,13 +101,13 @@ int get_runtime_dir(char *buf, size_t buflen, const char *dir)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_flatpak(struct client *client, int pid)
|
int check_flatpak(struct client *client, pid_t pid)
|
||||||
{
|
{
|
||||||
char root_path[2048];
|
char root_path[2048];
|
||||||
int root_fd, info_fd, res;
|
int root_fd, info_fd, res;
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
|
|
||||||
sprintf(root_path, "/proc/%u/root", pid);
|
sprintf(root_path, "/proc/%ld/root", (long) pid);
|
||||||
root_fd = openat(AT_FDCWD, root_path, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOCTTY);
|
root_fd = openat(AT_FDCWD, root_path, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOCTTY);
|
||||||
if (root_fd == -1) {
|
if (root_fd == -1) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
|
|
@ -147,7 +147,7 @@ int check_flatpak(struct client *client, int pid)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_client_pid(struct client *client, int client_fd)
|
pid_t get_client_pid(struct client *client, int client_fd)
|
||||||
{
|
{
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,14 @@
|
||||||
#define PULSE_SERVER_UTILS_H
|
#define PULSE_SERVER_UTILS_H
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
struct client;
|
struct client;
|
||||||
struct pw_context;
|
struct pw_context;
|
||||||
|
|
||||||
int get_runtime_dir(char *buf, size_t buflen, const char *dir);
|
int get_runtime_dir(char *buf, size_t buflen, const char *dir);
|
||||||
int check_flatpak(struct client *client, int pid);
|
int check_flatpak(struct client *client, pid_t pid);
|
||||||
int get_client_pid(struct client *client, int client_fd);
|
pid_t get_client_pid(struct client *client, int client_fd);
|
||||||
const char *get_server_name(struct pw_context *context);
|
const char *get_server_name(struct pw_context *context);
|
||||||
int create_pid_file(void);
|
int create_pid_file(void);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue