diff options
author | LAN-TW <lantw44@gmail.com> | 2012-09-14 21:54:40 +0800 |
---|---|---|
committer | LAN-TW <lantw44@gmail.com> | 2012-09-14 21:54:40 +0800 |
commit | 8810a2c8b18ea7eb472d4e07db6a3f92c1ee8bb9 (patch) | |
tree | dd4804e7a0b16175ab96282862139c441bd5ef75 | |
parent | ae5a715f94c4bb2400b466fb1516c1eb3b5a3682 (diff) | |
download | sctjudge-8810a2c8b18ea7eb472d4e07db6a3f92c1ee8bb9.tar.gz sctjudge-8810a2c8b18ea7eb472d4e07db6a3f92c1ee8bb9.tar.zst sctjudge-8810a2c8b18ea7eb472d4e07db6a3f92c1ee8bb9.zip |
Second commit - copy files from working tree
(1) Modify configure.ac to handle more situations.
(2) ChangeLog is temporarily deleted.
(3) An RPM spec file is added.
-rw-r--r-- | ChangeLog | 41 | ||||
-rw-r--r-- | README | 11 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | sctjudge.spec.in | 40 | ||||
-rw-r--r-- | src/mkchild.c | 4 |
5 files changed, 49 insertions, 57 deletions
diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index ec06f7f..0000000 --- a/ChangeLog +++ /dev/null @@ -1,41 +0,0 @@ - -2012-07-28 藍挺瑋 <lantw44@gmail.com> - 0.91 - - * 軟體建置 - 修改 src/Makefile.am 因不正確的值而導致連結失敗的問題 - - * 額外檔案 - 這是第一個有 ChangeLog 檔案的版本,其他資訊請參考 README - -2012-07-21 藍挺瑋 <lantw44@gmail.com> - 0.9 - - * 軟體建置 - 使用 GNU Autotool 取代原先人工編寫的 Makefile - - * 程式 - 將大多數檢查參數的工作由 sctjudge_makechild 移至 main 函式中 - - * 程式 - 改善原先受測程式超過時間限制無法立即偵測的問題 - - * 程式 - 若使用 verbose 模式,結束後會顯示使用的 CPU 時間 - - * 程式 - 使用 nanosleep 取代所有 usleep - -2012-07-19 藍挺瑋 <lantw44@gmail.com> - 0.8 - - * 程式 - 修正上一版本許多程序、檔案權限控制問題 - - * 擴充功能 - 正式啟用 Linux 程序監視器 - -2012-07-18 藍挺瑋 <lantw44@gmail.com> - 0.7 - - * 軟體建置 - 使用單純的 Makefile 進行管理 - - * 程式 - 此為第一個測試版本 @@ -16,14 +16,3 @@ Simple Common Test Judge 使用注意事項:因為受測程式在執行時,式無法開啟任何額外函式庫檔案的。因此編譯受 測程式時,請加上 -static 來編譯成可獨立執行的可執行檔,否則無法得到正確的結果! (可能需要安裝額外的套件才能編譯成靜態的執行檔,例如說 glibc-static 這類的套件) - -=============================================================================== - -本程式的 ChangeLog 各項目會以底下的方式分類: - - * 軟體建置:Makefile 或 configure 之類方便編譯、安裝、打包的工具 - * 額外檔案:README、INSTALL、COPYING 之類提供軟體額外資訊但不安裝的文件 - * 程式 :程式運作必要的檔案或內容 - * 擴充功能:程式中可選用的功能 - * 設定檔 :程式執行中會讀取的設定檔 - * 說明文件:提供軟體資訊且會安裝至系統的文件 diff --git a/configure.ac b/configure.ac index cb732c4..c9630a1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,14 +1,13 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ([2.68]) -AC_INIT([sctjudge], [0.9.1], [lantw44@gmail.com]) +AC_INIT([sctjudge], [1.0], [lantw44@gmail.com]) AM_INIT_AUTOMAKE([foreign -Wall]) AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_HEADERS([src/config.h]) -releasedate="2012-07-28" +releasedate="2012-XX-XX" # Checks for programs. AC_PROG_CC @@ -118,10 +117,11 @@ AC_TYPE_SIZE_T # Checks for library functions. AC_FUNC_FORK AC_FUNC_MALLOC -AC_CHECK_FUNCS([clock_gettime dup2 getpagesize memset setlocale strchr strerror strrchr]) +AC_CHECK_FUNCS([clock_gettime dup2 memset setlocale strchr strerror strrchr], + [], AC_MSG_ERROR(This program requires all these functions!)) -AC_CONFIG_FILES([Makefile src/Makefile src/version.h]) +AC_CONFIG_FILES([Makefile sctjudge.spec src/Makefile src/version.h]) AC_OUTPUT echo "" diff --git a/sctjudge.spec.in b/sctjudge.spec.in new file mode 100644 index 0000000..31bc68e --- /dev/null +++ b/sctjudge.spec.in @@ -0,0 +1,40 @@ +Name: @PROGRAM_NAME@ +Version: @PROGRAM_VERSION@ +Release: 1%{?dist} +Summary: Simple common test judge program + +Group: Unknown +License: Redistributable but unknown +URL: http://www.tfcis.org/~lantw44/programs.html +Source0: sctjudge-%{version}.tar.gz + +BuildRequires: gcc glibc-devel libcap libcap-devel +Requires: glibc libcap + +%description +一個簡易的程式設計題目評測程式 + +%prep +%setup -q + + +%build +%configure --enable-procmon --enable-cap +make %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +make -i install DESTDIR=$RPM_BUILD_ROOT + +%post +setcap 'cap_sys_chroot,cap_setuid,cap_setgid,cap_kill+ep' %{_bindir}/sctjudge + + +%files +%defattr(-,root,root,-) +%doc +%{_bindir}/sctjudge + + +%changelog diff --git a/src/mkchild.c b/src/mkchild.c index 1f7f51d..772dbbe 100644 --- a/src/mkchild.c +++ b/src/mkchild.c @@ -377,7 +377,11 @@ void* sctjudge_makechild(void* arg){ /* 建立用來和 chlid process 溝通的 pipe */ pipe(childpipe); pthread_mutex_lock(&pidmutex); +#ifdef HAVE_WORKING_FORK pidchild = fork(); +#else +#error "This program requires a working fork function." +#endif if(pidchild < 0){ #ifndef HAVE_CONF_CAP disable_setuid(); |