After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 578225 - More posix functions
More posix functions
Status: RESOLVED DUPLICATE of bug 555250
Product: vala
Classification: Core
Component: Bindings
0.7.x
Other All
: Normal normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-04-07 12:22 UTC by Jukka-Pekka Iivonen
Modified: 2009-05-09 15:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
More posix APIs (7.73 KB, patch)
2009-04-07 12:22 UTC, Jukka-Pekka Iivonen
committed Details | Review
struct timeval binding (538 bytes, patch)
2009-04-25 02:56 UTC, Evan Nemerson
none Details | Review

Description Jukka-Pekka Iivonen 2009-04-07 12:22:00 UTC
Please describe the problem:
The following patch adds numerous Posix bindings, mostly related to unistd.h, stdlib.h and some other APIs.


diff -rNau vala-0.7.0/vapi/posix.vapi vala-0.7.0-n/vapi/posix.vapi
--- vala-0.7.0/vapi/posix.vapi	2009-03-28 16:40:48.000000000 +0200
+++ vala-0.7.0-n/vapi/posix.vapi	2009-04-07 15:20:06.000000000 +0300
@@ -669,6 +669,223 @@
 	[CCode (cheader_filename = "sys/stat.h")]
 	int stat (string filename, out Stat buf);
 
+	[CCode (cheader_filename = "sys/stat.h")]
+	public int chmod (string filename, mode_t mode);
+	[CCode (cheader_filename = "sys/stat.h")]
+	public mode_t umask (mode_t mask);
+	[CCode (cheader_filename = "sys/stat.h")]
+	public int mkdir (string path, mode_t mode);
+	[CCode (cheader_filename = "sys/stat.h")]
+	public int mkfifo (string path, mode_t mode);
+
+	[CCode (cheader_filename = "sys/wait.h")]
+	public pid_t wait (out int status);
+	[CCode (cheader_filename = "sys/wait.h")]
+	public pid_t waitpid (pid_t pid, out int status, int options);
+
+	[CCode (cheader_filename = "sys/poll.h", cname = "struct pollfd")]
+	public struct pollfd {
+		public int fd;
+		public int events;
+		public int revents;
+	}
+
+	[CCode (cheader_filename = "poll.h")]
+	public const int POLLIN;
+	[CCode (cheader_filename = "poll.h")]
+	public const int POLLPRI;
+	[CCode (cheader_filename = "poll.h")]
+	public const int POLLOUT;
+	[CCode (cheader_filename = "poll.h")]
+	public const int POLLRDHUP;
+	[CCode (cheader_filename = "poll.h")]
+	public const int POLLERR;
+	[CCode (cheader_filename = "poll.h")]
+	public const int POLLHUP;
+	[CCode (cheader_filename = "poll.h")]
+	public const int POLLNVAL;
+
+	[SimpleType]
+	[IntegerType (rank = 9)]
+	[CCode (cheader_filename = "sys/poll.h", cname = "nfds_t")]
+	public struct nfds_t {
+	}
+
+	[CCode (cheader_filename = "sys/types.h")]
+	public struct sigset_t {
+	}
+
+	[CCode (cheader_filename = "poll.h")]
+	public int poll (pollfd fds, nfds_t nfds, int timeout);
+	[CCode (cheader_filename = "poll.h")]
+	public int ppoll (pollfd fds, nfds_t nfds, timespec? timeout, sigset_t? sigmask);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public void exit (int status);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public void _exit (int status);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public void abort ();
+
+	public delegate void AtExitFunc ();
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public void atexit (AtExitFunc func);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public int mkstemp (string template);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public int mkostemp (string template, int flags);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public int system (string command);
+
+	public delegate int compar_fn_t (void* key1, void* key2);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public void* bsearch (void* key, void* base, size_t nmemb, size_t size, compar_fn_t func);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public void qsort (void* base, size_t nmemb, size_t size, compar_fn_t func);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public void qsort_r (void* base, size_t nmemb, size_t size, compar_fn_t func, void* arg);
+
+	[CCode (cheader_filename = "stdlib.h")]
+	public const int EXIT_FAILURE;
+	[CCode (cheader_filename = "stdlib.h")]
+	public const int EXIT_SUCCESS;
+
+	[CCode (cheader_filename = "unistd.h")]
+	public pid_t fork ();
+	[CCode (cheader_filename = "unistd.h")]
+	public pid_t vfork ();
+	[CCode (cheader_filename = "unistd.h")]
+	public unowned string ttyname (int fd);
+	[CCode (cheader_filename = "unistd.h")]
+	public bool isatty (int fd);
+	[CCode (cheader_filename = "unistd.h")]
+	public int link (string from, string to);
+	[CCode (cheader_filename = "unistd.h")]
+	public int symlink (string from, string to);
+	[CCode (cheader_filename = "unistd.h")]
+	public int rmdir (string path);
+	[CCode (cheader_filename = "unistd.h")]
+	public pid_t tcgetpgrp (int fd);
+	[CCode (cheader_filename = "unistd.h")]
+	public int tcsetpgrp (int fd, pid_t pgrp_id);
+	[CCode (cheader_filename = "unistd.h")]
+	public unowned string getlogin ();
+	[CCode (cheader_filename = "unistd.h")]
+	public int vhangup ();
+	[CCode (cheader_filename = "unistd.h")]
+	public int revoke (string file);
+	[CCode (cheader_filename = "unistd.h")]
+	public int acct (string name);
+	[CCode (cheader_filename = "unistd.h")]
+	public unowned string getusershell ();
+	[CCode (cheader_filename = "unistd.h")]
+	public void endusershell ();
+	[CCode (cheader_filename = "unistd.h")]
+	public void setusershell ();
+	[CCode (cheader_filename = "unistd.h")]
+	public int chroot (string path);
+	[CCode (cheader_filename = "unistd.h")]
+	public unowned string getpass (string promt);
+	[CCode (cheader_filename = "unistd.h")]
+	public int getpagesize ();
+	[CCode (cheader_filename = "unistd.h")]
+	public int getdtablesize ();
+
+	[CCode (cheader_filename = "unistd.h")]
+	public int unlink (string pathname);
+
+	[CCode (cheader_filename = "unistd.h")]
+	public const int STDIN_FILENO;
+	[CCode (cheader_filename = "unistd.h")]
+	public const int STDOUT_FILENO;
+	[CCode (cheader_filename = "unistd.h")]
+	public const int STDERR_FILENO;
+	[CCode (cheader_filename = "unistd.h")]
+	public const int R_OK;
+	[CCode (cheader_filename = "unistd.h")]
+	public const int W_OK;
+	[CCode (cheader_filename = "unistd.h")]
+	public const int X_OK;
+	[CCode (cheader_filename = "unistd.h")]
+	public const int F_OK;
+
+	[CCode (cheader_filename = "unistd.h")]
+	public int access (string patchname, int mode);
+	[CCode (cheader_filename = "unistd.h")]
+	public int euidaccess (string patchname, int mode);
+	[CCode (cheader_filename = "unistd.h")]
+	public int eaccess (string patchname, int mode);
+
+	[CCode (cheader_filename = "unistd.h")]
+	public int pipe ([CCode (array_length = false)] int[] pipefd);
+	[CCode (cheader_filename = "unistd.h")]
+	public uint alarm (uint seconds);
+	[CCode (cheader_filename = "unistd.h")]
+	public uint ualarm (uint useconds);
+	[CCode (cheader_filename = "unistd.h")]
+	public uint sleep (uint seconds);
+	[CCode (cheader_filename = "unistd.h")]
+	public uint usleep (uint useconds);
+	[CCode (cheader_filename = "unistd.h")]
+	public int pause ();
+	[CCode (cheader_filename = "unistd.h")]
+	public int chown (string filename, uid_t owner, gid_t group);
+	[CCode (cheader_filename = "unistd.h")]
+	public int fchown (int fd, uid_t owner, gid_t group);
+	[CCode (cheader_filename = "unistd.h")]
+	public int lchown (string filename, uid_t owner, gid_t group);
+	[CCode (cheader_filename = "unistd.h")]
+	public int chdir (string filepath);
+	[CCode (cheader_filename = "unistd.h")]
+	public int fchdir (int file);
+	[CCode (cheader_filename = "unistd.h")]
+	public int dup (int fd);
+	[CCode (cheader_filename = "unistd.h")]
+	public int dup2 (int fd1, int fd2);
+	[CCode (cheader_filename = "unistd.h")]
+	public pid_t getpid ();
+	[CCode (cheader_filename = "unistd.h")]
+	public pid_t getppid ();
+	[CCode (cheader_filename = "unistd.h")]
+	public pid_t getpgrp ();
+	[CCode (cheader_filename = "unistd.h")]
+	public pid_t getpgid ();
+	[CCode (cheader_filename = "unistd.h")]
+	public int setpgid (pid_t pid, pid_t pgid);
+	[CCode (cheader_filename = "unistd.h")]
+	public pid_t setpgrp ();
+	[CCode (cheader_filename = "unistd.h")]
+	public pid_t getsid (pid_t pid);
+	[CCode (cheader_filename = "unistd.h")]
+	public uid_t getuid ();
+	[CCode (cheader_filename = "unistd.h")]
+	public uid_t geteuid ();
+	[CCode (cheader_filename = "unistd.h")]
+	public gid_t getgid ();
+	[CCode (cheader_filename = "unistd.h")]
+	public gid_t getegid ();
+	[CCode (cheader_filename = "unistd.h")]
+	public int group_member (gid_t gid);
+	[CCode (cheader_filename = "unistd.h")]
+	public int setuid (uid_t uid);
+	[CCode (cheader_filename = "unistd.h")]
+	public int setgid (gid_t gid);
+
+	[SimpleType]
+	[IntegerType (rank = 9)]
+	[CCode (cheader_filename = "sys/types.h", cname = "key_t")]
+	public struct key_t {
+	}
+
 	[SimpleType]
 	[IntegerType (rank = 9)]
 	[CCode (cheader_filename = "sys/statvfs.h")]


Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Jukka-Pekka Iivonen 2009-04-07 12:22:45 UTC
Created attachment 132262 [details] [review]
More posix APIs
Comment 2 Evan Nemerson 2009-04-25 02:56:52 UTC
Created attachment 133284 [details] [review]
struct timeval binding

I was torn between what I did, and making it a SimpleType and passing it as a ref/out param. This way is easier, but I feel like using ref/out would be more correct.

I wouldn't be at all disappointed to see it changed to ref/out.
Comment 3 Jürg Billeter 2009-05-07 13:44:50 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.


*** This bug has been marked as a duplicate of 555250 ***