util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] prlimit: ensure necessary definitions are present
@ 2011-10-24 18:50 Sami Kerola
  2011-10-24 18:50 ` [PATCH 2/2] build-sys: build prstat only when prlimit() is present Sami Kerola
  2011-10-26 21:30 ` [PATCH 1/2] prlimit: ensure necessary definitions are present Karel Zak
  0 siblings, 2 replies; 3+ messages in thread
From: Sami Kerola @ 2011-10-24 18:50 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

With Ubuntu linux-libc-dev 2.6.38-11.50 I got error mentioned
bellow. This patch fixes the issue.

prlimit.c:77:88: error: 'RLIMIT_RTTIME' undeclared here

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 configure.ac        |    1 +
 sys-utils/prlimit.c |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 88aced9..873f1b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -136,6 +136,7 @@ AC_CHECK_HEADERS(
 	rpcsvc/nfs_prot.h \
 	stdlib.h \
 	asm/io.h \
+	asm-generic/resource.h \
 	sys/disk.h \
 	sys/disklabel.h \
 	sys/ioctl.h \
diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c
index 74c7fc9..25949f1 100644
--- a/sys-utils/prlimit.c
+++ b/sys-utils/prlimit.c
@@ -26,6 +26,9 @@
 #include <assert.h>
 #include <unistd.h>
 #include <sys/resource.h>
+#ifdef HAVE_ASM_GENERIC_RESOURCE_H
+# include <asm-generic/resource.h>
+#endif
 
 #include "c.h"
 #include "nls.h"
@@ -33,6 +36,10 @@
 #include "xalloc.h"
 #include "strutils.h"
 
+#ifndef RLIMIT_RTTIME
+# define RLIMIT_RTTIME 15
+#endif
+
 enum {
 	AS,
 	CORE,
-- 
1.7.7


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

* [PATCH 2/2] build-sys: build prstat only when prlimit() is present
  2011-10-24 18:50 [PATCH 1/2] prlimit: ensure necessary definitions are present Sami Kerola
@ 2011-10-24 18:50 ` Sami Kerola
  2011-10-26 21:30 ` [PATCH 1/2] prlimit: ensure necessary definitions are present Karel Zak
  1 sibling, 0 replies; 3+ messages in thread
From: Sami Kerola @ 2011-10-24 18:50 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

The prlimit() appeared kernel in 2.6.36 at October 2010, and to
glic in 2.13 at February 2011.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 configure.ac          |    3 +++
 sys-utils/Makefile.am |    9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 873f1b2..f2e257f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -227,6 +227,9 @@ AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
 AC_CHECK_FUNCS([ioperm iopl], [have_io=yes])
 AM_CONDITIONAL([BUILD_HWCLOCK], test "x$have_io" = xyes -o "x$linux_os" = xyes)
 
+AC_CHECK_FUNCS([prlimit], [have_prlimit=yes])
+AM_CONDITIONAL([BUILD_PRLIMIT], test "x$have_prlimit" = xyes)
+
 AC_CHECK_MEMBER(struct sockaddr.sa_len,
 		AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
 	[#include <sys/types.h>
diff --git a/sys-utils/Makefile.am b/sys-utils/Makefile.am
index 48595da..39b064c 100644
--- a/sys-utils/Makefile.am
+++ b/sys-utils/Makefile.am
@@ -2,11 +2,11 @@ include $(top_srcdir)/config/include-Makefile.am
 
 bin_PROGRAMS =
 sbin_PROGRAMS =
-usrbin_exec_PROGRAMS = flock ipcrm ipcs ipcmk renice setsid prlimit
+usrbin_exec_PROGRAMS = flock ipcrm ipcs ipcmk renice setsid
 usrsbin_exec_PROGRAMS = readprofile
 
 dist_man_MANS = flock.1 ipcrm.1 ipcs.1 ipcmk.1 renice.1 setsid.1 \
-		readprofile.8 prlimit.1
+		readprofile.8
 
 if LINUX
 bin_PROGRAMS += dmesg
@@ -41,9 +41,14 @@ dmesg_SOURCES = dmesg.c $(top_srcdir)/lib/strutils.c
 ipcmk_SOURCES = ipcmk.c $(top_srcdir)/lib/strutils.c
 ipcrm_SOURCES = ipcrm.c  $(top_srcdir)/lib/strutils.c
 flock_SOURCES = flock.c $(top_srcdir)/lib/strutils.c
+
+if BUILD_PRLIMIT
+usrbin_exec_PROGRAMS += prlimit
+dist_man_MANS += prlimit.1
 prlimit_SOURCES = prlimit.c $(top_srcdir)/lib/strutils.c \
 			$(top_srcdir)/lib/mbsalign.c \
 			$(top_srcdir)/lib/tt.c
+endif
 
 if BUILD_MOUNTPOINT
 bin_PROGRAMS += mountpoint
-- 
1.7.7


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

* Re: [PATCH 1/2] prlimit: ensure necessary definitions are present
  2011-10-24 18:50 [PATCH 1/2] prlimit: ensure necessary definitions are present Sami Kerola
  2011-10-24 18:50 ` [PATCH 2/2] build-sys: build prstat only when prlimit() is present Sami Kerola
@ 2011-10-26 21:30 ` Karel Zak
  1 sibling, 0 replies; 3+ messages in thread
From: Karel Zak @ 2011-10-26 21:30 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Mon, Oct 24, 2011 at 08:50:44PM +0200, Sami Kerola wrote:
> With Ubuntu linux-libc-dev 2.6.38-11.50 I got error mentioned
> bellow. This patch fixes the issue.
> 
> prlimit.c:77:88: error: 'RLIMIT_RTTIME' undeclared here

 Good point, but I'm not sure if we want to include kernel header
 files (<asm-*/>) to our utils.

 I'll fix this issue later (I'm just working on large changes in
 configure.in).  Thanks.

  Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

end of thread, other threads:[~2011-10-26 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 18:50 [PATCH 1/2] prlimit: ensure necessary definitions are present Sami Kerola
2011-10-24 18:50 ` [PATCH 2/2] build-sys: build prstat only when prlimit() is present Sami Kerola
2011-10-26 21:30 ` [PATCH 1/2] prlimit: ensure necessary definitions are present Karel Zak

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).