merge main into feat/native-userland-no-proot

This commit is contained in:
Kurt Himebauch committed 2026-11-09 12:39:42 -05:00
commit 507ccc6655
36 files changed
+1295 -67

No files matched your search

@@ -25,12 +25,6 @@ if [ -n "$(find -H "$APPDIR" -maxdepth 4 \( -name chrome-sandbox -o -name chrome
flags+=(--ozone-platform=x11)
fi
fi
if [ -n "${DROIDDECK_GAME_TU_DEBUG+set}" ]; then
if [ ${#flags[@]} -eq 0 ]; then
if [ -n "$DROIDDECK_GAME_TU_DEBUG" ]; then export TU_DEBUG=$DROIDDECK_GAME_TU_DEBUG; else unset TU_DEBUG; fi
fi
unset DROIDDECK_GAME_TU_DEBUG
fi
qt=$(cat "$dir/qt" 2>/dev/null)
case $qt in wayland|xcb) ;; *) qt=auto ;; esac
wayland=${GAMESCOPE_WAYLAND_DISPLAY:-${WAYLAND_DISPLAY:-}}
@@ -61,6 +55,9 @@ if [ -x /usr/local/bin/droiddeck-fex ]; then
*) run=(/usr/local/bin/droiddeck-fex run --mode "$fex" --for "$APPDIR" -- "$APPDIR/AppRun") ;;
esac
fi
gpu=("${BASH_SOURCE[0]%/*}/droiddeck-game-gpu")
[ ${#flags[@]} -gt 0 ] && gpu+=(--chromium)
run=("${gpu[@]}" -- "${run[@]}")
echo "== appimage $ARGV0 ($APPDIR) ${flags[*]} FEX $fex Qt $qt${QT_QPA_PLATFORM:+ ($QT_QPA_PLATFORM)}"
cd "$APPDIR" || exit 1
started=$(mktemp "${TMPDIR:-/tmp}/droiddeck-appimage.XXXXXX")
@@ -11,8 +11,16 @@ if [ -n "${BL_INSIDE:-}" ] || [ -n "${GAMESCOPE_WAYLAND_DISPLAY:-}" ]; then
export XDG_SESSION_TYPE=x11
socket=(--nosocket=wayland --socket=x11)
fi
app=
for arg in "$@"; do
case $arg in -*) ;; *) app=$arg; break ;; esac
done
gpu=("${BASH_SOURCE[0]%/*}/droiddeck-game-gpu")
location=
[ -n "$app" ] && location=$(flatpak info --show-location "$app" 2>/dev/null)
[ -n "$location" ] && gpu+=(--for "$location/files")
echo "== flatpak run ${socket[*]} $*"
if [ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ] && command -v dbus-run-session >/dev/null 2>&1; then
exec dbus-run-session -- flatpak run "${socket[@]}" "$@"
exec "${gpu[@]}" -- dbus-run-session -- flatpak run "${socket[@]}" "$@"
fi
exec flatpak run "${socket[@]}" "$@"
exec "${gpu[@]}" -- flatpak run "${socket[@]}" "$@"
@@ -11,6 +11,7 @@ import tempfile
from pathlib import Path
GAME_TU_DEBUG = "DROIDDECK_GAME_TU_DEBUG"
CHROMIUM_FILES = {"chrome-sandbox", "chrome_100_percent.pak", "v8_context_snapshot.bin"}
SYNC_KEYS = ("BL_SYNC", "BL_SYNC_FALLBACK", "BL_FSYNC_FIRST", "BL_SYNC_MIN_NOFILE", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
SEED_REDISTS = "/usr/local/bin/droiddeck-seed-redists"
PACK_KEYS = ("WINESERVER", "BL_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC")
@@ -346,11 +347,23 @@ def win_components(compat, app_id):
return ""
def game_gpu(env):
def chromium_app(folder):
root = os.path.realpath(folder)
for top, dirs, files in os.walk(root):
if CHROMIUM_FILES.intersection(files) or CHROMIUM_FILES.intersection(dirs):
return True
if os.path.relpath(top, root).count(os.sep) >= 2:
dirs[:] = []
return False
def game_gpu(env, keep=False):
if GAME_TU_DEBUG not in env:
return env
result = env.copy()
value = result.pop(GAME_TU_DEBUG)
if keep:
return result
if value:
result["TU_DEBUG"] = value
else:
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/python3
import os
import runpy
import sys
BIN_DIR = os.path.dirname(os.path.abspath(__file__))
def main(argv):
keep = False
folder = None
while argv and argv[0] != "--":
if argv[0] == "--chromium":
keep = True
argv = argv[1:]
elif argv[0] == "--for" and len(argv) > 1:
folder = argv[1]
argv = argv[2:]
else:
break
if argv and argv[0] == "--":
argv = argv[1:]
if not argv:
print("usage: droiddeck-game-gpu [--chromium] [--for FOLDER] -- PROGRAM [ARGS...]", file=sys.stderr)
return 2
env = dict(os.environ)
try:
game_env = runpy.run_path(os.path.join(BIN_DIR, "droiddeck-game-env"))
if folder and not keep:
keep = game_env["chromium_app"](folder)
env = game_env["game_gpu"](env, keep)
except Exception as error:
print("droiddeck-game-gpu: the game GPU setting was not applied (%s)" % error, file=sys.stderr)
try:
os.execvpe(argv[0], argv, env)
except OSError as error:
print("droiddeck-game-gpu: %s: %s" % (argv[0], error.strerror), file=sys.stderr)
return 127
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
@@ -902,21 +902,21 @@ case $mode in
bl_session_pressure() {
bl_memory_read
[ "$_bl_game" = 1 ] && bl_low_ram && bl_memory_critical || return 0
local _wait=$_bl_tier_backoff _urgent=0 _before _pids _targets
[ "$_bl_available" -ge $((_bl_headroom / 2)) ] || _urgent=1 _wait=30
local _wait=$_bl_tier_backoff _before _pids _targets
[ "$_bl_available" -ge $((_bl_headroom / 2)) ] || [ "$_bl_tier_pushed" -lt 0 ] || _wait=30
[ "$_bl_tier_at" -lt 0 ] || [ $((SECONDS - _bl_tier_at)) -ge "$_wait" ] || return 0
if [ "$_bl_tier_at" -ge 0 ] && [ "$_bl_tier_pushed" -gt 0 ]; then
bl_tier_readback
if [ "$_bl_tier_back" -le $((_bl_tier_pushed / 2)) ]; then
_bl_tier_backoff=30
elif [ "$_urgent" = 0 ]; then
else
_bl_tier_backoff=$((_bl_tier_backoff * 2 > 300 ? 300 : _bl_tier_backoff * 2))
_bl_tier_at=$SECONDS _bl_tier_pushed=0
_bl_tier_at=$SECONDS _bl_tier_pushed=-1
step "zRAM: the game read back most of its last page-out, next try in ${_bl_tier_backoff} s"
return 0
fi
fi
_bl_tier_at=$SECONDS
_bl_tier_at=$SECONDS _bl_tier_pushed=0
bl_zram_pick game
bl_zram_usage "${_pids[@]}" > /dev/null
[ "$_bl_rss" -ge $((256 * 1024)) ] || return 0
@@ -1338,6 +1338,23 @@ case $mode in
echo "== network: no dbus-daemon or netmanager in this runtime; the client will show no connection"
exit 69
fi
# Without a session bus libdbus autolaunches one under the game; it never exits and Steam's
# reaper waits on it, so the launch or exit never finishes.
if [ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ]; then
_bl_bus=${XDG_RUNTIME_DIR:-/run/droiddeck}/bus
rm -f "$_bl_bus"
dbus-daemon --session --address="unix:path=$_bl_bus" --nofork --nopidfile &
for _ in $(seq 1 50); do
[ -S "$_bl_bus" ] && break
nap 0.1
done
if [ -S "$_bl_bus" ]; then
export DBUS_SESSION_BUS_ADDRESS="unix:path=$_bl_bus"
echo "== session bus up at $_bl_bus"
else
echo "== session bus did not come up; programs may start their own"
fi
fi
_bl_compat_env=(env -u LD_LIBRARY_PATH -u STEAM_RUNTIME -u STEAM_STEAMRT_RECURSION_GUARD)
[ "${LD_LIBRARY_PATH+x}" ] && _bl_compat_env+=("LD_LIBRARY_PATH=$LD_LIBRARY_PATH")
@@ -1,11 +1,13 @@
#!/usr/bin/python3
import os
import re
import runpy
import shlex
import sys
import yaml
BIN_DIR = os.path.dirname(os.path.abspath(__file__))
SNAP_DIR = "/snap"
HOST_DIRS = ("/etc", "/home", "/root", "/tmp", "/run", "/var/snap", "/var/lib/snapd", "/var/tmp", "/var/log",
"/media", "/mnt", "/snap", "/usr/src", "/lib/modules")
@@ -59,6 +61,15 @@ def content_binds(name, meta, env):
return out
def game_gpu(env, snap):
try:
game_env = runpy.run_path(os.path.join(BIN_DIR, "droiddeck-game-env"))
return game_env["game_gpu"](env, game_env["chromium_app"](snap))
except Exception as error:
print(f"droiddeck-snap-run: the game GPU setting was not applied ({error})", file=sys.stderr)
return env
def main(argv):
if len(argv) < 3:
print("usage: droiddeck-snap-run SNAP APP [ARG...]", file=sys.stderr)
@@ -72,7 +83,7 @@ def main(argv):
revision = os.path.basename(os.path.realpath(f"{SNAP_DIR}/{name}/current"))
home = os.environ.get("HOME", "/root")
snap = f"{SNAP_DIR}/{name}/{revision}"
env = dict(os.environ)
env = game_gpu(dict(os.environ), snap)
for k in ("LD_PRELOAD", "LD_LIBRARY_PATH"):
env.pop(k, None)
env.update({
@@ -760,18 +760,50 @@ class Watcher:
def __init__(self, files):
self.files = files
self.fd = -1
self.libc = None
wanted = {os.path.dirname(f) for f in files}
self.missing = {d for d in wanted if not os.path.isdir(d)}
self.watched = set()
try:
libc = ctypes.CDLL(None, use_errno=True)
fd = libc.inotify_init1(os.O_NONBLOCK | os.O_CLOEXEC)
dirs = sorted({os.path.dirname(f) for f in files if os.path.isdir(os.path.dirname(f))})
dirs = sorted((wanted - self.missing) | {self.existing_parent(d) for d in self.missing} - {""})
if fd >= 0 and dirs and all(libc.inotify_add_watch(fd, d.encode(), self.MASK) >= 0 for d in dirs):
self.watched = set(dirs)
self.fd = fd
self.libc = libc
elif fd >= 0:
os.close(fd)
except (OSError, AttributeError):
self.fd = -1
self.stamp = self.snapshot()
@staticmethod
def existing_parent(path):
while path and not os.path.isdir(path):
parent = os.path.dirname(path)
if parent == path:
return ""
path = parent
return path
def watch_new_dirs(self):
appeared = False
progressed = True
while progressed:
progressed = False
for d in sorted(self.missing):
parent = d if os.path.isdir(d) else self.existing_parent(d)
if not parent or parent in self.watched:
continue
if self.libc.inotify_add_watch(self.fd, parent.encode(), self.MASK) >= 0:
self.watched.add(parent)
progressed = True
appeared = appeared or parent == d
for d in [d for d in self.missing if d in self.watched]:
self.missing.discard(d)
return appeared
def snapshot(self):
stamp = []
for f in self.files:
@@ -803,8 +835,9 @@ class Watcher:
at += 16 + size
except BlockingIOError:
pass
appeared = self.watch_new_dirs() if self.missing else False
wanted = {os.path.basename(f) for f in self.files}
return any(n in wanted or n.startswith("appmanifest_") for n in names)
return appeared or any(n in wanted or n.startswith("appmanifest_") for n in names)
class XMessage(ctypes.Structure):
@@ -1084,6 +1117,7 @@ class Helper:
installed = COMPAT["installed_apps"](self.steam_root)
self.installed = installed
picks = COMPAT["valve_picks"](self.steam_root)
tools = COMPAT["tool_platforms"](self.steam_root)
prior_auto = state.get("auto", {})
if not isinstance(prior_auto, dict):
prior_auto = {}
@@ -1091,7 +1125,7 @@ class Helper:
native_choices = set(prior_native if isinstance(prior_native, (list, tuple, set)) else ())
picked = COMPAT["picked_apps"](state)
runnable = {t["name"].lower() for t in live}
apps = sorted(set(installed) | set(picks) | set(prior_auto) | native_choices, key=COMPAT["app_order"])
apps = sorted(set(installed) | set(picks) | set(prior_auto) | native_choices | set(tools), key=COMPAT["app_order"])
asked = [app for app, request in COMPAT["game_requests"]().items() if COMPAT["valid_game_request"](app, request)]
apps = sorted(set(apps) | set(asked), key=COMPAT["app_order"])
current = dict(page.compat("many(%s)" % json.dumps(apps)) or {})
@@ -1105,6 +1139,7 @@ class Helper:
if isinstance(state.get("auto"), dict):
state["auto"] = prior_auto
native_choices -= refused
tools = {app: platforms for app, platforms in tools.items() if app not in refused}
current["0"] = top["selected"]
native = COMPAT["native_targets"](self.steam_root, apps)
raw_mapping = COMPAT["read_config_mapping"](
@@ -1137,7 +1172,7 @@ class Helper:
changes, auto = COMPAT["plan_mapping"](
current, installed, listed, default,
COMPAT["followers"](state, current), native, picks, overrides,
prior_auto.keys(), native_choices)
prior_auto.keys(), native_choices, tools)
changes = dict(moved, **changes)
for app, tool in sorted(changes.items(), key=lambda item: COMPAT["app_order"](item[0])):
page.compat("set(%d, %s)" % (int(app), json.dumps(tool if tool is not None else "")))
@@ -1301,7 +1336,8 @@ def main():
failures += 1
time.sleep(min(2 * max(failures, 1), 10))
os.makedirs(COMPAT["COMPAT_DIR"], exist_ok=True)
watcher = Watcher([COMPAT["state_path"]("request.json"), COMPAT["state_path"]("games.json")] +
watcher = Watcher([COMPAT["state_path"]("request.json"), COMPAT["state_path"]("games.json"),
os.path.join(steam_root, "appcache", "appinfo.vdf")] +
[os.path.join(lib, "steamapps", "libraryfolders.vdf") for lib in (steam_root, COMPAT["LIBRARY"] + "-sd")])
steamos = os.environ.get("BL_STEAMDECK") == "1" and os.environ.get("BL_STEAM_UI") != "desktop"
helper = Helper(steam_root, port, steamos)
@@ -5,6 +5,7 @@ import binascii
import json
import os
import re
import shutil
import sys
import time
import subprocess
@@ -352,6 +353,7 @@ def prepare_gog(sidecar, compat_data, launch_dir):
GOG_SCRIPTS = "goggame-*.script"
GOG_REGISTRY_MARK = ".droiddeck-gog-registry"
GOG_SUPPORT_MARK = ".droiddeck-gog-support"
GOG_ROOTS = {"HKEY_LOCAL_MACHINE": "HKEY_LOCAL_MACHINE", "HKLM": "HKEY_LOCAL_MACHINE",
"HKEY_CURRENT_USER": "HKEY_CURRENT_USER", "HKCU": "HKEY_CURRENT_USER",
"HKEY_CLASSES_ROOT": "HKEY_CLASSES_ROOT", "HKCR": "HKEY_CLASSES_ROOT"}
@@ -611,6 +613,120 @@ def apply_gog_registry(folder, compat_data, proton, timeout=90, installation=Non
return "import-failed" + note
def gog_support_actions(folder):
found = []
for script in sorted(Path(folder).glob(GOG_SCRIPTS)):
product = script.name[len("goggame-"):-len(".script")]
try:
actions = json.loads(script.read_text(encoding="utf-8-sig")).get("actions")
except (OSError, ValueError, AttributeError):
continue
for action in actions if isinstance(actions, list) else []:
install = action.get("install") if isinstance(action, dict) else None
if isinstance(install, dict) and install.get("action") == "supportData" \
and isinstance(install.get("arguments"), dict):
found.append((product, install["arguments"]))
return found
def gog_support_bases(folder, product, pfx):
user = Path(pfx) / "drive_c" / "users" / "steamuser"
support = Path(folder) / "support" / product
return {"app": Path(folder), "supportdir": support, "support": support,
"userdocs": user / "Documents", "localappdata": user / "AppData" / "Local"}
def gog_inside(path, base):
root = os.path.realpath(base)
real = os.path.realpath(path)
return real == root or real.startswith(root + os.sep)
def gog_support_path(text, bases):
match = re.fullmatch(r"\{(\w+)\}(.*)", text) if isinstance(text, str) else None
if not match or match.group(1).lower() not in bases:
return None
parts = [part for part in re.split(r"[\\/]+", match.group(2)) if part]
if any(part in (".", "..") for part in parts):
return None
base = bases[match.group(1).lower()]
path = base
for part in parts:
exact = path / part
if not exact.exists() and path.is_dir():
exact = next((child for child in path.iterdir() if child.name.lower() == part.lower()), exact)
path = exact
if path != base and not gog_inside(path.parent, base):
return None
return path, base
def gog_copy_file(source, target, root):
if not gog_inside(target.parent, root):
raise OSError("outside " + str(root))
target.parent.mkdir(parents=True, exist_ok=True)
if target.is_symlink():
target.unlink()
shutil.copy2(source, target, follow_symlinks=False)
def gog_support_data(folder, compat_data, proton):
actions = gog_support_actions(folder)
if not actions:
return "none"
pfx = Path(compat_data) / "pfx" if compat_data else None
if not pfx or not (pfx / "drive_c" / "users" / "steamuser").is_dir():
made = create_prefix(compat_data, proton)
if made not in ("present", "created") or not (pfx / "drive_c" / "users" / "steamuser").is_dir():
return "no-prefix"
stamp = hashlib.sha256(json.dumps(actions, sort_keys=True).encode("utf-8")).hexdigest()
marker = pfx / GOG_SUPPORT_MARK
try:
if marker.is_file() and marker.read_text() == stamp:
return "ready"
except OSError:
pass
copied = skipped = missing = 0
for product, arguments in actions:
bases = gog_support_bases(folder, product, pfx)
found = gog_support_path(arguments.get("target"), bases)
origin = gog_support_path(arguments["source"], bases) if "source" in arguments else None
if found is None or ("source" in arguments and origin is None):
skipped += 1
continue
target, root = found
source = origin[0] if origin else None
try:
if source is None:
target.mkdir(parents=True, exist_ok=True)
elif not source.exists():
missing += 1
elif source.is_dir() and not source.is_symlink():
for top, dirs, files in os.walk(source):
for name in sorted(files + [d for d in dirs if (Path(top) / d).is_symlink()]):
item = Path(top) / name
destination = target / item.relative_to(source)
if (destination.exists() or destination.is_symlink()) and not arguments.get("overwrite"):
continue
gog_copy_file(item, destination, root)
copied += 1
target.mkdir(parents=True, exist_ok=True)
elif (target.exists() or target.is_symlink()) and not arguments.get("overwrite"):
continue
else:
gog_copy_file(source, target, root)
copied += 1
except OSError:
skipped += 1
note = "".join(" %s=%d" % (name, count) for name, count in (("skipped", skipped), ("missing", missing)) if count)
if not skipped:
try:
marker.write_text(stamp)
except OSError:
pass
return "copied=%d%s" % (copied, note)
def main(argv):
if os.environ.get("DROIDDECK_GOG_MAINTENANCE") == "1":
return 0
@@ -654,6 +770,7 @@ def main(argv):
if store == "gog":
prepare_gog(sidecar, compat_data, launch_dir)
log("gog registry: " + apply_gog_registry(folder, compat_data, os.environ.get("BL_STORE_PROTON", "")))
log("gog support data: " + gog_support_data(folder, compat_data, os.environ.get("BL_STORE_PROTON", "")))
if store == "epic":
handled = os.environ.get(EPIC_HANDLED) == "1" and (folder / EPIC_ARGS).is_file()
if not handled:
@@ -734,6 +734,7 @@ def libraries(steam_root):
def installed_apps(steam_root):
entries = appinfo_entries(os.path.join(steam_root, "appcache", "appinfo.vdf"))
apps = set()
for library in libraries(steam_root):
steamapps = os.path.join(library, "steamapps")
@@ -743,7 +744,7 @@ def installed_apps(steam_root):
continue
for name in names:
m = re.fullmatch(r"appmanifest_(\d+)\.acf", name)
if m and m.group(1) not in NOT_GAMES:
if m and m.group(1) not in NOT_GAMES and entries.get(m.group(1), {}).get("type") != "tool":
apps.add(m.group(1))
return sorted(apps, key=int)
@@ -927,6 +928,12 @@ def valve_picks(steam_root):
return sorted(picks, key=int)
def tool_platforms(steam_root):
entries = appinfo_entries(os.path.join(steam_root, "appcache", "appinfo.vdf"))
return {app: entry["oslist"] for app, entry in entries.items()
if entry["type"] == "tool" and entry["oslist"] & {"linux", "windows"}}
def native_targets(steam_root, apps):
wanted = {str(app) for app in apps if str(app) not in NOT_GAMES}
if not wanted:
@@ -1064,10 +1071,11 @@ NATIVE_CHOICE = object()
def plan_mapping(current, installed, runnable, default, auto, native=None, picks=(), overrides=None, managed=None,
native_choices=()):
native_choices=(), tools=None):
tools = tools or {}
runnable = {n.lower() for n in runnable}
installed = set(installed)
picks = set(picks)
picks = set(picks) | {app for app, platforms in tools.items() if "linux" not in platforms}
native = native or {}
overrides = overrides or {}
managed = set(auto) if managed is None else set(managed)
@@ -1075,8 +1083,12 @@ def plan_mapping(current, installed, runnable, default, auto, native=None, picks
changes, kept = {}, {}
if current.get("0", "") != default:
changes["0"] = default
for app in sorted((set(current) | installed | picks | set(auto) | set(overrides) | native_choices) - {"0"}, key=app_order):
for app in sorted((set(current) | installed | picks | set(auto) | set(overrides) | native_choices | set(tools)) - {"0"}, key=app_order):
name = current.get(app, "")
if app in tools and "linux" in tools[app] and "windows" not in tools[app]:
if name and (name.lower() in runnable or "proton" in name.lower()):
changes[app] = None
continue
if app in overrides:
target = overrides[app]
if target is DEFERRED_GAME_TOOL:
@@ -1560,7 +1572,7 @@ def register_default(config_path, apps=(), protect=(), default=None, catalog=Non
current.setdefault(app, "")
changes, auto = plan_mapping(
current, apps, names, default, followers(state, current), native, picks,
overrides, managed, native_choices)
overrides, managed, native_choices, tool_platforms(steam_root))
set_mappings(tokens, mapping, changes)
text = serialize(tokens)
if text != serialize(tokenize(original)):
+28
View File
@@ -29,6 +29,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <time.h>
#include <unistd.h>
@@ -1655,6 +1656,7 @@ static void reply_attr(struct nl_reply *out, unsigned char *message, int type,
return;
}
attr = (struct rtattr *) (message + offset);
memset(attr, 0, total);
attr->rta_type = (unsigned short) type;
attr->rta_len = (unsigned short) RTA_LENGTH(len);
if (len > 0) memcpy(RTA_DATA(attr), data, len);
@@ -2155,3 +2157,29 @@ ssize_t send(int fd, const void *buffer, size_t length, int flags) {
}
return real(fd, buffer, length, flags);
}
ssize_t write(int fd, const void *buffer, size_t length) {
static ssize_t (*real)(int, const void *, size_t);
ssize_t rc;
if (bl_nl_owns(fd) && deliver(fd, buffer, length, 0, &rc)) return rc;
if (real == NULL) real = (ssize_t (*)(int, const void *, size_t)) dlsym(RTLD_NEXT, "write");
if (real == NULL) {
errno = ENOSYS;
return -1;
}
return real(fd, buffer, length);
}
ssize_t writev(int fd, const struct iovec *iov, int iovcnt) {
static ssize_t (*real)(int, const struct iovec *, int);
if (iovcnt >= 0 && bl_nl_owns(fd)) {
struct msghdr msg = { .msg_iov = (struct iovec *) iov, .msg_iovlen = (size_t) iovcnt };
return sendmsg_request(fd, &msg, 0);
}
if (real == NULL) real = (ssize_t (*)(int, const struct iovec *, int)) dlsym(RTLD_NEXT, "writev");
if (real == NULL) {
errno = ENOSYS;
return -1;
}
return real(fd, iov, iovcnt);
}