Accepting request 126524 from home:dimstar:bnc751211
OBS-URL: https://build.opensuse.org/request/show/126524 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gjs?expand=0&rev=66
This commit is contained in:
parent
c6c5bc2032
commit
d9e1361ca1
105
gjs-getpid_uid_gid.patch
Normal file
105
gjs-getpid_uid_gid.patch
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
From 457a90fecc74c0a36da1b9252c9f9028932f42a0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Giovanni Campagna <gcampagna@src.gnome.org>
|
||||||
|
Date: Tue, 7 Feb 2012 15:36:26 +0100
|
||||||
|
Subject: [PATCH] system: add getpid(), getuid(), getgid()
|
||||||
|
|
||||||
|
These functions are useful sometimes (for example when building
|
||||||
|
a PolkitSubject), and have no equivalent in GLib, therefore it's
|
||||||
|
appropriate to place them in the system module.
|
||||||
|
|
||||||
|
https://bugzilla.gnome.org/show_bug.cgi?id=646187
|
||||||
|
---
|
||||||
|
modules/system.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 64 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/modules/system.c b/modules/system.c
|
||||||
|
index ea8a9a8..c7c5b5c 100644
|
||||||
|
--- a/modules/system.c
|
||||||
|
+++ b/modules/system.c
|
||||||
|
@@ -24,6 +24,9 @@
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+
|
||||||
|
#include <gjs/gjs-module.h>
|
||||||
|
#include <jsapi.h>
|
||||||
|
|
||||||
|
@@ -75,6 +78,49 @@ gjs_gc(JSContext *context,
|
||||||
|
JS_GC(context);
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+static JSBool
|
||||||
|
+gjs_getpid(JSContext *context,
|
||||||
|
+ uintN argc,
|
||||||
|
+ jsval *vp)
|
||||||
|
+{
|
||||||
|
+ jsval *argv = JS_ARGV(cx, vp);
|
||||||
|
+ jsval rval;
|
||||||
|
+ if (!gjs_parse_args(context, "getpid", "", argc, argv))
|
||||||
|
+ return JS_FALSE;
|
||||||
|
+ rval = INT_TO_JSVAL(getpid());
|
||||||
|
+ JS_SET_RVAL(context, vp, rval);
|
||||||
|
+ return JS_TRUE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static JSBool
|
||||||
|
+gjs_getuid(JSContext *context,
|
||||||
|
+ uintN argc,
|
||||||
|
+ jsval *vp)
|
||||||
|
+{
|
||||||
|
+ jsval *argv = JS_ARGV(cx, vp);
|
||||||
|
+ jsval rval;
|
||||||
|
+ if (!gjs_parse_args(context, "getuid", "", argc, argv))
|
||||||
|
+ return JS_FALSE;
|
||||||
|
+ rval = INT_TO_JSVAL(getuid());
|
||||||
|
+ JS_SET_RVAL(context, vp, rval);
|
||||||
|
+ return JS_TRUE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static JSBool
|
||||||
|
+gjs_getgid(JSContext *context,
|
||||||
|
+ uintN argc,
|
||||||
|
+ jsval *vp)
|
||||||
|
+{
|
||||||
|
+ jsval *argv = JS_ARGV(cx, vp);
|
||||||
|
+ jsval rval;
|
||||||
|
+ if (!gjs_parse_args(context, "getgid", "", argc, argv))
|
||||||
|
+ return JS_FALSE;
|
||||||
|
+ rval = INT_TO_JSVAL(getgid());
|
||||||
|
+ JS_SET_RVAL(context, vp, rval);
|
||||||
|
+ return JS_TRUE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
JSBool
|
||||||
|
gjs_js_define_system_stuff(JSContext *context,
|
||||||
|
JSObject *module)
|
||||||
|
@@ -97,6 +143,24 @@ gjs_js_define_system_stuff(JSContext *context,
|
||||||
|
0, GJS_MODULE_PROP_FLAGS))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
+ if (!JS_DefineFunction(context, module,
|
||||||
|
+ "getpid",
|
||||||
|
+ (JSNative) gjs_getpid,
|
||||||
|
+ 0, GJS_MODULE_PROP_FLAGS))
|
||||||
|
+ return FALSE;
|
||||||
|
+
|
||||||
|
+ if (!JS_DefineFunction(context, module,
|
||||||
|
+ "getuid",
|
||||||
|
+ (JSNative) gjs_getuid,
|
||||||
|
+ 0, GJS_MODULE_PROP_FLAGS))
|
||||||
|
+ return FALSE;
|
||||||
|
+
|
||||||
|
+ if (!JS_DefineFunction(context, module,
|
||||||
|
+ "getgid",
|
||||||
|
+ (JSNative) gjs_getgid,
|
||||||
|
+ 0, GJS_MODULE_PROP_FLAGS))
|
||||||
|
+ return FALSE;
|
||||||
|
+
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.7.10
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jun 28 21:14:51 UTC 2012 - dimstar@opensuse.org
|
||||||
|
|
||||||
|
- Add gjs-getpid_uid_gid.patch: system: add getpid(), getuid(),
|
||||||
|
getgid().
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Mar 28 06:40:30 UTC 2012 - vuntz@opensuse.org
|
Wed Mar 28 06:40:30 UTC 2012 - vuntz@opensuse.org
|
||||||
|
|
||||||
|
3
gjs.spec
3
gjs.spec
@ -25,6 +25,8 @@ License: MIT
|
|||||||
Group: Development/Libraries/GNOME
|
Group: Development/Libraries/GNOME
|
||||||
Url: http://live.gnome.org/Gjs
|
Url: http://live.gnome.org/Gjs
|
||||||
Source: http://download.gnome.org/sources/gjs/1.32/%{name}-%{version}.tar.xz
|
Source: http://download.gnome.org/sources/gjs/1.32/%{name}-%{version}.tar.xz
|
||||||
|
# PATCH-FIX-UPSTREAM gjs-getpid_uid_gid.patch bnc#751211 bgo#646187 dimstar@opensuse.org -- Add getpid(), getuid() getgid(), taken from upstream git.
|
||||||
|
Patch0: gjs-getpid_uid_gid.patch
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: python
|
BuildRequires: python
|
||||||
BuildRequires: readline-devel
|
BuildRequires: readline-devel
|
||||||
@ -73,6 +75,7 @@ Mozilla SpiderMonkey JavaScript engine.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure \
|
%configure \
|
||||||
|
Loading…
Reference in New Issue
Block a user